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
The notebook.codeActionsOnSave
setting should work with code actions, not commands
#180839
Comments
I believe the longer term goal was to migrate to code actions. Until that happens though, can we either:
|
I agree there's a discrepancy between
Yep, I'll go ahead and change this to a more generic example in the settings, and I'll go ahead and mark the setting more obviously experimental as well. |
After a bit of a deeper dig, it looks like there was a misunderstanding surrounding the behavior of The setting will be fully removed for now, until there's more complete Notebook CodeAction support. |
@Yoyokrazy I think this is done, right? |
Correct, closing since the behavior has been overhauled to work properly with CodeActions. |
Testing #180765
I noticed that there's a difference in functionality between
notebook.codeActionsOnSave
andeditor.codeActionsOnSave
. While the former works with commands, the latter works with code actions. This is a conceptual mismatch that we should reconsider, as it makes notebook code actions incompatible with editor code actions. Currently, notebooks already support "normal" code actions for their cell editors (examples can be found in GHINB), and it would be best to maintain consistency with that.Real code actions provide structured data such as workspace edits that can be previewed, selectively applied, and configured. While there is a deprecated way for a code action provider to return just commands, it's still better than only returning command IDs, as the former can be associated with an extension and computed dynamically.
Commands, on the other hand, are more general and don't have the same benefits as code actions. There's no guarantee that a command running while saving won't change the notebook at the same time, and a command can't truly participate in save by adding pre-save edits.
Ideally, we should revisit this issue, but at a minimum, we should not use the name "codeActions" for this feature and clearly mark the setting as experimental (via its name). Additionally, we should stop recommending
notebook.format
as a possible on-save command, as there's a proper way to handle this (notebook.formatOnSave.enabled
).The text was updated successfully, but these errors were encountered: