Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Notebook Format Cell//Notebook not working with ruff-lsp #490

@jamesvrt

Description

@jamesvrt
  • A minimal code snippet that reproduces the bug.

Create test.ipynb, create a cell with

from abc import (a, b, c
)

Perform Format Select/Cell/Document/Notebook via ctrl+shift+P, the right click menu or the keyboard shortcuts.

No changes observed in the cell.

Ruff output:

2024-09-04 11:28:50.174 [info] Using interpreter executable: /home/jamesvrt/miniconda3/envs/test/bin/ruff
2024-09-04 11:28:50.174 [info] Found ruff 0.6.4 at /home/jamesvrt/miniconda3/envs/test/bin/ruff
2024-09-04 11:28:50.174 [info] Running Ruff with: /home/jamesvrt/miniconda3/envs/test/bin/ruff ['format', '--force-exclude', '--quiet', '--stdin-filename', '/home/jamesvrt/test/test.ipynb', '--config', 'line-length=120']

Performing ruff format test.ipynb on the CLI works as expected.

Including "ruff.nativeServer": "on" in settings.json resolves the issue.

  • The current Ruff and VS Code settings (any relevant sections from your pyproject.toml and settings.json).

No ruff.toml or pyproject.toml

settings.json includes:

    "[python]": {
        "editor.defaultFormatter": "charliermarsh.ruff",
    },
    "ruff.format.args": ["--config", "line-length=120"],
    "notebook.defaultFormatter": "charliermarsh.ruff",
  • The current Ruff and VS Code extension versions (ruff --version).

ruff 0.6.3
ruff vscode extension 2024.42.0

  • A description of your environment (e.g., operating system, Python version, etc.).

Ubuntu 22.04
VSCode 1.92.2
Python 3.10.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions