feat(python): add ruff language server for lint, format and organize imports (#859)

In projects configured for Ruff (ruff.toml, .ruff.toml, or pyproject.toml with a [tool.ruff] table), ruff server runs next to basedpyright as a managed pip tool: its lint diagnostics, Reformat Code / format on save, Optimize Imports and Code Cleanup's fix-all. It is listed after the type checkers, so hover, navigation and rename stay with them; projects without a Ruff configuration never start or install it. Root markers accept file#table to require a TOML table, and a hand-defined server named ruff now only overrides how the built-in one launches. Verified with the real-servers end-to-end test against ruff and basedpyright.

Co-authored-by: andreabasile <[email protected]>
Цей коміт міститься в:
Andrea Basileтаandreabasile authored and GitHub committed 2026-11-02 20:27:24 +08:00
1 джерело e584f044d7
коміт a623e5d385
10 files changed
+184 -12

No files matched your search

+10
Переглянути файл
@@ -40,6 +40,16 @@ args = ["server"]
root-markers = ["ty.toml", "pyproject.toml", "setup.py", "setup.cfg", "requirements.txt", "Pipfile"]
install-hint = "uv tool install ty (or: pip install ty)"
# Lint, format, organize imports and fix all next to the type checker, in
# projects configured for Ruff (formatting is Ruff's alone: basedpyright has none).
[[language-servers]]
name = "ruff"
command = "ruff"
args = ["server"]
root-markers = ["ruff.toml", ".ruff.toml", "pyproject.toml#tool.ruff"]
require-root-marker = true
install-hint = "pip install ruff (or: uv tool install ruff)"
[debugger]
adapter = "debugpy"
command = "python3"