提交 bd8ee989 编写于 作者: P Paul Vick

Updated based on comments

上级 80ed32ec
......@@ -78,21 +78,14 @@ private static bool FilterDefinition(ISymbol definition)
(definition as IMethodSymbol)?.AssociatedSymbol != null;
}
/// <summary>
/// Returns partial symbol locations whose node does not match the queried syntaxNode
/// </summary>
/// <param name="symbol">Symbol whose locations are queried</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <returns>Partial locations</returns>
// Returns partial symbol locations whose node does not match the queried syntaxNode
private IEnumerable<Location> GetPartialLocations(ISymbol symbol, CancellationToken cancellationToken)
{
// Returns nodes from source not equal to actual location
return from syntaxReference in symbol.DeclaringSyntaxReferences
let candidateSyntaxNode = syntaxReference.GetSyntax(cancellationToken)
where !(_queriedNode.Span == candidateSyntaxNode.Span &&
_queriedNode.SyntaxTree.FilePath.Equals(candidateSyntaxNode.SyntaxTree.FilePath,
StringComparison.OrdinalIgnoreCase))
select syntaxReference.SyntaxTree.GetLocation(syntaxReference.Span);
let candidateSyntaxNode = syntaxReference.GetSyntax(cancellationToken)
where _queriedNode != candidateSyntaxNode
select candidateSyntaxNode.GetLocation();
}
public void OnDefinitionFound(ISymbol symbol)
......
......@@ -33,10 +33,6 @@ internal sealed class CodeLensReferenceService : ICodeLensReferencesService
}
var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
if (semanticModel == null)
{
return null;
}
cancellationToken.ThrowIfCancellationRequested();
......@@ -92,10 +88,6 @@ private static async Task<ReferenceLocationDescriptor> GetDescriptorOfEnclosingS
}
var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
if (semanticModel == null)
{
return null;
}
var langServices = document.GetLanguageService<ICodeLensDisplayInfoService>();
if (langServices == null)
......@@ -231,11 +223,6 @@ private static async Task<ReferenceMethodDescriptor> GetMethodDescriptorAsync(Lo
var document = solution.GetDocument(doc.Id);
var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
if (semanticModel == null)
{
return null;
}
var fullName = GetEnclosingMethod(semanticModel, commonLocation)?.ToDisplayString(MethodDisplayFormat);
return !string.IsNullOrEmpty(fullName) ? new ReferenceMethodDescriptor(fullName, document.FilePath) : null;
......@@ -269,10 +256,6 @@ public async Task<IEnumerable<ReferenceMethodDescriptor>> FindReferenceMethodsAs
var document = solution.GetDocument(doc.Id);
var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
if (semanticModel == null)
{
return null;
}
return GetEnclosingMethod(semanticModel, commonLocation)?.ToDisplayString(MethodDisplayFormat);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册