mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:49:50 +00:00
![]() ## Summary This PR updates the `ruff.printDebugInformation` command to return the info as string in the response. Currently, we send a `window/logMessage` request with the info but that has the disadvantage that it's not visible to the user directly. What `rust-analyzer` does with it's `rust-analyzer/status` request which returns it as a string which then the client can just display it in a separate window. This is what I'm thinking of doing as well. Other editors can also benefit from it by directly opening a temporary file with this information that the user can see directly. There are couple of options here: 1. Keep using the command, keep the log request and return the string 2. Keep using the command, remove the log request and return the string 3. Create a new request similar to `rust-analyzer/status` which returns a string This PR implements (1) but I'd want to move towards (2) and remove the log request completely. We haven't advertised it as such so this would only require updating the VS Code extension to handle it by opening a new document with the debug content. ## Test plan For VS Code, refer to https://github.com/astral-sh/ruff-vscode/pull/694. For Neovim, one could do: ```lua local function execute_ruff_command(command) local client = vim.lsp.get_clients({ bufnr = vim.api.nvim_get_current_buf(), name = name, method = 'workspace/executeCommand', })[1] if not client then return end client.request('workspace/executeCommand', { command = command, arguments = { { uri = vim.uri_from_bufnr(0) } }, function(err, result) if err then -- log error return end vim.print(result) -- Or, open a new window with the `result` content end } ``` |
||
---|---|---|
.. | ||
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.