@@ -91,6 +91,13 @@ function! s:handle_code_action(server_name, command_id, sync, query, data) abort
91
91
endif
92
92
endfunction
93
93
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
+
94
101
function ! s: handle_one_code_action (server_name, sync , command_or_code_action) abort
95
102
" has WorkspaceEdit.
96
103
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
101
108
call lsp#send_request (a: server_name , {
102
109
\ ' method' : ' workspace/executeCommand' ,
103
110
\ ' 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 ]),
105
113
\ })
106
114
107
115
" has Command.
108
116
elseif has_key (a: command_or_code_action , ' command' ) && type (a: command_or_code_action [' command' ]) == type ({})
109
117
call lsp#send_request (a: server_name , {
110
118
\ ' method' : ' workspace/executeCommand' ,
111
119
\ ' 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 ]),
113
122
\ })
114
123
endif
115
124
endfunction
0 commit comments