![]() ## Summary This PR removes the `ImportMap` implementation and all its routing through ruff. The import map was added in https://github.com/astral-sh/ruff/pull/3243 but we then never ended up using it to do cross file analysis. We are now working on adding multifile analysis to ruff, and revisit import resolution as part of it. ``` hyperfine --warmup 10 --runs 20 --setup "./target/release/ruff clean" \ "./target/release/ruff check crates/ruff_linter/resources/test/cpython -e -s --extend-select=I" \ "./target/release/ruff-import check crates/ruff_linter/resources/test/cpython -e -s --extend-select=I" Benchmark 1: ./target/release/ruff check crates/ruff_linter/resources/test/cpython -e -s --extend-select=I Time (mean ± σ): 37.6 ms ± 0.9 ms [User: 52.2 ms, System: 63.7 ms] Range (min … max): 35.8 ms … 39.8 ms 20 runs Benchmark 2: ./target/release/ruff-import check crates/ruff_linter/resources/test/cpython -e -s --extend-select=I Time (mean ± σ): 36.0 ms ± 0.7 ms [User: 50.3 ms, System: 58.4 ms] Range (min … max): 34.5 ms … 37.6 ms 20 runs Summary ./target/release/ruff-import check crates/ruff_linter/resources/test/cpython -e -s --extend-select=I ran 1.04 ± 0.03 times faster than ./target/release/ruff check crates/ruff_linter/resources/test/cpython -e -s --extend-select=I ``` I suspect that the performance improvement should even be more significant for users that otherwise don't have any diagnostics. ``` hyperfine --warmup 10 --runs 20 --setup "cd ../ecosystem/airflow && ../../ruff/target/release/ruff clean" \ "./target/release/ruff check ../ecosystem/airflow -e -s --extend-select=I" \ "./target/release/ruff-import check ../ecosystem/airflow -e -s --extend-select=I" Benchmark 1: ./target/release/ruff check ../ecosystem/airflow -e -s --extend-select=I Time (mean ± σ): 53.7 ms ± 1.8 ms [User: 68.4 ms, System: 63.0 ms] Range (min … max): 51.1 ms … 58.7 ms 20 runs Benchmark 2: ./target/release/ruff-import check ../ecosystem/airflow -e -s --extend-select=I Time (mean ± σ): 50.8 ms ± 1.4 ms [User: 50.7 ms, System: 60.9 ms] Range (min … max): 48.5 ms … 55.3 ms 20 runs Summary ./target/release/ruff-import check ../ecosystem/airflow -e -s --extend-select=I ran 1.06 ± 0.05 times faster than ./target/release/ruff check ../ecosystem/airflow -e -s --extend-select=I ``` ## Test Plan `cargo test` |
||
---|---|---|
.. | ||
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.