提交 3568b7b4 编写于 作者: R Ravi Chande

Ensure that cref completion uses Speculative SemanticModel. Fixes TFS #988380

上级 4d9f9269
......@@ -76,7 +76,11 @@ protected override async Task<IEnumerable<CompletionItem>> GetItemsWorkerAsync(D
}
var result = SpecializedCollections.EmptyEnumerable<ISymbol>();
var semanticModel = await document.GetCSharpSemanticModelForNodeAsync(token.Parent, cancellationToken).ConfigureAwait(false);
// To get a Speculative SemanticModel (which is much faster), we need to
// walk up to the node the DocumentationTrivia is attached to.
var parentNode = token.GetAncestor<DocumentationCommentTriviaSyntax>().ParentTrivia.Token.Parent;
var semanticModel = await document.GetCSharpSemanticModelForNodeAsync(parentNode, cancellationToken).ConfigureAwait(false);
// cref ""|, ""|"", ""a|""
if (token.IsKind(SyntaxKind.DoubleQuoteToken, SyntaxKind.SingleQuoteToken) && token.Parent.IsKind(SyntaxKind.XmlCrefAttribute))
......
......@@ -59,7 +59,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
Return Nothing
End If
Dim semanticModel = Await document.GetVisualBasicSemanticModelForNodeAsync(touchingToken.Parent, cancellationToken).ConfigureAwait(False)
' To get a Speculative SemanticModel (which is much faster), we need to
' walk up to the node the DocumentationTrivia is attached to.
Dim parentNode = token.GetAncestor(Of DocumentationCommentTriviaSyntax)().ParentTrivia.Token.Parent
Dim semanticModel = Await document.GetVisualBasicSemanticModelForNodeAsync(parentNode, cancellationToken).ConfigureAwait(False)
Dim workspace = document.Project.Solution.Workspace
If IsXmlStringContext(touchingToken) OrElse
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册