Make lspconfig auto setup upon MasonInstall

This commit is contained in:
David Holland 2023-09-13 23:14:50 +02:00
parent 0855935763
commit 2665b719de
2 changed files with 36 additions and 4 deletions

View File

@ -13,6 +13,8 @@ M.treesitter = {
"cpp", "cpp",
"markdown", "markdown",
"markdown_inline", "markdown_inline",
"rust",
"svelte",
}, },
indent = { indent = {
enable = true, enable = true,
@ -48,6 +50,31 @@ M.mason = {
}, },
} }
M.mason_lspconfig = {
ensure_installed = {},
automatic_installation = true,
handlers = {
function (server_name)
require("lspconfig")[server_name].setup{
on_attach = require("plugins.configs.lspconfig").on_attach,
capabilities = require("plugins.configs.lspconfig").capabilities,
}
end,
["lua_ls"] = function ()
require("lspconfig").lua_ls.setup {
settings = {
Lua = {
diagnostics = {
globals = { "vim" }
}
}
}
}
end,
}
}
-- git support in nvimtree -- git support in nvimtree
M.nvimtree = { M.nvimtree = {
git = { git = {

View File

@ -4,7 +4,6 @@ local overrides = require("custom.configs.overrides")
local plugins = { local plugins = {
-- Override plugin definition options -- Override plugin definition options
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
dependencies = { dependencies = {
@ -15,17 +14,23 @@ local plugins = {
require "custom.configs.null-ls" require "custom.configs.null-ls"
end, end,
}, },
"williamboman/mason-lspconfig.nvim",
}, },
config = function() config = function()
require "plugins.configs.lspconfig" require "plugins.configs.lspconfig"
require "custom.configs.lspconfig" -- Use mason-lspconfig hooks instead
-- require "custom.configs.lspconfig"
end, -- Override to setup mason-lspconfig end, -- Override to setup mason-lspconfig
}, },
-- override plugin configs -- override plugin configs
{ {
"williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim",
opts = overrides.mason dependencies = {
"williamboman/mason.nvim",
opts = overrides.mason
},
opts = overrides.mason_lspconfig,
}, },
{ {