helix icon indicating copy to clipboard operation
helix copied to clipboard

Add LSP workspace command picker

Open MDeiml opened this issue 3 years ago • 5 comments

LSPs can communicate that they can run additional commands via the executeCommandProvider. This adds a picker for these commands. To use it you need to map it to e.g. <space>W.

MDeiml avatar Jul 21 '22 22:07 MDeiml

For a default keybind for this, I think <space>c could make sense.

We should find a default keybind for this before merging - it looks like there's a bug with the command palette where it can't create any new pickers (for example running the jumplist picker command from the command palette)

the-mikedavis avatar Oct 28 '22 01:10 the-mikedavis

I agree with <space>c as a mnemonic for "command". I'll add the keybinding. But ultimately I'm not 100% sure this should have a default keybinding, as only very few LSP actually use this, so most users won't need it. I guess it can't hurt though.

MDeiml avatar Oct 28 '22 08:10 MDeiml

I think a typable command would be a better fit here. It's not as widely used as the other LSP features like goto-*, and I would consider the space layer of keybinds to be precious real estate that we will run out off too fast if we're not careful. Making it a typable commands also makes it easy to remap in the config.

sudormrfbin avatar Oct 28 '22 21:10 sudormrfbin

It would be cool if the command could accept the command as an optional argument without opening the picker.

dariooddenino avatar Oct 31 '22 09:10 dariooddenino

As suggested I added the command name as an optional argument. This should make it really useful for adding a custom keybinding to run a specific command.

MDeiml avatar Nov 01 '22 15:11 MDeiml

I just tried this out using the typescript-language-server and it looks like some workspace actions are NOOP. For instance, running Organize Imports does nothing in Helix while it does correctly sort the imports when I run the same command in Sublime Text or VSCode.

hovsater avatar Nov 09 '22 12:11 hovsater

I just tried this out using the typescript-language-server and it looks like some workspace actions are NOOP. For instance, running Organize Imports does nothing in Helix while it does correctly sort the imports when I run the same command in Sublime Text or VSCode.

Maybe this LSP server modifies the file outside of the editor. What happens when you reload the file in helix ?

lazytanuki avatar Nov 09 '22 13:11 lazytanuki

I just tried this out using the typescript-language-server and it looks like some workspace actions are NOOP. For instance, running Organize Imports does nothing in Helix while it does correctly sort the imports when I run the same command in Sublime Text or VSCode.

Maybe this LSP server modifies the file outside of the editor. What happens when you reload the file in helix ?

Yep. That seem to be case. Reloading the file manually works. Not ideal. But it works.

hovsater avatar Nov 09 '22 14:11 hovsater