⬆️ rust-analyzer

This commit is contained in:
Laurențiu Nicola 2022-10-18 09:12:49 +03:00
parent 8536eb016c
commit a99a48e786
86 changed files with 3149 additions and 1653 deletions

View file

@ -88,9 +88,8 @@ is lower than Cargo's model of packages: each Cargo package consists of several
targets, each of which is a separate crate (or several crates, if you try
different feature combinations).
Procedural macros should become inputs as well, but currently they are not
supported. Procedural macro will be a black box `Box<dyn Fn(TokenStream) -> TokenStream>`
function, and will be inserted into the crate graph just like dependencies.
Procedural macros are inputs as well, roughly modeled as a crate with a bunch of
additional black box `dyn Fn(TokenStream) -> TokenStream` functions.
Soon we'll talk how we build an LSP server on top of `Analysis`, but first,
let's deal with that paths issue.

View file

@ -8,10 +8,10 @@ This guide describes the current state of syntax trees and parsing in rust-analy
The things described are implemented in three places
* [rowan](https://github.com/rust-analyzer/rowan/tree/v0.9.0) -- a generic library for rowan syntax trees.
* [ra_syntax](https://github.com/rust-lang/rust-analyzer/tree/cf5bdf464cad7ceb9a67e07985a3f4d3799ec0b6/crates/ra_syntax) crate inside rust-analyzer which wraps `rowan` into rust-analyzer specific API.
* [rowan](https://github.com/rust-analyzer/rowan/tree/v0.15.10) -- a generic library for rowan syntax trees.
* [syntax](https://github.com/rust-lang/rust-analyzer/tree/36a70b7435c48837018c71576d7bb4e8f763f501/crates/syntax) crate inside rust-analyzer which wraps `rowan` into rust-analyzer specific API.
Nothing in rust-analyzer except this crate knows about `rowan`.
* [parser](https://github.com/rust-lang/rust-analyzer/tree/cf5bdf464cad7ceb9a67e07985a3f4d3799ec0b6/crates/parser) crate parses input tokens into an `ra_syntax` tree
* [parser](https://github.com/rust-lang/rust-analyzer/tree/36a70b7435c48837018c71576d7bb4e8f763f501/crates/parser) crate parses input tokens into a `syntax` tree
## Design Goals

View file

@ -174,14 +174,25 @@ On Unix, running the editor from a shell or changing the `.desktop` file to set
==== `rustup`
`rust-analyzer` is available in `rustup`, but only in the nightly toolchain:
`rust-analyzer` is available in `rustup`:
[source,bash]
----
$ rustup +nightly component add rust-analyzer-preview
$ rustup component add rust-analyzer
----
However, in contrast to `component add clippy` or `component add rustfmt`, this does not actually place a `rust-analyzer` binary in `~/.cargo/bin`, see https://github.com/rust-lang/rustup/issues/2411[this issue].
However, in contrast to `component add clippy` or `component add rustfmt`, this does not actually place a `rust-analyzer` binary in `~/.cargo/bin`, see https://github.com/rust-lang/rustup/issues/2411[this issue]. You can find the path to the binary using:
[source,bash]
----
$ rustup which --toolchain stable rust-analyzer
----
You can link to there from `~/.cargo/bin` or configure your editor to use the full path.
Alternatively you might be able to configure your editor to start `rust-analyzer` using the command:
[source,bash]
----
$ rustup run stable rust-analyzer
----
==== Arch Linux