autozimu / LanguageClient-neovim

Language Server Protocol (LSP) support for vim and neovim.
MIT License
3.55k stars 272 forks source link

Add function to execute code action by kind #1160

Closed martskins closed 3 years ago

martskins commented 3 years ago

This PR adds a function to execute code actions by kind. The function can be mapped to commands for a better user experience (I may consider adding commands for the common actions later on). For example, a command could look like this: command! OrganizeImports call LanguageClient#executeCodeAction('source.organizeImports')

And called with :OrganizeImports.

Mapping a key binding or calling the function itself I suppose is self-explanatory from the above example.

Note that this PR only works for code actions, not commands, as they can't be filtered by kind alone, and commands can already be executed via LanguageClient#workspace_executeCommand

Closes #1158