Document nvim 0.10 inlay_hint

This commit is contained in:
Rik Huijzer 2024-02-25 17:59:19 +01:00
parent 4a8d0f7f56
commit ea837d181e

View File

@ -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.