提交 7e0ea5b7 编写于 作者: J Jonathon Marolf

check if syntax tree is present

上级 44b03197
......@@ -278,17 +278,24 @@ private static CompletionItem Disambiguate(CompletionItem item, CompletionItem e
CancellationToken cancellationToken)
{
var context = new CompletionListContext(document, position, triggerInfo, options, cancellationToken);
var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
if (!root.FullSpan.IntersectsWith(position))
if (document.SupportsSyntaxTree)
{
try
var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
if (!root.FullSpan.IntersectsWith(position))
{
// Trying to track down source of https://github.com/dotnet/roslyn/issues/9325
var sourceText = await document.GetTextAsync(cancellationToken).ConfigureAwait(false);
ReportException(position, root, sourceText);
try
{
// Trying to track down source of https://github.com/dotnet/roslyn/issues/9325
var sourceText = await document.GetTextAsync(cancellationToken).ConfigureAwait(false);
ReportException(position, root, sourceText);
}
catch (Exception e) when (FatalError.ReportWithoutCrash(e))
{
}
}
catch (Exception e) when (FatalError.ReportWithoutCrash(e))
else
{
await provider.ProduceCompletionListAsync(context).ConfigureAwait(false);
}
}
else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册