# textDocument/codeAction can return either Command[] or CodeAction[].
# If it is a CodeAction, it can have either an edit, a command or both.
# Edits should be executed first.
- if selAction->has_key('edit') || selAction->has_key('command')
+ # Both Command and CodeAction interfaces has 'command' member
+ # so we should check 'command' type - for Command it will be 'string'
+ if selAction->has_key('edit')
+ || (selAction->has_key('command') && selAction.command->type() == v:t_dict)
+ # selAction is a CodeAction instance, apply edit and command
if selAction->has_key('edit')
# apply edit first
textedit.ApplyWorkspaceEdit(selAction.edit)
endif
if selAction->has_key('command')
- lspserver.executeCommand(selAction)
+ lspserver.executeCommand(selAction.command)
endif
else
+ # selAction is a Command instance, apply it directly
lspserver.executeCommand(selAction)
endif
enddef