Create a new GoToTypeDefinition endpoint#2315
Conversation
Seems to pass basic tests, but fails to retrieve data in metadata
|
@filipw @JoeRobich You seem to be the most active in this repository, could you take a look or let me know if there's anything I need to do for a PR? |
I will take a look at this next week. |
|
@JoeRobich Just checking back in. No rush, just don't want this to get lost. |
JoeRobich
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
|
|
||
| public const string GotoDefinition = "/v2/gotodefinition"; | ||
|
|
||
| public const string GotoTypeDefinition = "/v2/gototypedefinition"; |
There was a problem hiding this comment.
@filipw Since this is the first iteration of this endpoint, is it ok to be under V2?
There was a problem hiding this comment.
I think it should just be /gototypedefinition, we do not version at API level but on endpoint level.
for example /completion is the modern version of intellisense and it was not versioned as v2
There was a problem hiding this comment.
Okay, it's updated accordingly
| [ImportingConstructor] | ||
| public GotoTypeDefinitionV2Handler( | ||
| OmniSharpWorkspace workspace, | ||
| MetadataExternalSourceService metadataExternalSourceService) |
There was a problem hiding this comment.
I think this should use ExternalSourceServiceFactory to also cover cases when decompilation is enabled
There was a problem hiding this comment.
This file seems to be mostly a cut and paste of the GotoDefinitionV2Handler. Perhaps we can update all the Navigation handlers as a follow up.
There was a problem hiding this comment.
This file seems to be mostly a cut and paste of the GotoDefinitionV2Handler.
Yeah, it was a copy and paste. I've updated to use the ExternalSourceServiceFactory.
| continue; | ||
| } | ||
|
|
||
| var aliasLocations = await GotoTypeDefinitionHandlerHelper.GetAliasFromMetadataAsync( |
There was a problem hiding this comment.
I am not sure you can assume that metadata will be used, because the user might have enabled decompilation
There was a problem hiding this comment.
Thanks for the tip, I've updated to use the IExternalSourceService from the ExternalSourceServiceFactory.
|
thanks! |
PR OmniSharp/omnisharp-roslyn#2315 add a gototypedefinition endpoint. This PR adds a provider that utilizes the endpoint.
Creates a new endpoint to go the definition of the type of a local variable, parameter, field, or property. The implementation borrows heavily from the GotoDefinition endpoint. Fixes issue #2297
This endpoint should be helpful in C# workflow, especially when using implicitly typed variables that don't have the name of the type anywhere in the file. This also provides an endpoint to use with the VS Code command
editor.action.goToTypeDefinition.Example:
file1.cs:
file2.cs:
GoToTypeDefinition at the position of
variableNamewould return the definition of the classCin file1.cs.