Skip to content

Commit 4d4a908

Browse files
authored
1 parent 882376c commit 4d4a908

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

autoload/lsp.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ function! lsp#default_get_supported_capabilities(server_info) abort
472472
\ 'valueSet': ['', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source', 'source.organizeImports'],
473473
\ }
474474
\ },
475+
\ 'isPreferredSupport': v:true,
475476
\ 'disabledSupport': v:true,
476477
\ },
477478
\ 'codeLens': {

autoload/lsp/ui/vim/code_action.vim

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,15 @@ function! s:handle_code_action(ctx, server_name, command_id, sync, query, bufnr,
9494
endif
9595

9696
for l:code_action in l:code_actions
97-
call add(l:total_code_actions, {
98-
\ 'server_name': l:server_name,
99-
\ 'code_action': l:code_action,
100-
\})
97+
let l:item = {
98+
\ 'server_name': l:server_name,
99+
\ 'code_action': l:code_action,
100+
\ }
101+
if get(l:code_action, 'isPreferred', v:false)
102+
let l:total_code_actions = [l:item] + l:total_code_actions
103+
else
104+
call add(l:total_code_actions, l:item)
105+
endif
101106
endfor
102107
endfor
103108

0 commit comments

Comments
 (0)