提交 6d3a3166 编写于 作者: H Heejae Chang

Merge remote-tracking branch 'upstream/stabilization' into...

Merge remote-tracking branch 'upstream/stabilization' into merge-stabilization-into-future-stabilization20160309-160110
......@@ -124,8 +124,7 @@ private void ProduceTags(TaggerContext<TTag> context, DocumentSnapshotSpan spanT
{
if (_owner.IncludeDiagnostic(diagnosticData))
{
var actualSpan = diagnosticData
.GetExistingOrCalculatedTextSpan(sourceText)
var actualSpan = AdjustSpan(diagnosticData.GetExistingOrCalculatedTextSpan(sourceText), sourceText)
.ToSnapshotSpan(editorSnapshot)
.TranslateTo(requestedSnapshot, SpanTrackingMode.EdgeExclusive);
......@@ -142,6 +141,21 @@ private void ProduceTags(TaggerContext<TTag> context, DocumentSnapshotSpan spanT
}
}
private TextSpan AdjustSpan(TextSpan span, SourceText text)
{
var start = Math.Max(0, Math.Min(span.Start, text.Length));
var end = Math.Max(0, Math.Min(span.End, text.Length));
if (start > end)
{
var temp = end;
end = start;
start = temp;
}
return TextSpan.FromBounds(start, end);
}
private bool IsSuppressed(NormalizedSnapshotSpanCollection suppressedSpans, SnapshotSpan span)
{
return suppressedSpans != null && suppressedSpans.IntersectsWith(span);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册