From ea837d181e980972bb2f3a64fe4fb45b4e229257 Mon Sep 17 00:00:00 2001 From: Rik Huijzer Date: Sun, 25 Feb 2024 17:59:19 +0100 Subject: [PATCH 1/2] Document nvim 0.10 `inlay_hint` --- docs/user/manual.adoc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc index 9e9ea25779047..4ac3bf854ae7b 100644 --- a/docs/user/manual.adoc +++ b/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,17 @@ 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 +}) +---- + 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. From 4060377c07376d6cba51332341114accdb1ae0ef Mon Sep 17 00:00:00 2001 From: Rik Huijzer Date: Sun, 25 Feb 2024 18:05:52 +0100 Subject: [PATCH 2/2] Add note --- docs/user/manual.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc index 4ac3bf854ae7b..8bc11fd481db2 100644 --- a/docs/user/manual.adoc +++ b/docs/user/manual.adoc @@ -378,6 +378,8 @@ lspconfig.rust_analyzer.setup({ }) ---- +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.