zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
47.43k stars 2.76k forks source link

Support executing LSP commands #13756

Open Feel-ix-343 opened 2 months ago

Feel-ix-343 commented 2 months ago

Check for existing issues

Describe the feature

Some language servers use the LSP command interface to provide some more custom functionality.

Popular editors such as vscode and neovim support this.

If applicable, add mockups / screenshots to help present your vision of the feature

I find how helix implements this (though incomplete) to be pretty great UX. Here is a gif of me using LSP commands with my language server markdown-oxide to open some daily notes.

helix-command

rcjsuen commented 1 month ago
interface ClientCapabilities {
    workspace?: {
        /**
         * The client supports applying batch edits
         * to the workspace by supporting the request
         * 'workspace/applyEdit'
         */
        applyEdit?: boolean;
    }
}

From what I can tell here, applyEdit is not currently declared as a capability. Some language servers will "execute" the requested commands by actually delegating back to the client to apply a WorkspaceEdit (by sending a workspace/applyEdit request to the client) so Zed should take a look at the workspace/applyEdit request also when looking at workspace/executeCommand.

kelveden commented 3 weeks ago

As a reference, here is the specification for execute command.

From a selfish perspective, I'd love to see this feature added to enable us Clojure engineers to leverage some of the s-expression specific "power tools" from clojure-lsp - as you can see from that matrix, there are a bunch of those commands that aren't exposed as code actions.

AlbertMarashi commented 2 weeks ago

Need this to close some SvelteKit missing type issues