dotfiles/.config/nvim/lua/brian/plugins/mason.lua

103 lines
2.1 KiB
Lua

local lsp_servers = {
'angularls',
'bashls',
'cssls',
'docker_compose_language_service',
'dockerls',
'emmet_language_server',
'eslint',
'graphql',
'html',
'jsonls',
'lua_ls',
'marksman',
'pyright',
'sqlls',
'tailwindcss',
'terraformls',
'ts_ls',
'vimls',
'yamlls',
}
local tools = {
'ast-grep',
'cbfmt',
'debugpy',
'editorconfig-checker',
'eslint_d',
'hadolint',
'js-debug-adapter',
'luacheck',
'prettier',
'prettierd',
'ruff',
'shellcheck',
'shfmt',
'stylua',
'vint',
'yamlfmt',
'codelldb',
}
local function dedupe(list)
local seen = {}
local out = {}
for _, item in ipairs(list) do
if not seen[item] then
seen[item] = true
table.insert(out, item)
end
end
return out
end
local tool_installer_list =
dedupe(vim.list_extend(vim.deepcopy(tools), lsp_servers))
return {
{
'mason-org/mason-lspconfig.nvim',
cond = vim.env.DOTFILES_CI ~= '1',
opts = {
-- Only auto-enable the LSP servers we explicitly manage in this config.
-- This avoids accidental multi-server attaches (e.g. ts_ls + vtsls),
-- which can produce duplicate Telescope definition results.
automatic_enable = lsp_servers,
},
dependencies = {
{
'mason-org/mason.nvim',
opts = {
ui = {
icons = {
package_installed = '',
package_pending = '',
package_uninstalled = '',
},
},
},
},
'neovim/nvim-lspconfig',
},
},
{
'WhoIsSethDaniel/mason-tool-installer.nvim',
cond = vim.env.DOTFILES_CI ~= '1',
dependencies = {
'mason-org/mason.nvim',
},
opts = {
ensure_installed = tool_installer_list,
integrations = {
-- Keep mapping enabled so lspconfig names (e.g. ts_ls) resolve to Mason packages.
-- This is the sole installer to avoid racing mason-lspconfig and mason-nvim-dap.
['mason-lspconfig'] = true,
['mason-null-ls'] = false,
['mason-nvim-dap'] = false,
},
run_on_start = vim.env.DOTFILES_CI ~= '1',
start_delay = 3000,
},
},
}