Skip to content

Commit

Permalink
Handle action edits before commands
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
natebosch committed Aug 4, 2023
1 parent 6e098b3 commit d504cb5
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 d504cb5

Please sign in to comment.