Migrating from ruff-lsp
To provide some context, ruff-lsp
is the LSP implementation for Ruff to power the editor
integrations which is written in Python and is a separate package from Ruff itself. The native
server is the LSP implementation which is written in Rust and is available under the ruff server
command. This guide is intended to help users migrate from
ruff-lsp
to the native server.
Note
The native server was first introduced in Ruff version 0.3.5
. It was marked as beta in version
0.4.5
and officially stabilized in version 0.5.3
. It is recommended to use the latest
version of Ruff to ensure the best experience.
The migration process involves any or all of the following:
- Migrate deprecated settings to the new settings
- Remove settings that are no longer supported
- Update the
ruff
version
Unsupported Settings
The following ruff-lsp
settings are not supported by ruff server
:
lint.run
: This setting is no longer relevant for the native language server, which runs on every keystroke by default.lint.args
,format.args
: These settings have been replaced by more granular settings inruff server
likelint.select
,format.preview
, etc. along with the ability to provide a default configuration file usingconfiguration
.
The following settings are not accepted by the language server but are still used by the VS Code extension. Refer to their respective documentation for more information on how it's being used by the extension:
Removed Settings
Additionally, the following settings are not supported by the native server, they should be removed:
ignoreStandardLibrary
showNotifications
New Settings
ruff server
introduces several new settings that ruff-lsp
does not have. These are, as follows:
configuration
configurationPreference
exclude
format.preview
lineLength
lint.select
lint.extendSelect
lint.ignore
lint.preview
Several of these new settings are replacements for the now-unsupported format.args
and lint.args
. For example, if
you've been passing --select=<RULES>
to lint.args
, you can migrate to the new server by using lint.select
with a
value of ["<RULES>"]
.
Examples
Let's say you have these settings in VS Code:
After enabling the native server, you can migrate your settings like so:
{
"ruff.configuration": "~/.config/custom_ruff_config.toml",
"ruff.lineLength": 80,
"ruff.lint.select": ["E", "F"]
}
Similarly, let's say you have these settings in Helix:
[language-server.ruff.config.lint]
args = "--select=E,F --line-length 80 --config ~/.config/custom_ruff_config.toml"
These can be migrated like so: