-
Notifications
You must be signed in to change notification settings - Fork 320
Allow clients to pass experimental capabilities they want to enable as a dictionary #2204
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
Merged
ahoppen
merged 1 commit into
swiftlang:main
from
ahoppen:experimental-capabilities-dictionary
Aug 2, 2025
Merged
Allow clients to pass experimental capabilities they want to enable as a dictionary #2204
ahoppen
merged 1 commit into
swiftlang:main
from
ahoppen:experimental-capabilities-dictionary
Aug 2, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…s a dictionary The motivation for this is that I noticed that the `workspace/peekDocuments` request only allows the specification of a document to peek but not the location to peek within it. The fix is to change the `location` parameter from `DocumentUri` to `Location`, but this is a protocol-breaking change, so the client needs to communicate that it can support locations in the `workspace/peekDocuments` request. The client currently communicates that it supports peeking documents by passing `workspace/peekDocuments: true` in the experimental client capabilities. We could just add another option to the experimental client capabilities like `workspace/peekDocuments.supportsLocations` but this seems a little hacky. Instead, what I propose is that we 1. Allow enabling experimental capabilities as `"<capability name>": { "supported": true }` 2. Switch the VS Code Swift extension to enable client capabilities using a dictionary if it discovers that it uses SourceKit-LSP ≥6.3 (older SourceKit-LSP don’t recogize a dictionary as enabling a capability) 3. Expanding the options to `"workspace/peekDocuments": { "supported" true, "supportsLocation": true }` to communicate that location-based peeking is supported This pattern will also support experimental capability changes like this in the future. Use cases that might lack because of this are: 1. Using an old Swift 6.3 toolchain that doesn’t support dictionary-based capabilities with the VS Code Swift extension. In that case macro expansion will work in the fallback mode that we have for other editors and active editor tracking (which cancels target preparation when a file is switched) is disabled. I think this is acceptable. 2. If there are other editors that support these experimental capabilities, they will continue to work just fine by passing the boolen value to enable the option. If they want to support one of the options (eg. location-based peeking), they will need to switch to dictinary-based enabling and thus check the SourceKit-LSP version prior to startup. This might be mildly annoying on their side but since the number of client that support these capabilities should be very small (I am not aware of any) and they need to explicitly opt-in to the new behavior, I think this is also acceptable.
@swift-ci Please test |
ahoppen
added a commit
to ahoppen/vscode-swift
that referenced
this pull request
Jul 14, 2025
…te experimental client capabilities Companion of swiftlang/sourcekit-lsp#2204
ahoppen
added a commit
to ahoppen/vscode-swift
that referenced
this pull request
Jul 14, 2025
…te experimental client capabilities Companion of swiftlang/sourcekit-lsp#2204
ahoppen
added a commit
to ahoppen/vscode-swift
that referenced
this pull request
Jul 15, 2025
…te experimental client capabilities Companion of swiftlang/sourcekit-lsp#2204
bnbarham
approved these changes
Aug 1, 2025
ahoppen
added a commit
to ahoppen/vscode-swift
that referenced
this pull request
Aug 4, 2025
…te experimental client capabilities Companion of swiftlang/sourcekit-lsp#2204
ahoppen
added a commit
to ahoppen/vscode-swift
that referenced
this pull request
Aug 4, 2025
…te experimental client capabilities Companion of swiftlang/sourcekit-lsp#2204
plemarquand
pushed a commit
to swiftlang/vscode-swift
that referenced
this pull request
Aug 4, 2025
…te experimental client capabilities (#1715) Companion of swiftlang/sourcekit-lsp#2204
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The motivation for this is that I noticed that the
workspace/peekDocuments
request only allows the specification of a document to peek but not the location to peek within it. The fix is to change thelocation
parameter fromDocumentUri
toLocation
, but this is a protocol-breaking change, so the client needs to communicate that it can support locations in theworkspace/peekDocuments
request.The client currently communicates that it supports peeking documents by passing
workspace/peekDocuments: true
in the experimental client capabilities. We could just add another option to the experimental client capabilities likeworkspace/peekDocuments.supportsLocations
but this seems a little hacky. Instead, what I propose is that we"<capability name>": { "supported": true }
"workspace/peekDocuments": { "supported" true, "supportsLocation": true }
to communicate that location-based peeking is supportedThis pattern will also support experimental capability changes like this in the future.
Use cases that might lack because of this are: