diff options
author | Fredrik Ekre <ekrefredrik@gmail.com> | 2022-04-30 10:14:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-30 10:14:31 +0200 |
commit | df09e03cf74337675751c3240069a26aec75fa3b (patch) | |
tree | 063e2a54d2a82835587ea981ac2166bb1cb87212 /runtime/lua/vim/lsp/protocol.lua | |
parent | de2232878fb95bdb84f8219c7cf1d7f2c2828086 (diff) | |
download | rneovim-df09e03cf74337675751c3240069a26aec75fa3b.tar.gz rneovim-df09e03cf74337675751c3240069a26aec75fa3b.tar.bz2 rneovim-df09e03cf74337675751c3240069a26aec75fa3b.zip |
feat(lsp): options to filter and auto-apply code actions (#18221)
Implement two new options to vim.lsp.buf.code_action():
- filter (function): predicate taking an Action as input, and returning
a boolean.
- apply (boolean): when set to true, and there is just one remaining
action (after filtering), the action is applied without user query.
These options can, for example, be used to filter out, and automatically
apply, the action indicated by the server to be preferred:
vim.lsp.buf.code_action({
filter = function(action)
return action.isPreferred
end,
apply = true,
})
Fix #17514.
Diffstat (limited to 'runtime/lua/vim/lsp/protocol.lua')
-rw-r--r-- | runtime/lua/vim/lsp/protocol.lua | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 86c9e2fd58..2cd728ea36 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -645,6 +645,7 @@ function protocol.make_client_capabilities() end)(); }; }; + isPreferredSupport = true; dataSupport = true; resolveSupport = { properties = { 'edit', } |