1# Rust
2
3- Tree Sitter: [tree-sitter-rust](https://github.com/tree-sitter/tree-sitter-rust)
4- Language Server: [rust-analyzer](https://github.com/rust-lang/rust-analyzer)
5
6## Inlay Hints
7
8The following configuration can be used to enable inlay hints for rust:
9
10```json
11"inlayHints": {
12 "maxLength": null,
13 "lifetimeElisionHints": {
14 "useParameterNames": true,
15 "enable": "skip_trivial"
16 },
17 "closureReturnTypeHints": {
18 "enable": "always"
19 }
20}
21```
22
23to make the language server send back inlay hints when Zed has them enabled in the settings.
24
25Use
26
27```json
28"lsp": {
29 "$LANGUAGE_SERVER_NAME": {
30 "initialization_options": {
31 ....
32 }
33 }
34}
35```
36
37to override these settings.
38
39See https://rust-analyzer.github.io/manual.html#inlay-hints for more information.
40
41## Target directory
42
43The `rust-analyzer` target directory can be set in `initialization_options`:
44
45```json
46{
47 "lsp": {
48 "rust-analyzer": {
49 "initialization_options": {
50 "rust": {
51 "analyzerTargetDir": true
52 }
53 }
54 }
55 }
56}
57```
58
59A `true` setting will set the target directory to `target/rust-analyzer`. You can set a custom directory with a string like `"target/analyzer"` instead of `true`.