![]() ## Summary Closes #10985. The server now supports a custom TOML configuration file as a client setting. The setting must be an absolute path to a file. If the file is called `pyproject.toml`, the server will attempt to parse it as a pyproject file - otherwise, it will attempt to parse it as a `ruff.toml` file, even if the file has a name besides `ruff.toml`. If an option is set in both the custom TOML configuration file and in the client settings directly, the latter will be used. ## Test Plan 1. Create a `ruff.toml` file outside of the workspace you are testing. Set an option that is different from the one in the configuration for your test workspace. 2. Set the path to the configuration in NeoVim: ```lua require('lspconfig').ruff.setup { init_options = { settings = { configuration = "absolute/path/to/your/configuration" } } } ``` 3. Confirm that the option in the configuration file is used, regardless of what the option is set to in the workspace configuration. 4. Add the same option, with a different value, to the NeoVim configuration directly. For example: ```lua require('lspconfig').ruff.setup { init_options = { settings = { configuration = "absolute/path/to/your/configuration", lint = { select = [] } } } } ``` 5. Confirm that the option set in client settings is used, regardless of the value in either the custom configuration file or in the workspace configuration. |
||
---|---|---|
.. | ||
docs/setup | ||
resources/test/fixtures | ||
src | ||
tests | ||
Cargo.toml | ||
CONTRIBUTING.md | ||
README.md |
The Ruff Language Server
Welcome! ruff server
is a language server that powers editor integrations with Ruff. The job of the language server is to
listen for requests from the client, (in this case, the code editor of your choice) and call into Ruff's linter and formatter
crates to create real-time diagnostics or formatted code, which is then sent back to the client. It also tracks configuration
files in your editor's workspace, and will refresh its in-memory configuration whenever those files are modified.
Setup
We have specific setup instructions depending on your editor. If you don't see your editor on this list and would like a setup guide, please open an issue.
- Visual Studio Code: Install the Ruff extension from the VS Code Marketplace. The language server used by the extension will be, by default, the one in your actively-installed
ruff
binary. If you don't haveruff
installed and haven't provided a path to the extension, it comes with a bundledruff
version that it will use instead. Since the new Ruff language server has not yet been stabilized, you will need to use the pre-release version of the extension and enable theExperimental Server
setting. - Neovim: See the Neovim setup guide.
Contributing
If you're interested in contributing to ruff server
- well, first of all, thank you! Second of all, you might find the contribution guide to be a useful resource. Finally, don't hesitate to reach out on our Discord if you have questions.