My nvim configuration
| 1 | ---@brief |
| 2 | --- |
| 3 | --- https://github.com/astral-sh/ruff |
| 4 | --- |
| 5 | --- A Language Server Protocol implementation for Ruff, an extremely fast Python linter and code formatter, written in Rust. It can be installed via `pip`. |
| 6 | --- |
| 7 | --- ```sh |
| 8 | --- pip install ruff |
| 9 | --- ``` |
| 10 | --- |
| 11 | --- **Available in Ruff `v0.4.5` in beta and stabilized in Ruff `v0.5.3`.** |
| 12 | --- |
| 13 | --- This is the new built-in language server written in Rust. It supports the same feature set as `ruff-lsp`, but with superior performance and no installation required. Note that the `ruff-lsp` server will continue to be maintained until further notice. |
| 14 | --- |
| 15 | --- Server settings can be provided via: |
| 16 | --- |
| 17 | --- ```lua |
| 18 | --- vim.lsp.config('ruff', { |
| 19 | --- init_options = { |
| 20 | --- settings = { |
| 21 | --- -- Server settings should go here |
| 22 | --- } |
| 23 | --- } |
| 24 | --- }) |
| 25 | --- ``` |
| 26 | --- |
| 27 | --- Refer to the [documentation](https://docs.astral.sh/ruff/editors/) for more details. |
| 28 | |
| 29 | ---@type vim.lsp.Config |
| 30 | return { |
| 31 | cmd = { 'ruff', 'server' }, |
| 32 | filetypes = { 'python' }, |
| 33 | root_markers = { 'pyproject.toml', 'ruff.toml', '.ruff.toml', '.git' }, |
| 34 | on_attach = function(client) |
| 35 | client.server_capabilities.diagnosticProvider = nil |
| 36 | end, |
| 37 | settings = {}, |
| 38 | } |