-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support notebook-scoped VS Code actions (#351)
## Summary VS Code added support for `notebook.*`-scoped code actions (https://code.visualstudio.com/api/references/vscode-api#CodeActionKind), which are intended to run over the entire document, unlike the actions that omit the `notebook.` namespace, which instead only operate over individual cells. The latter are problematic for actions that need global context, e.g., our unused imports rules. When the `notebook.*` actions are triggered, VS Code sends down the first cell (see: microsoft/vscode#193120) as the URI. This PR adds handlers for the actions and logic to use the notebook, rather than the cell. Closes #320. ## Test Plan Used the following `settings.json`: ```json { "[python]": { "editor.defaultFormatter": "charliermarsh.ruff", "editor.codeActionsOnSave": { "source.organizeImports.ruff": true } }, "notebook.codeActionsOnSave": { "notebook.source.fixAll": true } } ``` Verified that imports used across cells were not removed (whereas `"source.fixAll": true` _did_ cause imports to be removed).
- Loading branch information
1 parent
44b52ad
commit 03fbbdd
Showing
1 changed file
with
56 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters