Merge commit '3b7c7f97e4' into sync-from-ra
This commit is contained in:
parent
6eaf3f8bb2
commit
d1d111d09e
177 changed files with 14930 additions and 2099 deletions
|
|
@ -272,7 +272,7 @@ several times, with different sets of `cfg`s enabled. The IDE-specific task of
|
|||
mapping source code into a semantic model is inherently imprecise for
|
||||
this reason and gets handled by the [`source_binder`].
|
||||
|
||||
[`source_binder`]: https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/hir/src/source_binder.rs
|
||||
[`source_binder`]: https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/source_binder.rs
|
||||
|
||||
The semantic interface is declared in the [`code_model_api`] module. Each entity is
|
||||
identified by an integer ID and has a bunch of methods which take a salsa database
|
||||
|
|
@ -280,8 +280,8 @@ as an argument and returns other entities (which are also IDs). Internally, thes
|
|||
methods invoke various queries on the database to build the model on demand.
|
||||
Here's [the list of queries].
|
||||
|
||||
[`code_model_api`]: https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/hir/src/code_model_api.rs
|
||||
[the list of queries]: https://github.com/rust-lang/rust-analyzer/blob/7e84440e25e19529e4ff8a66e521d1b06349c6ec/crates/hir/src/db.rs#L20-L106
|
||||
[`code_model_api`]: https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/code_model_api.rs
|
||||
[the list of queries]: https://github.com/rust-lang/rust-analyzer/blob/7e84440e25e19529e4ff8a66e521d1b06349c6ec/crates/ra_hir/src/db.rs#L20-L106
|
||||
|
||||
The first step of building the model is parsing the source code.
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,12 @@ build procedural macros. The command is required to output json
|
|||
and should therefore include `--message-format=json` or a similar
|
||||
option.
|
||||
|
||||
If there are multiple linked projects/workspaces, this command is invoked for
|
||||
each of them, with the working directory being the workspace root
|
||||
(i.e., the folder containing the `Cargo.toml`). This can be overwritten
|
||||
by changing `#rust-analyzer.cargo.buildScripts.invocationStrategy#` and
|
||||
`#rust-analyzer.cargo.buildScripts.invocationLocation#`.
|
||||
|
||||
By default, a cargo invocation will be constructed for the configured
|
||||
targets and features, with the following base command line:
|
||||
|
||||
|
|
@ -206,9 +212,11 @@ If you're changing this because you're using some tool wrapping
|
|||
Cargo, you might also want to change
|
||||
`#rust-analyzer.cargo.buildScripts.overrideCommand#`.
|
||||
|
||||
If there are multiple linked projects, this command is invoked for
|
||||
each of them, with the working directory being the project root
|
||||
(i.e., the folder containing the `Cargo.toml`).
|
||||
If there are multiple linked projects/workspaces, this command is invoked for
|
||||
each of them, with the working directory being the workspace root
|
||||
(i.e., the folder containing the `Cargo.toml`). This can be overwritten
|
||||
by changing `#rust-analyzer.cargo.check.invocationStrategy#` and
|
||||
`#rust-analyzer.cargo.check.invocationLocation#`.
|
||||
|
||||
An example command would be:
|
||||
|
||||
|
|
@ -244,6 +252,11 @@ with `self` prefixed to them when inside a method.
|
|||
--
|
||||
Whether to add parenthesis and argument snippets when completing function.
|
||||
--
|
||||
[[rust-analyzer.completion.fullFunctionSignatures.enable]]rust-analyzer.completion.fullFunctionSignatures.enable (default: `false`)::
|
||||
+
|
||||
--
|
||||
Whether to show full function/method signatures in completion docs.
|
||||
--
|
||||
[[rust-analyzer.completion.limit]]rust-analyzer.completion.limit (default: `null`)::
|
||||
+
|
||||
--
|
||||
|
|
@ -744,6 +757,16 @@ Command to be executed instead of 'cargo' for runnables.
|
|||
Additional arguments to be passed to cargo for runnables such as
|
||||
tests or binaries. For example, it may be `--release`.
|
||||
--
|
||||
[[rust-analyzer.rust.analyzerTargetDir]]rust-analyzer.rust.analyzerTargetDir (default: `null`)::
|
||||
+
|
||||
--
|
||||
Optional path to a rust-analyzer specific target directory.
|
||||
This prevents rust-analyzer's `cargo check` from locking the `Cargo.lock`
|
||||
at the expense of duplicating build artifacts.
|
||||
|
||||
Set to `true` to use a subdirectory of the existing target directory or
|
||||
set to a path relative to the workspace to use that path.
|
||||
--
|
||||
[[rust-analyzer.rustc.source]]rust-analyzer.rustc.source (default: `null`)::
|
||||
+
|
||||
--
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ To use `rust-analyzer`, you need to install and enable one of the two popular LS
|
|||
|
||||
==== Eglot
|
||||
|
||||
Eglot is the more minimalistic and lightweight LSP client for Emacs, integrates well with existing Emacs functionality and will be built into Emacs starting from release 29.
|
||||
Eglot is the more minimalistic and lightweight LSP client for Emacs, integrates well with existing Emacs functionality and is built into Emacs starting from release 29.
|
||||
|
||||
After installing Eglot, e.g. via `M-x package-install` (not needed from Emacs 29), you can enable it via the `M-x eglot` command or load it automatically in `rust-mode` via
|
||||
|
||||
|
|
@ -246,6 +246,15 @@ After installing Eglot, e.g. via `M-x package-install` (not needed from Emacs 29
|
|||
(add-hook 'rust-mode-hook 'eglot-ensure)
|
||||
----
|
||||
|
||||
To enable clippy, you will need to configure the initialization options to pass the `check.command` setting.
|
||||
|
||||
[source,emacs-lisp]
|
||||
----
|
||||
(add-to-list 'eglot-server-programs
|
||||
'((rust-ts-mode rust-mode) .
|
||||
("rust-analyzer" :initializationOptions (:check (:command "clippy")))))
|
||||
----
|
||||
|
||||
For more detailed instructions and options see the https://joaotavora.github.io/eglot[Eglot manual] (also available from Emacs via `M-x info`) and the
|
||||
https://github.com/joaotavora/eglot/blob/master/README.md[Eglot readme].
|
||||
|
||||
|
|
@ -555,6 +564,11 @@ There is a package named `ra_ap_rust_analyzer` available on https://crates.io/cr
|
|||
|
||||
For more details, see https://github.com/rust-lang/rust-analyzer/blob/master/.github/workflows/publish.yml[the publish workflow].
|
||||
|
||||
=== Zed
|
||||
|
||||
https://zed.dev[Zed] has native `rust-analyzer` support.
|
||||
If the LSP binary is not available, Zed can install it when opening a Rust file.
|
||||
|
||||
== Troubleshooting
|
||||
|
||||
Start with looking at the rust-analyzer version.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue