diff options
| author | Laurențiu Nicola <lnicola@dend.ro> | 2024-03-03 09:17:31 +0200 |
|---|---|---|
| committer | Laurențiu Nicola <lnicola@dend.ro> | 2024-03-03 09:17:31 +0200 |
| commit | 964e769ffd5df865780e098380a9a4a99360e50b (patch) | |
| tree | 1ae4054e69d582516ac31f446d05ddc1123ba407 /src/tools/rust-analyzer/docs | |
| parent | 3793e5ba23ca6a57ace8e3e267c22001cc5ef794 (diff) | |
| parent | 4ef6a49b44e8aa380da7522442234bfd7a52c55e (diff) | |
| download | rust-964e769ffd5df865780e098380a9a4a99360e50b.tar.gz rust-964e769ffd5df865780e098380a9a4a99360e50b.zip | |
Merge commit '4ef6a49b44e8aa380da7522442234bfd7a52c55e' into sync-from-ra
Diffstat (limited to 'src/tools/rust-analyzer/docs')
| -rw-r--r-- | src/tools/rust-analyzer/docs/user/generated_config.adoc | 20 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/docs/user/manual.adoc | 19 |
2 files changed, 26 insertions, 13 deletions
diff --git a/src/tools/rust-analyzer/docs/user/generated_config.adoc b/src/tools/rust-analyzer/docs/user/generated_config.adoc index da7654b0f64..d4ba5af9231 100644 --- a/src/tools/rust-analyzer/docs/user/generated_config.adoc +++ b/src/tools/rust-analyzer/docs/user/generated_config.adoc @@ -144,6 +144,16 @@ This option does not take effect until rust-analyzer is restarted. -- Compilation target override (target triple). -- +[[rust-analyzer.cargo.targetDir]]rust-analyzer.cargo.targetDir (default: `null`):: ++ +-- +Optional path to a rust-analyzer specific target directory. +This prevents rust-analyzer's `cargo check` and initial build-script and proc-macro +building 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.cargo.unsetTest]]rust-analyzer.cargo.unsetTest (default: `["core"]`):: + -- @@ -814,16 +824,6 @@ 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`):: + -- diff --git a/src/tools/rust-analyzer/docs/user/manual.adoc b/src/tools/rust-analyzer/docs/user/manual.adoc index 9e9ea257790..8bc11fd481d 100644 --- a/src/tools/rust-analyzer/docs/user/manual.adoc +++ b/src/tools/rust-analyzer/docs/user/manual.adoc @@ -337,14 +337,14 @@ You can also pass LSP settings to the server: [source,vim] ---- lua << EOF -local nvim_lsp = require'lspconfig' +local lspconfig = require'lspconfig' local on_attach = function(client) require'completion'.on_attach(client) end -nvim_lsp.rust_analyzer.setup({ - on_attach=on_attach, +lspconfig.rust_analyzer.setup({ + on_attach = on_attach, settings = { ["rust-analyzer"] = { imports = { @@ -367,6 +367,19 @@ nvim_lsp.rust_analyzer.setup({ EOF ---- +If you're running Neovim 0.10 or later, you can enable inlay hints via `on_attach`: + +[source,vim] +---- +lspconfig.rust_analyzer.setup({ + on_attach = function(client, bufnr) + vim.lsp.inlay_hint.enable(bufnr) + end +}) +---- + +Note that the hints are only visible after `rust-analyzer` has finished loading **and** you have to edit the file to trigger a re-render. + See https://sharksforarms.dev/posts/neovim-rust/ for more tips on getting started. Check out https://github.com/mrcjkb/rustaceanvim for a batteries included rust-analyzer setup for Neovim. |
