-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a server that would produce both an edit and a command in a single CodeAction? #2002
Comments
Another question is: In the "mixed code action" case, do clients have to apply the edit, send didChange notification(s) and only then execute the command? |
Clangd doesn't currently use both an edit and a command, but a potential use case for this is discussed in the conversation starting at clangd/clangd#1367 (comment). |
If you have both a edit and a command, first the edit should be applied, including sending out change notifications and then the command should be applied. |
What is the purpose of this complex feature? What use cases is it for? |
|
To add to the above, clangd's use case is deferring the expensive computation of a text edit to after a completion item has been selected (so that the computation only has to be done for the selected proposal, not all offered proposals). |
The Dart LSP server sometimes does this when the edits are inlined (because they were already computed), so that the server knows that the action was invoked (for ex. if analytics are enabled, metrics on the number of times each action is used can be collected): {
"command": {
"arguments": [
{
"action": "dart.assist.add.typeAnnotation"
}
],
"command": "dart.logAction",
"title": "Log Action"
},
"diagnostics": [],
"edit": {
"documentChanges": [/*...*/]
},
"kind": "refactor.add.typeAnnotation",
"title": "Add type annotation"
} If you want to test with it, this can be triggered by having the code |
I am updating my client's code action support.
I am unsure how to implement code actions with mixed edit and command in them.
Having a server to test against would be very useful.
If there is such a server, knowing how to trigger this use case would also be appreciated.
The text was updated successfully, but these errors were encountered: