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
+88 -75
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',
function(server_name) 'dockerls',
lspconfig[server_name].setup({ 'yamlls',
capabilities = capabilities, 'jsonls',
}) 'taplo',
end, 'systemd_ls',
['emmet_ls'] = function()
-- configure emmet language server -- Web / frontend
lspconfig['emmet_ls'].setup({ 'html',
capabilities = capabilities, 'cssls',
filetypes = { 'html', 'typescriptreact', 'javascriptreact', 'css', 'sass', 'scss', 'less', 'svelte' }, 'eslint',
}) 'emmet_ls',
end, 'stylelint_lsp',
['bashls'] = function()
lspconfig['bashls'].setup({ -- Python
capabilities = capabilities, 'pyright',
filetypes = { 'sh', 'bash', 'zsh' }, },
}) handlers = {
end, -- default handler
['lua_ls'] = function() function(server_name)
-- configure lua server (with special settings) lspconfig[server_name].setup({
lspconfig['lua_ls'].setup({ capabilities = capabilities,
capabilities = capabilities, })
settings = { end,
Lua = { -- overrides
-- make the language server recognize "vim" global bashls = function()
diagnostics = { lspconfig.bashls.setup({
globals = { 'vim' }, capabilities = capabilities,
}, filetypes = { 'sh', 'bash', 'zsh' },
completion = { })
callSnippet = 'Replace', end,
lua_ls = function()
lspconfig.lua_ls.setup({
capabilities = capabilities,
settings = {
Lua = {
diagnostics = { globals = { 'vim' } },
completion = { callSnippet = 'Replace' },
}, },
}, },
}, })
}) end,
end, },
}) ]] })
end, end,
}, },
} }