-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Summary
The Ruff language server uses file extension checking (.ipynb) to identify notebook documents, while ty server relies solely on the LSP notification type (notebookDocument/didOpen vs textDocument/didOpen). This requires clients to apply workarounds when working with notebook-like files that don't have the .ipynb extension.
In https://github.com/astral-sh/ruff/blob/main/crates/ruff_server/src/session/index.rs#L130-L132, key_from_url determines document type by checking the file extension:
} else if Path::new(url.path())
.extension()
.is_some_and(|ext| ext.eq_ignore_ascii_case("ipynb"))Cell URIs are handled correctly (checked against notebook_cells map), but the notebook document itself requires the .ipynb extension.
In https://github.com/marimo-team/marimo, notebooks are .py files opened as notebook documents in a "managed" Ruff language server (that doesn't allow conflicts with .py text documents - see astral-sh/ruff-vscode#893). To make ruff server recognize these as notebooks, we need to transform notebook URIs to append .ipynb... but this can create other issues since the transformed path doesn't exist on disk.
This workaround is not needed for ty server since it doesn't check extensions. It would be nice to have the same (lack of) requirement and avoid special treatment of URIs.
Version
ruff 0.14.13