LSP: support windows/showDocument #58099
mgood
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Body
What are you proposing?
The LSP implementation is missing support for the window/showDocument command.
This was previously requested in issue #17931 but closed due to cleanup.
Why does this matter?
LSPs use this feature to ask the editor to open a location. It can be used to navigate the editor to a local file, as well as launching an external one like opening the browser to a location. It appears to be mostly used with a Code Lens as a way for the LSP to open a location for the user.
Are there any examples or context?
The existing issue #17931 documents a few existing LSP implementations that depend on this command for various features like opening a URL to show documentation for a token.
For example, gopls provides a "browse documentation for func" code lens which uses it to open a browser to the documentation.
It also appears that based on #53123 this command is supported in the LSP implementation for agent integrations, but not for LSPs that run in the editor.
I'm working on an LSP myself and was planning to use this for a Code Lens to open a query in an external browser UI.
Possible approach
There's an implementation from
copilot.rsfor LSP-based agents to invoke this:server .on_request::<lsp::request::ShowDocument, _, _>(move |params, cx| { if params.external.unwrap_or(false) { let url = params.uri.to_string(); cx.update(|cx| cx.open_url(&url)); } async move { Ok(lsp::ShowDocumentResult { success: true }) } }) .detach();Beta Was this translation helpful? Give feedback.
All reactions