From d504cb5d743e2148ca23ece0555be916279d608e Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Fri, 4 Aug 2023 17:32:18 +0000 Subject: [PATCH] Handle action edits before commands The Dart analysis server sometimes sense actions with both 'command' and 'edit' fields. The command doesn't have any effect when triggered on the server and seems to be informational. Whenever there is an edit, assume it is sufficient for the action. --- autoload/lsc/edit.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/lsc/edit.vim b/autoload/lsc/edit.vim index d9ba0259..54dc7074 100644 --- a/autoload/lsc/edit.vim +++ b/autoload/lsc/edit.vim @@ -22,15 +22,15 @@ function! s:SelectAction(ActionFilter, result) abort endfunction function! s:ExecuteCommand(choice) abort - if has_key(a:choice, 'command') + if has_key(a:choice, 'edit') && type(a:choice.edit) == type({}) + call lsc#edit#apply(a:choice.edit) + elseif has_key(a:choice, 'command') let l:command = type(a:choice.command) == type('') ? \ a:choice : a:choice.command call lsc#server#userCall('workspace/executeCommand', \ {'command': l:command.command, \ 'arguments': l:command.arguments}, \ {_->0}) - elseif has_key(a:choice, 'edit') && type(a:choice.edit) == type({}) - call lsc#edit#apply(a:choice.edit) endif endfunction