Add more documentation about ways to configure language servers and rust-analyzer (#29932)

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov
2025-05-05 16:10:10 +00:00
committed by GitHub
parent c56a1cf2b1
commit 76c0eded0d
3 changed files with 91 additions and 1 deletions
+33
View File
@@ -119,6 +119,39 @@ If you are using `rustup` and you can find a list of available target triples (`
rustup target list --installed
```
## LSP tasks
Zed provides tasks using tree-sitter, but rust-analyzer has an LSP extension method for querying file-related tasks via LSP.
This is enabled by default and can be configured as
```json
"lsp": {
"rust-analyzer": {
enable_lsp_tasks": true,
}
}
```
## Manual Cargo Diagnostics fetch
By default, rust-analyzer has `checkOnSave: true` enabled, which causes every buffer save to trigger a `cargo check --workspace --all-targets` command.
For lager projects this might introduce excessive wait times, so a more fine-grained triggering could be enabled by altering the
```json
"diagnostics": {
"cargo": {
// When enabled, Zed disables rust-analyzer's check on save and starts to query
// Cargo diagnostics separately.
"fetch_cargo_diagnostics": false
}
}
```
default settings.
This will stop rust-analyzer from running `cargo check ...` on save, yet still allow to run
`editor: run/clear/cancel flycheck` commands in Rust files to refresh cargo diagnostics; the project diagnostics editor will also refresh cargo diagnostics with `editor: run flycheck` command when the setting is enabled.
## More server configuration
<!--