Skip to content

Don’t return edits from ExecuteCommandRequest #1498

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

Closed
ahoppen opened this issue Jun 20, 2024 · 1 comment · Fixed by #1479
Closed

Don’t return edits from ExecuteCommandRequest #1498

ahoppen opened this issue Jun 20, 2024 · 1 comment · Fixed by #1479

Comments

@ahoppen
Copy link
Member

ahoppen commented Jun 20, 2024

Currently, the ExecuteCommandRequest is returning the edits it wants to perform to the source file as the LSPAny response. Clients shouldn’t know how to interpret that LSPAny and the edits are actually applied by sending a ApplyEditRequest to the client.

Only tests are currently relying on the response of the ExecuteCommandRequest. We should change those tests to test the actual ApplyEditRequest sent to the client and make ExecuteCommandRequest return an empty response.

@ahoppen
Copy link
Member Author

ahoppen commented Jun 20, 2024

Synced to Apple’s issue tracker as rdar://130207754

lokesh-tr added a commit to lokesh-tr/sourcekit-lsp that referenced this issue Jul 2, 2024
-------------------------------------------------------------------------------

This implements an LSP Extension `PeekDocumentsRequest` to let `ExpandMacroCommand` to open the macro expansions in a "peeked" editor window.
For this to work, the client has to pass "workspace/peekDocuments" enabled to `ClientCapabilities.experimental` and the client should handle the `PeekDocumentsRequest` and show the expansions in a "peeked" editor window.

PR to support the above capability in the "Swift for VS Code" Extension: swiftlang/vscode-swift#945
The "Swift for VS Code" extension cannot send the client capability, so it instead passes the same through `initializationOptions` in the `InitializeRequest`.

For editors which doesn't support this capability, `sourcekit-lsp` sends a `ShowDocumentRequest`.
The `ShowDocumentRequest` is updated to show all the macro expansions in a single generated file. Moreover, its folder structure is updated to use hex string of MD5 hash of concatenation of buffer names of expansions.

Fixes swiftlang/vscode-swift#564
Fixes swiftlang#1498 ( rdar://130207754 )
@ahoppen ahoppen closed this as completed in 0221475 Jul 3, 2024
lokesh-tr added a commit to lokesh-tr/sourcekit-lsp that referenced this issue Jul 4, 2024
-------------------------------------------------------------------------------

This implements an LSP Extension `PeekDocumentsRequest` to let `ExpandMacroCommand` to open the macro expansions in a "peeked" editor window.
For this to work, the client has to pass "workspace/peekDocuments" enabled to `ClientCapabilities.experimental` and the client should handle the `PeekDocumentsRequest` and show the expansions in a "peeked" editor window.

PR to support the above capability in the "Swift for VS Code" Extension: swiftlang/vscode-swift#945
The "Swift for VS Code" extension cannot send the client capability, so it instead passes the same through `initializationOptions` in the `InitializeRequest`.

For editors which doesn't support this capability, `sourcekit-lsp` sends a `ShowDocumentRequest`.
The `ShowDocumentRequest` is updated to show all the macro expansions in a single generated file. Moreover, its folder structure is updated to use hex string of MD5 hash of concatenation of buffer names of expansions.

Fixes swiftlang/vscode-swift#564
Fixes swiftlang#1498 ( rdar://130207754 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant