]> git.rmz.io Git - dotfiles.git/commitdiff
nvim: replace require('lspconfig') with vim.lsp.config
authorSamir Benmendil <me@rmz.io>
Mon, 27 Oct 2025 22:19:24 +0000 (22:19 +0000)
committerSamir Benmendil <me@rmz.io>
Mon, 27 Oct 2025 22:19:24 +0000 (22:19 +0000)
The former has been deprecated.

nvim/lua/plugins/lsp/init.lua

index 132c412e70d652a0dcdf51a1030f4be27b3719a7..09adfdd0bd95c168e8f5c554470971a9a5150ee5 100644 (file)
@@ -83,7 +83,6 @@ return {
     },
     ---@param opts PluginLspOpts
     config = function(_, opts)
-      local lspconfig = require('lspconfig')
       for server, config in pairs(opts.servers) do
         local capabilities = vim.tbl_deep_extend("force",
           vim.lsp.protocol.make_client_capabilities() or {},
@@ -91,7 +90,7 @@ return {
           config.capabilities or {}
         )
         config.capabilities = capabilities
-        lspconfig[server].setup(config)
+        vim.lsp.config(server, config)
       end
 
       -- setup keymaps
@@ -116,7 +115,7 @@ return {
           if server_opts.enabled ~= false then
             -- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig
             if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then
-              require("lspconfig")[server].setup(server_opts)
+              vim.lsp.config(server, server_opts)
             else
               ensure_installed[#ensure_installed + 1] = server
             end