Docs Party 2024 (#15876)
Co-authored-by: Raunak Raj <nkray21111983@gmail.com> Co-authored-by: Thorsten Ball <mrnugget@gmail.com> Co-authored-by: Bennet <bennet@zed.dev> Co-authored-by: Marshall Bowers <elliott.codes@gmail.com> Co-authored-by: Joseph T Lyons <JosephTLyons@gmail.com> Co-authored-by: Mikayla <mikayla@zed.dev> Co-authored-by: Jason <jason@zed.dev> Co-authored-by: Antonio Scandurra <me@as-cii.com> Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com> Co-authored-by: Marshall <marshall@zed.dev> Co-authored-by: Nathan Sobo <nathan@zed.dev> Co-authored-by: Jason Mancuso <7891333+jvmncs@users.noreply.github.com> Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This commit is contained in:
co-authored by
Raunak Raj
Thorsten Ball
Bennet
Marshall Bowers
Joseph T Lyons
Mikayla
Jason
Antonio Scandurra
Max Brunsfeld
Marshall
Nathan Sobo
Jason Mancuso
Piotr Osiewicz
parent
c633fa5a10
commit
eb3c4b0e46
@@ -2,8 +2,14 @@
|
||||
|
||||
Rust support is available natively in Zed.
|
||||
|
||||
- Tree Sitter: [tree-sitter-rust](https://github.com/tree-sitter/tree-sitter-rust)
|
||||
- Language Server: [rust-analyzer](https://github.com/rust-lang/rust-analyzer)
|
||||
- Tree Sitter: [tree-sitter/tree-sitter-rust](https://github.com/tree-sitter/tree-sitter-rust)
|
||||
- Language Server: [rust-lang/rust-analyzer](https://github.com/rust-lang/rust-analyzer)
|
||||
|
||||
<!--
|
||||
TBD: Polish Rust Docs. Zed is a good rust editor, good Rust docs make it look like we care about Rust (we do!)
|
||||
TBD: Users may not know what inlayHints, don't start there.
|
||||
TBD: Provide explicit examples not just `....`
|
||||
-->
|
||||
|
||||
## Inlay Hints
|
||||
|
||||
@@ -28,7 +34,7 @@ Use
|
||||
|
||||
```json
|
||||
"lsp": {
|
||||
"$LANGUAGE_SERVER_NAME": {
|
||||
"rust-analyzer": {
|
||||
"initialization_options": {
|
||||
....
|
||||
}
|
||||
@@ -38,7 +44,7 @@ Use
|
||||
|
||||
to override these settings.
|
||||
|
||||
See https://rust-analyzer.github.io/manual.html#inlay-hints for more information.
|
||||
See [Inlay Hints](https://rust-analyzer.github.io/manual.html#inlay-hints) in the Rust Analyzer Manual for more information.
|
||||
|
||||
## Target directory
|
||||
|
||||
@@ -60,8 +66,45 @@ The `rust-analyzer` target directory can be set in `initialization_options`:
|
||||
|
||||
A `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`.
|
||||
|
||||
## Binary
|
||||
|
||||
You can configure which `rust-analyzer` binary Zed should use.
|
||||
|
||||
To use a binary in a custom location, add the following to your `settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"binary": {
|
||||
"path": "/Users/example/bin/rust-analyzer",
|
||||
"args": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To use a binary that is on your `$PATH`, add the following to your `settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"binary": {
|
||||
"path_lookup": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## More server configuration
|
||||
|
||||
<!--
|
||||
TBD: Is it possible to specify RUSTFLAGS? https://github.com/zed-industries/zed/issues/14334
|
||||
-->
|
||||
|
||||
Rust-analyzer [manual](https://rust-analyzer.github.io/manual.html) describes various features and configuration options for rust-analyzer language server.
|
||||
Rust-analyzer in Zed runs with the default parameters.
|
||||
|
||||
@@ -84,7 +127,7 @@ rust-analyzer.cargo.allTargets (default: true)
|
||||
Pass --all-targets to cargo invocation
|
||||
```
|
||||
|
||||
Which would mean that every time Zed [auto]saves, a `cargo check --workspace --all-targets` command is run, checking the entire project (workspace), lib, doc, test, bin, bench and [other targets](https://doc.rust-lang.org/cargo/reference/cargo-targets.html).
|
||||
Which would mean that every time Zed saves, a `cargo check --workspace --all-targets` command is run, checking the entire project (workspace), lib, doc, test, bin, bench and [other targets](https://doc.rust-lang.org/cargo/reference/cargo-targets.html).
|
||||
|
||||
While that works fine on small projects, it does not scale well.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user