[WIP/RFC] Allow code actions containing an edit and a command #1760
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1692
WIP, because still no response to microsoft/language-server-protocol#2015
But also tests.
Previously, we could not handle two cases:
This pull request currently aims at the former. Manually tested with the Dart server and everything worked fine.
Design
LSP
Assuming we get a code action with an edit and a command, the client should do the following:
didChange
notification.Step 3 is still pretty much dark magic.
ycmd
Current implementation, when faced with "mixed" code actions does:
keep_going
toTrue
.keep_going
set, after applying, it should ask ycmd for the next FixIt in the chain.4.1. I couldn't figure out a better way than to introduce a new route -
/next_fixit
/next_fixit
request, ycmd will execute the previously stored command (step 2).Obviously,
/next_fixit
andkeep_going
are prone to bikeshedding.I'm more concerned whether the whole idea about storing the command for later is a good approach.
It works... but only because
:YcmCompleter FixIt
is synchronous. If it weren't, there'd be room for error.This change is