Skip to content

Commit

Permalink
Handle action edits before commands (#467)
Browse files Browse the repository at this point in the history
The Dart analysis server sometimes sends 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.
  • Loading branch information
natebosch committed Aug 4, 2023
1 parent 3ff12a0 commit 14203f0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions autoload/lsc/edit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 14203f0

Please sign in to comment.