-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Enable LSP go-to-definition, find-all-references, and go-to-implementation with command handler precedence #80951
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
Conversation
… command handler ordering Co-authored-by: dibarbet <[email protected]>
| /// <summary> | ||
| /// Command handler name for LSP Go To Definition. | ||
| /// </summary> | ||
| public const string LspGoToDefinition = "LSP Go To Definition Command Handler"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one is "LSP GoToDefinitionCommandHandler" btw
| /// <summary> | ||
| /// Command handler name for LSP Find References. | ||
| /// </summary> | ||
| public const string LspFindReferences = "LSP Find References Command Handler"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot use exactly LSP FindReferenceCommandHandler as the value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to "LSP FindReferenceCommandHandler" in e37817f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you doc that these names are agreed upon externally and cannot change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot can you update the summary documentation that these names are agreed upon externally and cannot change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated documentation for all three LSP command handler names to indicate they are agreed upon externally and cannot be changed in c63bb03
| /// <summary> | ||
| /// Command handler name for LSP Go To Definition. | ||
| /// </summary> | ||
| public const string LspGoToDefinition = "LSP Go To Definition Command Handler"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot use exactly LSP GoToDefinitionCommandHandler as the value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to "LSP GoToDefinitionCommandHandler" in e37817f
Co-authored-by: dibarbet <[email protected]>
|
@copilot implement the same things for the Go To Implementation capability |
1 similar comment
|
@copilot implement the same things for the Go To Implementation capability |
Co-authored-by: dibarbet <[email protected]>
Added Go To Implementation capability and command handler ordering in 93fcd0e. The changes include:
|
|
Tested with an additional fix on the LSP client side to ensure they are ordered after our handlers. This allows us to use VS MEF handlers for standard editor requests, but gives other extensions the ability to call our LSP handlers to retrieve definition /impl and reference information. Current thought is to take this in dev18 to make sure that this ordering works |
…d cannot change Co-authored-by: dibarbet <[email protected]>
dotnet#80951 slightly broke Peek Definition by making editor pick VS LSP client implementation of IPeekableSourceProvider instead of this one. Similarly to command handlers this provider also needs to be ordered before LSP's one.
#80951 slightly broke Peek Definition by making editor pick VS LSP client implementation of IPeekableSourceProvider instead of this one. Similarly to command handlers this provider also needs to be ordered before LSP's one.
Changes: Enable LSP Go-to-Definition, Find-All-References, and Go-to-Implementation Capabilities
Allows other extensions to call into our LSP handlers, but ensures that the MEF APIs are still used for normal user invoked commands by ensuring our MEF handlers are ordered before LSP MEF handlers.
Completed:
DefinitionProvider,ReferencesProvider, andImplementationProvidercapabilities inAlwaysActivateInProcLanguageClient.GetCapabilities()regardless of the LSP feature flagOrder(Before = ...)attribute toGoToDefinitionCommandHandlerto ensure it runs before any LSP command handlersOrder(Before = ...)attribute toFindReferencesCommandHandlerto ensure it runs before any LSP command handlersOrder(Before = ...)attribute toGoToImplementationCommandHandlerto ensure it runs before any LSP command handlersLspGoToDefinition,LspFindReferences, andLspGoToImplementationtoPredefinedCommandHandlerNamesFiles Modified:
src/EditorFeatures/Core/LanguageServer/AlwaysActivateInProcLanguageClient.cs- Enabled DefinitionProvider, ReferencesProvider, and ImplementationProvider capabilities unconditionallysrc/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs- Added Order(Before) attribute for LSP handlersrc/EditorFeatures/Core/GoOrFind/FindReferences/FindReferencesCommandHandler.cs- Added Order(Before) attribute for LSP handlersrc/EditorFeatures/Core/GoOrFind/GoToImplementation/GoToImplementationCommandHandler.cs- Added Order(Before) attribute for LSP handlersrc/EditorFeatures/Core/Extensibility/Commands/PredefinedCommandHandlerNames.cs- Added LSP command handler name constants with exact values and documented they are externally agreed uponSummary:
These changes enable clients to call the LSP go-to-definition, find-all-references, and go-to-implementation handlers by advertising the capabilities in the AlwaysActiveInProcLanguageServer. The traditional command handlers are ordered to run before any LSP-based command handlers, ensuring they remain active for normal scenarios while allowing experimentation with LSP handlers.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.