Skip to content

Commit 55e8805

Browse files
authored
executeCommand do not handle response (#732)
1 parent b2b3199 commit 55e8805

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

autoload/lsp/ui/vim/code_action.vim

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ function! s:handle_code_action(server_name, command_id, sync, query, data) abort
9191
endif
9292
endfunction
9393

94+
function! s:handle_executeCommand(server_name, command_or_code_action, data) abort
95+
if lsp#client#is_error(a:data['response'])
96+
call lsp#utils#error('Failed to '. a:command_or_code_action['command'] . ' for ' . a:server_name . ': ' . lsp#client#error_message(a:data['response']))
97+
return
98+
endif
99+
endfunction
100+
94101
function! s:handle_one_code_action(server_name, sync, command_or_code_action) abort
95102
" has WorkspaceEdit.
96103
if has_key(a:command_or_code_action, 'edit')
@@ -101,15 +108,17 @@ function! s:handle_one_code_action(server_name, sync, command_or_code_action) ab
101108
call lsp#send_request(a:server_name, {
102109
\ 'method': 'workspace/executeCommand',
103110
\ 'params': a:command_or_code_action,
104-
\ 'sync': a:sync
111+
\ 'sync': a:sync,
112+
\ 'on_notification': function('s:handle_executeCommand', [a:server_name, a:command_or_code_action]),
105113
\ })
106114

107115
" has Command.
108116
elseif has_key(a:command_or_code_action, 'command') && type(a:command_or_code_action['command']) == type({})
109117
call lsp#send_request(a:server_name, {
110118
\ 'method': 'workspace/executeCommand',
111119
\ 'params': a:command_or_code_action['command'],
112-
\ 'sync': a:sync
120+
\ 'sync': a:sync,
121+
\ 'on_notification': function('s:handle_executeCommand', [a:server_name, a:command_or_code_action]),
113122
\ })
114123
endif
115124
endfunction

0 commit comments

Comments
 (0)