Compare commits

..

No commits in common. "b25a90efbc016f75393b43cf9aa9643b066be1ce" and "754a8bb8a7161e9f04596081a166722d3ec4a408" have entirely different histories.

View file

@ -1,6 +1,10 @@
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",
@ -9,8 +13,6 @@ 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
@ -99,18 +101,30 @@ 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)
-- Iterate over the servers table and configure each one -- Setup mason so it can manage external tooling
for server, config in pairs(servers) do require("mason").setup()
-- Set up the server using the `config` if provided, otherwise just `on_attach` and `capabilities`
lspconfig[server].setup({ -- Ensure the servers above are installed
on_attach = on_attach, local mason_lspconfig = require("mason-lspconfig")
capabilities = capabilities,
settings = config, -- Pass the specific server settings here mason_lspconfig.setup({
}) 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,
} }