ruff/crates/ruff_server
Dhruv Manilawala aa429b413f
Check diagnostic refresh support from client capability (#15014)
## Summary

Per the LSP spec, the property name is `workspace.diagnostics` with an
`s` at the end but the `lsp-types` dependency uses
`workspace.diagnostic` (without an `s`). Our fork contains this fix
(0f58d62879)
so we should avoid the hardcoded value.

The implication of this is that the client which doesn't support
workspace refresh capability didn't support the [dynamic
configuration](https://docs.astral.sh/ruff/editors/features/#dynamic-configuration)
feature because the server would _always_ send the workspace refresh
request but the client would ignore it. We have a fallback logic to
publish the diagnostics instead:


5f6fc3988b/crates/ruff_server/src/server/api/notifications/did_change_watched_files.rs (L28-L40)

fixes: #15013 

## Test Plan

### VS Code


https://github.com/user-attachments/assets/61ac8e6f-aa20-41cc-b398-998e1866b5bc

### Neovim



https://github.com/user-attachments/assets/4131e13c-3fba-411c-9bb7-478d26eb8d56
2024-12-16 16:26:40 +05:30
..
assets Update documentation for ruff server with new migration guide (#11499) 2024-05-22 14:36:33 -07:00
docs Add docs for Ruff language server (#12344) 2024-07-18 17:41:43 +05:30
resources/test/fixtures Consider --preview flag for server subcommand (#12208) 2024-07-18 11:05:01 +05:30
src Check diagnostic refresh support from client capability (#15014) 2024-12-16 16:26:40 +05:30
tests Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
Cargo.toml Avoid indexing the workspace for single-file mode (#13770) 2024-10-18 10:51:43 +05:30
CONTRIBUTING.md High-level project overview and contributing guide for ruff server (#10565) 2024-03-25 23:08:37 -07:00
README.md Add docs for Ruff language server (#12344) 2024-07-18 17:41:43 +05:30

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.