mirror of
https://github.com/prabirshrestha/vim-lsp.git
synced 2025-12-14 20:35:59 +01:00
select preferred action by default in quickpick (#1126)
spec: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
This commit is contained in:
@@ -472,6 +472,7 @@ function! lsp#default_get_supported_capabilities(server_info) abort
|
||||
\ 'valueSet': ['', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source', 'source.organizeImports'],
|
||||
\ }
|
||||
\ },
|
||||
\ 'isPreferredSupport': v:true,
|
||||
\ 'disabledSupport': v:true,
|
||||
\ },
|
||||
\ 'codeLens': {
|
||||
|
||||
@@ -94,10 +94,15 @@ function! s:handle_code_action(ctx, server_name, command_id, sync, query, bufnr,
|
||||
endif
|
||||
|
||||
for l:code_action in l:code_actions
|
||||
call add(l:total_code_actions, {
|
||||
\ 'server_name': l:server_name,
|
||||
\ 'code_action': l:code_action,
|
||||
\})
|
||||
let l:item = {
|
||||
\ 'server_name': l:server_name,
|
||||
\ 'code_action': l:code_action,
|
||||
\ }
|
||||
if get(l:code_action, 'isPreferred', v:false)
|
||||
let l:total_code_actions = [l:item] + l:total_code_actions
|
||||
else
|
||||
call add(l:total_code_actions, l:item)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
|
||||
Reference in New Issue
Block a user