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

Fix goto-def on partial methods in LSP #68559

Merged
merged 2 commits into from
Jun 12, 2023

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi requested review from a team as code owners June 12, 2023 18:22
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jun 12, 2023

namespace Microsoft.CodeAnalysis.GoToDefinition
{
internal static class GoToDefinitionHelpers
{
public static async Task<ImmutableArray<DefinitionItem>> GetDefinitionsAsync(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to common location. not tied to 'EditorFeatures' (e.g. VS) impl of goto-def.

symbol = await SymbolFinder.FindSourceDefinitionAsync(symbol, project.Solution, cancellationToken).ConfigureAwait(false) ?? symbol;
var solution = project.Solution;
symbol = await SymbolFinder.FindSourceDefinitionAsync(symbol, solution, cancellationToken).ConfigureAwait(false) ?? symbol;
symbol = await GoToDefinitionFeatureHelpers.TryGetPreferredSymbolAsync(solution, symbol, cancellationToken).ConfigureAwait(false);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this continues the long pain of having something like 3 different goto-def impls in roslyn, which do/don't use the same set of underlying helpers to get consistent results. This includes IGoToDefinitionService, IAsyncGoToDefinitionService, and IFindDefinitionService. Ideally we can get to a place where this all gets burned down. But it's woven so deeply into different systems that that's going to be very hard for a while.

{
internal static class GoToDefinitionFeatureHelpers
{
public static async Task<ISymbol?> TryGetPreferredSymbolAsync(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pure move.

ISymbol? symbol,
Solution solution,
bool thirdPartyNavigationAllowed,
CancellationToken cancellationToken)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pure move.

@arkalyanms
Copy link
Member

Nice, our first forcing function to validate the roslyn server insertion infra for VSCode!

@CyrusNajmabadi CyrusNajmabadi merged commit ab8c299 into dotnet:main Jun 12, 2023
22 of 24 checks passed
@ghost ghost added this to the Next milestone Jun 12, 2023
@CyrusNajmabadi CyrusNajmabadi deleted the lspGoToDef branch June 13, 2023 17:45
@RikkiGibson RikkiGibson modified the milestones: Next, 17.7 P3 Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
4 participants