You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ruff (a linting/formatting extension for Python) has been having an issue involving notebook documents not being formatted on save, even with the right configuration. After investigating, we determined that the issue was that VS Code was not sending a code action request to the LSP on save, which doesn't seem like the right behavior.
To reproduce, you'll first need to install the Ruff extension.
Then, with the Ruff extension enabled, create or open a Jupyter notebook file that has unorganized imports. A simple example would be to have a single code cell that looks like the following:
importstringimportfunctools
Then, manually save the notebook (Ctrl/Cmd+S). The imports are neither re-organized nor are they removed, which they should be. This works if you put it in a normal Python file - this only seems to happen with a Jupyter Notebook.
It seems that VS Code isn't sending any code actions during a manual save on a Jupyter Notebook, unlike normal files, where it does.
VS Code version: Code 1.90.1 (Universal) (611f9bf, 2024-06-11T21:02:41.372Z)
OS version: Darwin arm64 23.5.0
Modes:
Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.90.2. Please try upgrading to the latest version and checking whether this issue remains.
FWIW, I do get an action to occur with the above settings but it formats the cell into nonsense, rather than correctly sorting imports (currently using version 1.91.1)
Type: Bug
Ruff (a linting/formatting extension for Python) has been having an issue involving notebook documents not being formatted on save, even with the right configuration. After investigating, we determined that the issue was that VS Code was not sending a code action request to the LSP on save, which doesn't seem like the right behavior.
To reproduce, you'll first need to install the Ruff extension.
Next, add this to your
settings.json
:Then, with the Ruff extension enabled, create or open a Jupyter notebook file that has unorganized imports. A simple example would be to have a single code cell that looks like the following:
Then, manually save the notebook (
Ctrl/Cmd+S
). The imports are neither re-organized nor are they removed, which they should be. This works if you put it in a normal Python file - this only seems to happen with a Jupyter Notebook.It seems that VS Code isn't sending any code actions during a manual save on a Jupyter Notebook, unlike normal files, where it does.
VS Code version: Code 1.90.1 (Universal) (611f9bf, 2024-06-11T21:02:41.372Z)
OS version: Darwin arm64 23.5.0
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
Extensions (17)
(1 theme extensions excluded)
A/B Experiments
The text was updated successfully, but these errors were encountered: