Compare commits

..

2 Commits

Author SHA1 Message Date
Moritz Böhme 55d8df866b
feat(nvim): add neodev.nvim 2023-08-12 08:07:33 +02:00
Moritz Böhme 403d88f161
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.
2023-08-12 08:05:05 +02:00
2 changed files with 22 additions and 2 deletions

View File

@ -123,7 +123,6 @@ with builtins;
]; ];
} }
{ plugin = which-key-nvim; } { plugin = which-key-nvim; }
{ plugin = lspkind-nvim; }
{ plugin = lsp_lines-nvim; } { plugin = lsp_lines-nvim; }
{ {
plugin = nvim-ufo; plugin = nvim-ufo;
@ -131,6 +130,19 @@ with builtins;
{ plugin = promise-async; } { plugin = promise-async; }
]; ];
} }
{
plugin = neodev-nvim;
conf = /* lua */ ''
require("neodev").setup({
override = function(root_dir, library)
if root_dir:find("/home/moritz/.dotfiles/", 1, true) == 1 then
library.enabled = true
library.plugins = true
end
end,
})
'';
}
]; ];
} }
{ {

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
@ -156,6 +160,7 @@ lspconfig_setup("lua_ls", {
runtime = { runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT", version = "LuaJIT",
path = vim.split(package.path, ";"),
}, },
diagnostics = { diagnostics = {
-- Get the language server to recognize the `vim` global -- Get the language server to recognize the `vim` global
@ -173,6 +178,9 @@ lspconfig_setup("lua_ls", {
format = { format = {
enable = false, enable = false,
}, },
hint = {
enable = true,
},
}, },
}, },
}) })