feat(nvim): add lsp inlay hints

nixos
Moritz Böhme 2023-08-11 19:00:43 +02:00
parent 1566dc84f4
commit d6b95fdef6
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
1 changed files with 14 additions and 2 deletions

View File

@ -54,7 +54,7 @@ capabilities.textDocument.foldingRange = {
require("ufo").setup()
local lspconfig = require("lspconfig")
local on_attach_def = function(_, bufnr)
local on_attach_def = function(client, bufnr)
require("which-key").register({
K = { vim.lsp.buf.hover, "Hover" },
["<leader>"] = {
@ -71,7 +71,13 @@ local on_attach_def = function(_, bufnr)
},
},
t = {
l = { lsp_lines.toggle, "Lsp lines" },
l = { lsp_lines.toggle, "LSP lines" },
i = {
function()
vim.lsp.inlay_hint(bufnr, nil)
end,
"LSP inlay hints",
},
},
},
g = {
@ -99,6 +105,12 @@ local on_attach_def = function(_, bufnr)
d = { vim.diagnostic.goto_next, "Next diagnostic" },
},
}, { buffer = bufnr, silent = true })
if client.server_capabilities.inlayHintProvider then
vim.defer_fn(function()
vim.lsp.inlay_hint(bufnr, true)
end, 1000)
end
end
local lspconfig_default_options = {