correct handlers config, refactor ensure_installed, add comments

This commit is contained in:
2025-10-03 12:18:52 -04:00
parent d5990edb11
commit 9b710cdad3
+74 -61
View File
@@ -30,25 +30,49 @@ return {
}) })
mason_tool_installer.setup({ mason_tool_installer.setup({
automatic_installation = true, auto_update = true,
automatic_enable = true, run_on_start = true,
automatic_cleanup = true, start_delay = 5000,
-- debounce_hours = 2,
ensure_installed = { ensure_installed = {
-- 'ansible-lint', -- Shell / Bash / Zsh
-- 'black', 'shellcheck',
-- 'eslint_d', 'beautysh',
-- 'gitlint',
-- 'htmlhint', -- Markdown
-- 'isort', 'markdownlint',
-- 'jsonlint',
-- 'markdownlint', -- Web / Frontend
-- 'prettier', 'eslint_d',
-- 'pylint', 'stylelint',
-- 'shellcheck', 'htmlhint',
-- 'shellharden', 'prettier',
-- 'stylua',
-- 'trivy', -- YAML / Ansible
-- 'yamllint', 'yamllint',
'ansible-lint',
-- Docker
'hadolint',
'trivy',
-- JSON / Config
'jsonlint',
'jq',
-- Python
'black',
'isort',
'pylint',
-- Lua
'stylua',
-- commit messages
'gitlint',
-- systemd units
'systemdlint',
}, },
}) })
end, end,
@@ -68,68 +92,57 @@ return {
local capabilities = require('cmp_nvim_lsp').default_capabilities() local capabilities = require('cmp_nvim_lsp').default_capabilities()
mason_lspconfig.setup({ mason_lspconfig.setup({
automatic_installation = true,
automatic_enable = true,
automatic_cleanup = true,
ensure_installed = { ensure_installed = {
-- Core
'lua_ls', 'lua_ls',
-- 'ansiblels', 'marksman',
-- 'bashls', 'bashls',
-- 'css_variables',
-- 'cssls',
-- 'cssmodules_ls',
-- 'docker_compose_language_service',
-- 'dockerls',
-- 'emmet_ls',
-- 'eslint',
-- 'html',
-- 'jsonls',
-- 'markdown_oxide',
-- 'marksman',
-- 'pylsp',
-- 'vimls',
-- 'yamlls',
},
})
--[[ mason_lspconfig.setup_handlers({ -- Infra / configs
-- default handler for installed servers 'ansiblels',
'dockerls',
'yamlls',
'jsonls',
'taplo',
'systemd_ls',
-- Web / frontend
'html',
'cssls',
'eslint',
'emmet_ls',
'stylelint_lsp',
-- Python
'pyright',
},
handlers = {
-- default handler
function(server_name) function(server_name)
lspconfig[server_name].setup({ lspconfig[server_name].setup({
capabilities = capabilities, capabilities = capabilities,
}) })
end, end,
['emmet_ls'] = function() -- overrides
-- configure emmet language server bashls = function()
lspconfig['emmet_ls'].setup({ lspconfig.bashls.setup({
capabilities = capabilities,
filetypes = { 'html', 'typescriptreact', 'javascriptreact', 'css', 'sass', 'scss', 'less', 'svelte' },
})
end,
['bashls'] = function()
lspconfig['bashls'].setup({
capabilities = capabilities, capabilities = capabilities,
filetypes = { 'sh', 'bash', 'zsh' }, filetypes = { 'sh', 'bash', 'zsh' },
}) })
end, end,
['lua_ls'] = function() lua_ls = function()
-- configure lua server (with special settings) lspconfig.lua_ls.setup({
lspconfig['lua_ls'].setup({
capabilities = capabilities, capabilities = capabilities,
settings = { settings = {
Lua = { Lua = {
-- make the language server recognize "vim" global diagnostics = { globals = { 'vim' } },
diagnostics = { completion = { callSnippet = 'Replace' },
globals = { 'vim' },
},
completion = {
callSnippet = 'Replace',
},
}, },
}, },
}) })
end, end,
}) ]] },
})
end, end,
}, },
} }