X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/b99dee25318e48024313b76e075a24afccd0c10b..ee63a3fc67861a708231e11f69fd9920378b071c:/nvim/lua/plugins/lsp/init.lua diff --git a/nvim/lua/plugins/lsp/init.lua b/nvim/lua/plugins/lsp/init.lua index d32e76c..99fab99 100644 --- a/nvim/lua/plugins/lsp/init.lua +++ b/nvim/lua/plugins/lsp/init.lua @@ -1,6 +1,6 @@ return { { "neovim/nvim-lspconfig", - event = "LazyFile", + event = { "BufReadPost", "BufNewFile", "BufWritePre" }, dependencies = { "mason.nvim", { "williamboman/mason-lspconfig.nvim", config = function() end }, -- don't configure yet @@ -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 @@ -107,7 +106,7 @@ return { -- get all the servers that are available through mason-lspconfig local mlsp = require("mason-lspconfig") -- TODO: use mason-lspconfig.get_available_servers()? - local all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package) + local all_mslp_servers = require("mason-lspconfig").get_mappings().lspconfig_to_package local ensure_installed = {} ---@type string[] for server, server_opts in pairs(opts.servers) do @@ -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 @@ -128,7 +127,7 @@ return { ensure_installed = vim.tbl_deep_extend( "force", ensure_installed, - LazyVim.opts("mason-lspconfig.nvim").ensure_installed or {} + rmz.lazy.opts("mason-lspconfig.nvim").ensure_installed or {} ), handlers = { setup }, })