提交 3906c94c 编写于 作者: C Cyrus Najmabadi

Be resilient to the buffer being different.

上级 146f8c5e
......@@ -173,6 +173,14 @@ private void ProduceTags(TaggerContext<TTag> context, DocumentSnapshotSpan spanT
_diagnosticIdToTextSnapshot.TryGetValue(id, out var diagnosticSnapshot);
diagnosticSnapshot = diagnosticSnapshot ?? editorSnapshot;
// This may happen if the file is closed/open. We can't map these spans forward.
// Note: when this happens, the diagnostic service will reanalyze the file. So
// up to date diagnostic spans will appear shortly after this.
if (diagnosticSnapshot.TextBuffer != editorSnapshot.TextBuffer)
{
diagnosticSnapshot = editorSnapshot;
}
var sourceText = diagnosticSnapshot.AsText();
foreach (var diagnosticData in diagnostics)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册