Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional information to help F# with navigating to symbols #64475

Merged
merged 1 commit into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ internal interface ICrossLanguageSymbolNavigationService
/// defined at: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/#id-strings. Should
/// return <see langword="null"/> if the 3rd party language cannot navigate to this particular symbol.
/// </summary>
Task<INavigableLocation?> TryGetNavigableLocationAsync(string documentationCommentId, CancellationToken cancellationToken);
/// <param name="assemblyName">The name of the assembly the symbol was defined in. Can be used by the
/// receiver to quickly filter down to the project/compilation search for the symbol.</param>
Task<INavigableLocation?> TryGetNavigableLocationAsync(
string assemblyName, string documentationCommentId, CancellationToken cancellationToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ public FSharpCrossLanguageSymbolNavigationService(
_underlyingService = underlyingService;
}

public async Task<INavigableLocation?> TryGetNavigableLocationAsync(string documentationCommentId, CancellationToken cancellationToken)
public async Task<INavigableLocation?> TryGetNavigableLocationAsync(
string assemblyName, string documentationCommentId, CancellationToken cancellationToken)
{
// Only defer to actual F# service if it exists.
if (_underlyingService is null)
return null;

var location = await _underlyingService.TryGetNavigableLocationAsync(documentationCommentId, cancellationToken).ConfigureAwait(false);
var location = await _underlyingService.TryGetNavigableLocationAsync(
assemblyName, documentationCommentId, cancellationToken).ConfigureAwait(false);
if (location == null)
return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Navigation
internal interface IFSharpCrossLanguageSymbolNavigationService
{
/// <inheritdoc cref="ICrossLanguageSymbolNavigationService.TryGetNavigableLocationAsync"/>
Task<IFSharpNavigableLocation?> TryGetNavigableLocationAsync(string documentationCommentId, CancellationToken cancellationToken);
Task<IFSharpNavigableLocation?> TryGetNavigableLocationAsync(
string assemblyName, string documentationCommentId, CancellationToken cancellationToken);
}

/// <inheritdoc cref="NavigationOptions"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ public VisualStudioSymbolNavigationService(

// See if there's another .Net language service that can handle navigating to this metadata symbol (for example, F#).
var docCommentId = symbol.GetDocumentationCommentId();
if (docCommentId != null)
var assemblyName = symbol.ContainingAssembly.Identity.Name;
if (docCommentId != null && assemblyName != null)
{
foreach (var lazyService in solution.Services.ExportProvider.GetExports<ICrossLanguageSymbolNavigationService>())
{
var crossLanguageService = lazyService.Value;
var crossLanguageLocation = await crossLanguageService.TryGetNavigableLocationAsync(docCommentId, cancellationToken).ConfigureAwait(false);
var crossLanguageLocation = await crossLanguageService.TryGetNavigableLocationAsync(
assemblyName, docCommentId, cancellationToken).ConfigureAwait(false);
if (crossLanguageLocation != null)
return crossLanguageLocation;
}
Expand Down