about summary refs log tree commit diff
path: root/dotfiles/nvim/init.lua
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2024-10-27 10:52:35 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2024-10-27 10:52:35 +0100
commit75a64f1ba990bcd44724dab97c1149ed1a96deb9 (patch)
treecb5740268d8048ccc824a79c923880b645b291c1 /dotfiles/nvim/init.lua
parentdotfiles: nvim: update settings for nvim 0.10 (diff)
downloadnixos-config-75a64f1ba990bcd44724dab97c1149ed1a96deb9.tar.gz
nixos-config-75a64f1ba990bcd44724dab97c1149ed1a96deb9.tar.bz2
nixos-config-75a64f1ba990bcd44724dab97c1149ed1a96deb9.zip
dotfiles: nvim: update lsp config with capabilities for local servers
Diffstat (limited to '')
-rw-r--r--dotfiles/nvim/init.lua36
1 files changed, 21 insertions, 15 deletions
diff --git a/dotfiles/nvim/init.lua b/dotfiles/nvim/init.lua
index ba6243c..03304fa 100644
--- a/dotfiles/nvim/init.lua
+++ b/dotfiles/nvim/init.lua
@@ -597,9 +597,9 @@ require('lazy').setup({
       local capabilities = vim.lsp.protocol.make_client_capabilities()
       capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
 
-      -- TODO: We should do the capabilities stuff
-      require("lspconfig").hls.setup({})
-      require("lspconfig").gopls.setup({
+      local servers = {
+        hls = {},
+        gopls = {
           settings = {
             gopls = {
               ["ui.inlayhint.hints"] = {
@@ -612,18 +612,13 @@ require('lazy').setup({
               },
             },
           },
-        })
-      require("lspconfig").lua_ls.setup({
-          settings = {
-            Lua = {
-              completion = {
-                callSnippet = 'Replace',
-              },
-              -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
-              -- diagnostics = { disable = { 'missing-fields' } },
-            },
-          },
-        })
+        },
+      }
+
+      for lsp, settings in pairs(servers) do
+            settings.capabilities = vim.tbl_deep_extend('force', {}, capabilities, settings.capabilities or {})
+            require('lspconfig')[lsp].setup(settings)
+      end
 
       -- Enable the following language servers
       --  Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@@ -635,6 +630,17 @@ require('lazy').setup({
       --  - settings (table): Override the default settings passed when initializing the server.
       --        For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
       local autoinstalled_servers = {
+        lua_ls = {
+          settings = {
+            Lua = {
+              completion = {
+                callSnippet = 'Replace',
+              },
+              -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
+              -- diagnostics = { disable = { 'missing-fields' } },
+            },
+          },
+        }
         -- clangd = {},
         -- pyright = {},
         -- rust_analyzer = {},