remove mason

This commit is contained in:
Salar Rahmanian 2024-09-07 11:12:10 -07:00
parent 754a8bb8a7
commit 085806840e

View file

@ -1,10 +1,6 @@
return { return {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
dependencies = { dependencies = {
-- Automatically install LSPs to stdpath for neovim
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
-- Useful status updates for LSP -- Useful status updates for LSP
"j-hui/fidget.nvim", "j-hui/fidget.nvim",
@ -13,6 +9,8 @@ return {
}, },
config = function() config = function()
-- LSP settings. -- LSP settings.
-- Require the lspconfig module
local lspconfig = require("lspconfig")
-- This function gets run when an LSP connects to a particular buffer. -- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr) local on_attach = function(_, bufnr)
-- NOTE: Remember that lua is a real programming language, and as such it is possible -- NOTE: Remember that lua is a real programming language, and as such it is possible
@ -101,30 +99,18 @@ return {
ts_ls = {}, ts_ls = {},
yamlls = {}, yamlls = {},
} }
--
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers -- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
-- Setup mason so it can manage external tooling -- Iterate over the servers table and configure each one
require("mason").setup() for server, config in pairs(servers) do
-- Set up the server using the `config` if provided, otherwise just `on_attach` and `capabilities`
-- Ensure the servers above are installed lspconfig[server].setup({
local mason_lspconfig = require("mason-lspconfig") on_attach = on_attach,
capabilities = capabilities,
mason_lspconfig.setup({ settings = config, -- Pass the specific server settings here
ensure_installed = vim.tbl_keys(servers), })
}) end
mason_lspconfig.setup_handlers({
function(server_name)
require("lspconfig")[server_name].setup({
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
})
end,
})
end, end,
} }