From 403d88f161c0667be93e3f815756cd2db8152a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sat, 12 Aug 2023 08:05:05 +0200 Subject: [PATCH 1/2] 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. --- modules/programs/nvim/plugins/nvim-lspconfig.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/programs/nvim/plugins/nvim-lspconfig.lua b/modules/programs/nvim/plugins/nvim-lspconfig.lua index d2ab5b5..e663322 100644 --- a/modules/programs/nvim/plugins/nvim-lspconfig.lua +++ b/modules/programs/nvim/plugins/nvim-lspconfig.lua @@ -107,9 +107,13 @@ local on_attach_def = function(client, bufnr) }, { buffer = bufnr, silent = true }) 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.lsp.inlay_hint(bufnr, true) - end, 1000) + end, timeout) end end @@ -173,6 +177,9 @@ lspconfig_setup("lua_ls", { format = { enable = false, }, + hint = { + enable = true, + }, }, }, }) From 55d8df866bb6f1823586ac2609ba4346028eb47e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sat, 12 Aug 2023 08:07:33 +0200 Subject: [PATCH 2/2] feat(nvim): add neodev.nvim --- modules/programs/nvim/plugins/default.nix | 14 +++++++++++++- modules/programs/nvim/plugins/nvim-lspconfig.lua | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/programs/nvim/plugins/default.nix b/modules/programs/nvim/plugins/default.nix index 9d4c4fe..68088b8 100644 --- a/modules/programs/nvim/plugins/default.nix +++ b/modules/programs/nvim/plugins/default.nix @@ -123,7 +123,6 @@ with builtins; ]; } { plugin = which-key-nvim; } - { plugin = lspkind-nvim; } { plugin = lsp_lines-nvim; } { plugin = nvim-ufo; @@ -131,6 +130,19 @@ with builtins; { 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, + }) + ''; + } ]; } { diff --git a/modules/programs/nvim/plugins/nvim-lspconfig.lua b/modules/programs/nvim/plugins/nvim-lspconfig.lua index e663322..7fbc917 100644 --- a/modules/programs/nvim/plugins/nvim-lspconfig.lua +++ b/modules/programs/nvim/plugins/nvim-lspconfig.lua @@ -160,6 +160,7 @@ lspconfig_setup("lua_ls", { runtime = { -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) version = "LuaJIT", + path = vim.split(package.path, ";"), }, diagnostics = { -- Get the language server to recognize the `vim` global