mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
![]() ## Summary This PR should help in https://github.com/astral-sh/ruff-vscode/issues/676. There are two issues that this is trying to fix all related to the way shutdown should happen as per the protocol: 1. After the server handled the [shutdown request](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#shutdown) and while waiting for the exit notification: > If a server receives requests after a shutdown request those requests should error with `InvalidRequest`. But, we raised an error and exited. This PR fixes it by entering a loop which responds to any request during this period with `InvalidRequest` 2. If the server received an [exit notification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#exit) but the shutdown request was never received, the server handled that by logging and exiting with success but as per the spec: > The server should exit with success code 0 if the shutdown request has been received before; otherwise with error code 1. So, this PR fixes that as well by raising an error in this case. ## Test Plan I'm not sure how to go about testing this without using a mock server. |
||
---|---|---|
.. | ||
assets | ||
docs | ||
resources/test/fixtures | ||
src | ||
tests | ||
Cargo.toml | ||
CONTRIBUTING.md | ||
README.md |
The Ruff Language Server
ruff server
is a language server that powers Ruff's editor integrations.
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 construct 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.
Refer to the documentation for more information on how to set up the language server with your editor and configure it to your liking.
Contributing
Contributions are welcome and highly appreciated. To get started, check out the contributing guidelines.
You can also join us on Discord.