ruff-lsp
ruff-lsp is a Language Server Protocol (LSP) implementation for Ruff, an extremely fast Python linter and code formatter. It enables Ruff to be integrated with any editor that supports the LSP, providing features like surfacing diagnostics and offering code actions to fix them. The library is currently at version 0.0.62, with releases often coinciding with updates to the underlying Ruff tool. However, ruff-lsp is officially deprecated in favor of Ruff's native Rust-based language server, `ruff server`.
Common errors
-
[lspconfig] Cannot access configuration for ruff. Ensure this server is listed in `server_configurations.md` or added as a custom server.
cause Your LSP client (e.g., nvim-lspconfig) cannot find or properly interpret the configuration for `ruff-lsp` or the native `ruff` language server. This can happen if the client is outdated or the configuration path is incorrect.fixUpdate your LSP client plugin (e.g., `nvim-lspconfig`). Ensure your editor's LSP configuration for `ruff` (or `ruff-lsp` if still using it) matches the recommended setup in Ruff's official editor integration documentation. Verify that `ruff` is installed and accessible in your environment. -
ruff-lsp doesn't start because of errors / Source actions not appearing in VS Code integration
cause General misconfiguration, missing dependencies (like Ruff itself), or conflicts with other extensions/LSP servers preventing `ruff-lsp` from initializing or providing features correctly.fixCheck your editor's LSP logs for detailed error messages. Ensure `ruff` and `ruff-lsp` are installed and accessible in the Python environment used by your editor. Disable other potentially conflicting Python linting/formatting extensions or LSP servers to isolate the issue. Confirm your editor's `ruff-lsp` settings (or Ruff extension settings for VS Code) are correct.
Warnings
- breaking ruff-lsp is officially deprecated and is being replaced by Ruff's native Rust-based language server (`ruff server`). It is recommended to migrate to `ruff server` for improved performance and ongoing support. ruff-lsp is expected to be archived with the release of Ruff 0.11.
- gotcha Configuration settings for ruff-lsp are not fully compatible with the native `ruff server`. Many settings have been renamed or replaced.
- gotcha When integrating ruff-lsp (or `ruff server`) into an editor, it may conflict with other installed Python Language Servers (e.g., Pyright, Pylsp) if not configured to defer specific capabilities.
Install
-
pip install ruff-lsp
Quickstart
# ruff-lsp is typically launched by an LSP-capable editor. # To run it manually (e.g., for testing or debugging): ruff-lsp