Skip to content

Commit db7b339

Browse files
committed
Backport some manual changes
1 parent b743ed5 commit db7b339

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

docs/book/book.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ title = "rust-analyzer"
99
edition = "2021"
1010

1111
[output.html]
12-
edit-url-template = "https://github.com/rust-analyzer/rust-analyzer/edit/master/manual/{path}"
13-
git-repository-url = "https://github.com/rust-analyzer/rust-analyzer/tree/master/manual"
12+
edit-url-template = "https://github.com/rust-lang/rust-analyzer/edit/master/manual/{path}"
13+
git-repository-url = "https://github.com/rust-lang/rust-analyzer/tree/master/manual"
1414
mathjax-support = true
1515
site-url = "/rust-analyzer/"
1616

docs/book/src/installation/README.md

+25-22
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ the environment should help.
157157
The `rust-analyzer` binary can be installed from the repos or AUR (Arch
158158
User Repository):
159159

160-
- [`rust-analyzer`](https://www.archlinux.org/packages/community/x86_64/rust-analyzer/)
160+
- [`rust-analyzer`](https://www.archlinux.org/packages/extra/x86_64/rust-analyzer/)
161161
(built from latest tagged source)
162162

163163
- [`rust-analyzer-git`](https://aur.archlinux.org/packages/rust-analyzer-git)
@@ -169,19 +169,7 @@ Install it with pacman, for example:
169169

170170
### Gentoo Linux
171171

172-
`rust-analyzer` is available in the GURU repository:
173-
174-
- [`dev-util/rust-analyzer`](https://gitweb.gentoo.org/repo/proj/guru.git/tree/dev-util/rust-analyzer?id=9895cea62602cfe599bd48e0fb02127411ca6e81)
175-
builds from source
176-
177-
- [`dev-util/rust-analyzer-bin`](https://gitweb.gentoo.org/repo/proj/guru.git/tree/dev-util/rust-analyzer-bin?id=9895cea62602cfe599bd48e0fb02127411ca6e81)
178-
installs an official binary release
179-
180-
If not already, GURU must be enabled (e.g. using
181-
`app-eselect/eselect-repository`) and sync’d before running `emerge`:
182-
183-
$ eselect repository enable guru && emaint sync -r guru
184-
$ emerge rust-analyzer-bin
172+
`rust-analyzer` is installed when the `rust-analyzer` use flag is set for dev-lang/rust or dev-lang/rust-bin. You also need to set the `rust-src` use flag.
185173

186174
### macOS
187175

@@ -201,8 +189,10 @@ to link to. Some compilers and libraries can be acquired as Flatpak
201189
SDKs, such as `org.freedesktop.Sdk.Extension.rust-stable` or
202190
`org.freedesktop.Sdk.Extension.llvm15`.
203191

204-
If you use a Flatpak SDK for Rust, there should be no extra steps
205-
necessary.
192+
If you use a Flatpak SDK for Rust, it must be in your `PATH`:
193+
194+
* install the SDK extensions with `flatpak install org.freedesktop.Sdk.Extension.{llvm15,rust-stable}//23.08`
195+
* enable SDK extensions in the editor with the environment variable `FLATPAK_ENABLE_SDK_EXT=llvm15,rust-stable` (this can be done using flatseal or `flatpak override`)
206196

207197
If you want to use Flatpak in combination with `rustup`, the following
208198
steps might help:
@@ -363,14 +353,14 @@ Once `neovim/nvim-lspconfig` is installed, use
363353
You can also pass LSP settings to the server:
364354

365355
lua << EOF
366-
local nvim_lsp = require'lspconfig'
356+
local lspconfig = require'lspconfig'
367357

368358
local on_attach = function(client)
369359
require'completion'.on_attach(client)
370360
end
371361

372-
nvim_lsp.rust_analyzer.setup({
373-
on_attach=on_attach,
362+
lspconfig.rust_analyzer.setup({
363+
on_attach = on_attach,
374364
settings = {
375365
["rust-analyzer"] = {
376366
imports = {
@@ -392,10 +382,23 @@ You can also pass LSP settings to the server:
392382
})
393383
EOF
394384

385+
If you're running Neovim 0.10 or later, you can enable inlay hints via `on_attach`:
386+
387+
```vim
388+
lspconfig.rust_analyzer.setup({
389+
on_attach = function(client, bufnr)
390+
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
391+
end
392+
})
393+
```
394+
395+
Note that the hints are only visible after `rust-analyzer` has finished loading **and** you have to
396+
edit the file to trigger a re-render.
397+
395398
See <https://sharksforarms.dev/posts/neovim-rust/> for more tips on
396399
getting started.
397400

398-
Check out <https://github.com/simrat39/rust-tools.nvim> for a batteries
401+
Check out <https://github.com/mrcjkb/rustaceanvim> for a batteries
399402
included rust-analyzer setup for Neovim.
400403

401404
### vim-lsp
@@ -406,7 +409,7 @@ simple as adding this line to your `.vimrc`:
406409

407410
Plug 'prabirshrestha/vim-lsp'
408411

409-
Next you need to register the `rust-analyzer` binary. If it is available
412+
Next you need to register the `rust-analyzer` binary. If it is avim.lspvailable
410413
in `$PATH`, you may want to add this to your `.vimrc`:
411414

412415
if executable('rust-analyzer')
@@ -632,4 +635,4 @@ workflow](https://github.com/rust-lang/rust-analyzer/blob/master/.github/workflo
632635
## Zed
633636

634637
[Zed](https://zed.dev) has native `rust-analyzer` support. If the LSP
635-
binary is not available, Zed can install it when opening a Rust file.
638+
binary is not available, Zed can install it when opening a Rust file.

docs/book/src/non_cargo_based_projects/README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ There are three ways to feed `rust-project.json` to rust-analyzer:
135135
Relative paths are interpreted relative to `rust-project.json` file
136136
location or (for inline JSON) relative to `rootUri`.
137137

138-
See <https://github.com/rust-analyzer/rust-project.json-example> for a
139-
small example.
140-
141138
You can set the `RA_LOG` environment variable to `rust_analyzer=info` to
142139
inspect how rust-analyzer handles config and project loading.
143140

@@ -156,4 +153,4 @@ command.
156153
error messages for rust-analyzer to consume. The `--message-format=json`
157154
flag does this for `cargo check` so whichever command you use must also
158155
output errors in this format. See the [Configuration](#_configuration)
159-
section for more information.
156+
section for more information.

0 commit comments

Comments
 (0)