feat(nvim): improve inlay hint startup

Rust analyzer seems to be one of the few lsp servers which needs a
small timeout for inlay hints to show up correctly. All other servers
get their inlay hints activated without delay.
This commit is contained in:
Moritz Böhme 2023-08-12 08:05:05 +02:00
parent d6b95fdef6
commit 403d88f161
Signed by: moritz
GPG key ID: 970C6E89EB0547A9

View file

@ -107,9 +107,13 @@ local on_attach_def = function(client, bufnr)
}, { buffer = bufnr, silent = true }) }, { buffer = bufnr, silent = true })
if client.server_capabilities.inlayHintProvider then if client.server_capabilities.inlayHintProvider then
local slow_lsp_servers = {
"rust_analyzer",
}
local timeout = vim.tbl_contains(slow_lsp_servers, client.name, {}) and 500 or 0
vim.defer_fn(function() vim.defer_fn(function()
vim.lsp.inlay_hint(bufnr, true) vim.lsp.inlay_hint(bufnr, true)
end, 1000) end, timeout)
end end
end end
@ -173,6 +177,9 @@ lspconfig_setup("lua_ls", {
format = { format = {
enable = false, enable = false,
}, },
hint = {
enable = true,
},
}, },
}, },
}) })