Skip to content

Commit 9153561

Browse files
clktmrprabirshrestha
authored andcommitted
Check for codeActionKinds in codeActionProvider (#382)
This was tested with ccls, which will return CodeActionOptions instead of a boolean in codeActionProvider. According to spec this is an invalid response by ccls, because as a client we didn't signal codeActionLiteralSupport. But I think it can be safely assumed that the server provides code actions when he returns a non empty list of codeActionKinds.
1 parent 01a5a31 commit 9153561

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

autoload/lsp/capabilities.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ function! lsp#capabilities#has_implementation_provider(server_name) abort
5454
endfunction
5555

5656
function! lsp#capabilities#has_code_action_provider(server_name) abort
57+
let l:capabilities = lsp#get_server_capabilities(a:server_name)
58+
if !empty(l:capabilities) && has_key(l:capabilities, 'codeActionProvider')
59+
if type(l:capabilities['codeActionProvider']) == type({})
60+
if has_key(l:capabilities['codeActionProvider'], 'codeActionKinds') && type(l:capabilities['codeActionProvider']['codeActionKinds']) == type([])
61+
return len(l:capabilities['codeActionProvider']['codeActionKinds']) != 0
62+
endif
63+
endif
64+
endif
5765
return s:has_bool_provider(a:server_name, 'codeActionProvider')
5866
endfunction
5967

0 commit comments

Comments
 (0)