Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document nvim 0.10 inlay_hint #16670

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions docs/user/manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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.
Expand Down
Loading