diff options
author | Jesse <github@jessebakker.com> | 2020-11-01 18:11:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-01 18:11:32 +0100 |
commit | 720d442d19de4908e22ecf18223358bb7bbb0753 (patch) | |
tree | 4d22849bc2ddcf9db7eba4dac34eea09a5812b80 /runtime/lua/vim/lsp/protocol.lua | |
parent | ba1ff710782960a1be6ebe7342bb26a556f300fa (diff) | |
download | rneovim-720d442d19de4908e22ecf18223358bb7bbb0753.tar.gz rneovim-720d442d19de4908e22ecf18223358bb7bbb0753.tar.bz2 rneovim-720d442d19de4908e22ecf18223358bb7bbb0753.zip |
lsp: complete support for `CodeActionKind`s to capabilities (#13180)
We support applying all kinds in the spec equivalently and some servers (including dartls) won't send code actions if support for the relevant kinds is not explicitly stated in the client capabilities. Therefore, this PR makes that support explicit.
Also, as we support all CodeActionKinds, we should also mark the server as supporting code actions when it specifies code action kinds. This is also done in this PR.
Diffstat (limited to 'runtime/lua/vim/lsp/protocol.lua')
-rw-r--r-- | runtime/lua/vim/lsp/protocol.lua | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 36c9822e23..70862320c5 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -632,7 +632,7 @@ function protocol.make_client_capabilities() codeActionLiteralSupport = { codeActionKind = { - valueSet = {}; + valueSet = vim.tbl_values(protocol.CodeActionKind); }; }; }; @@ -943,11 +943,9 @@ function protocol.resolve_capabilities(server_capabilities) if server_capabilities.codeActionProvider == nil then general_properties.code_action = false - elseif type(server_capabilities.codeActionProvider) == 'boolean' then + elseif type(server_capabilities.codeActionProvider) == 'boolean' + or type(server_capabilities.codeActionProvider) == 'table' then general_properties.code_action = server_capabilities.codeActionProvider - elseif type(server_capabilities.codeActionProvider) == 'table' then - -- TODO(ashkan) support CodeActionKind - general_properties.code_action = false else error("The server sent invalid codeActionProvider") end |