-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
Support to resolve code actions #106410
Comments
Would |
Right now I would say only when selecting a code action. We have all information to render a list of code actions but for the future. Who knows... VS has a feature where focusing a code action already shows a hover with the diff of the changes... |
That sounds good. The one complication is that we currently use native context menus for code actions. I'll have to check to see if we can detect when the user changes the active item in a native context menu Related: I've wanted to switch to use UI for code actions for a long time but have never had the time to look into this |
Will we always call resolve even if |
No, I'd say only when needed, e.g when not having an edit or command. It's a little ambiguous because edit or command can be set... |
I am in favor of this. |
Work on this has started in #106856. I have implemented the following
|
@dbaeumer the proposal is now in master and ready to use |
A good proposal. I see the Java language server can benefit from the lazy resolve idea. Currently when editing a big Java file (e.g. 5k+ lines), it will cause the Java language server to take much CPU time to calculate the workspace edits for all code action proposals such as quickfix, refactoring, source action. For some resource-constrained machines, this affects the processing of other requests. In particular, it may cause the codeCompletion handler waiting for resources to run, and slow down code completion performance. @jrieken when it's ready in insider, i'd like to have a try to see how it goes. |
Thanks @mjbvz |
@jrieken thanks! |
This is now finalized |
@jrieken just to be sure. It is out of proposed state. Right ? |
Yeah - as final as it gets |
Great! |
yes. it is in current insiders and next stable |
thank you @jrieken. I tried the latest insider at 09-29, looks like the initialize request from vscode client doesn't carry the clientCapability for Below is the codeAction capability from LSP initialize params. It doesn't declare the codeAction/resolve support.
|
🤷 idk - that's LSP, not VS Code. Ping @dbaeumer for what version of the LSP client supporting this |
Todays API for code actions wants all actions to be returned fully resolved, e.g the
command
oredit
must be set. For some code action providers that's not easy and the usual "workaround" is to move the heavy lifting into the command (instead of using workspace edits). However, with commands it's harder to control the overall experience, like undo-stack or previewing changes.The proposed change below adds a
resolveCodeAction
function to code action provider which the editor would call before applying a code action.fyi @dbaeumer since this exists in LSP already
The text was updated successfully, but these errors were encountered: