-
Notifications
You must be signed in to change notification settings - Fork 117
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
Respect the client capability "textDocument.definition.linkSupport." #1875
Respect the client capability "textDocument.definition.linkSupport." #1875
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
26aad5a
to
ac5d422
Compare
server/src/session.ts
Outdated
@@ -882,6 +892,14 @@ export class Session { | |||
if (!definitions) { | |||
return null; | |||
} | |||
|
|||
const clientSupportsLocationLinks = | |||
this.clientCapabilities.textDocument?.definition?.linkSupport ?? false; |
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.clientCapabilities.textDocument?.definition?.linkSupport ?? false; | |
this.clientCapabilities.textDocument?.typeDefinition?.linkSupport ?? false; |
nit: I think technically this should be typeDefinition
though I doubt these would ever truly be different in the client capabilities. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_typeDefinition
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.
Looks good other than 1 technicality in onTypeDefinition
. Thanks for the fix!
ac5d422
to
21c5954
Compare
Thanks for taking the time to guide me and review the code. The main concern that I could have with this PR is that we need to ensure that the language server client running inside vscode (or any other consumer) announces their client capabilities correctly, as in including I'm not sure how this can be tested in vscode, or if the automatic tests already covers this. |
I checked out this PR and double checked that it's working in VSCode and that the VSCode client correctly sends its capabilities.
Unfortunately the integration tests which would actually launch the VSCode client with a local build have been disabled due to flakiness. Some day I hope to resurrect them but at the moment, tests which need to exercise end-to-end behavior like interactions between client and server are manual. |
…on,typeDefinition}.linkSupport." If the client doesn't explicitly tells the server that they have this capability then a `Location` should be send instead of `LocationLink` as a reply to a "Goto Declaration Request". See the relevant documentation: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_declaration
21c5954
to
5578c0f
Compare
…on,typeDefinition}.linkSupport." (#1875) If the client doesn't explicitly tells the server that they have this capability then a `Location` should be send instead of `LocationLink` as a reply to a "Goto Declaration Request". See the relevant documentation: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_declaration (cherry picked from commit 8751840)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
If the client doesn't explicitly tells the server that they have this capability then a
Location
should be send instead ofLocationLink
as a reply to a "Goto Definition Request".See the relevant documentation:
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_definition
Closes #1874