changed config for breaking changes of mason 2.0

This commit is contained in:
2025-05-14 21:51:29 +02:00
parent 19f3694dab
commit 8ea214d125
2 changed files with 20 additions and 67 deletions

View File

@@ -89,69 +89,26 @@ return {
-- local hl = "DiagnosticSign" .. type
-- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
-- end
mason_lspconfig.setup_handlers({
-- default handler for installed servers
function(server_name)
lspconfig[server_name].setup({
capabilities = capabilities,
})
end,
["svelte"] = function()
-- configure svelte server
lspconfig["svelte"].setup({
capabilities = capabilities,
on_attach = function(client, bufnr)
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = { "*.js", "*.ts" },
callback = function(ctx)
-- Here use ctx.match instead of ctx.file
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
end,
})
end,
})
end,
["graphql"] = function()
-- configure graphql language server
lspconfig["graphql"].setup({
capabilities = capabilities,
filetypes = { "graphql", "gql", "svelte", "typescriptreact", "javascriptreact" },
})
end,
["emmet_ls"] = function()
-- configure emmet language server
lspconfig["emmet_ls"].setup({
capabilities = capabilities,
filetypes = {
--
for _, server in ipairs({
"html",
"typescriptreact",
"javascriptreact",
"css",
"sass",
"scss",
"less",
"svelte",
},
})
end,
["lua_ls"] = function()
-- configure lua server (with special settings)
lspconfig["lua_ls"].setup({
"cssls",
"tailwindcss",
"lua_ls",
"pyright",
}) do
lspconfig[server].setup({ capabilities = capabilities })
end
-- lua config
lspconfig.lua_ls.setup({
capabilities = capabilities,
settings = {
Lua = {
-- make the language server recognize "vim" global
diagnostics = {
globals = { "vim" },
},
completion = {
callSnippet = "Replace",
diagnostics = { globals = { "vim" } },
completion = { callSnippet = "Replace" },
},
},
},
})
end,
})
end,
}

View File

@@ -30,14 +30,10 @@ return {
"html",
"cssls",
"tailwindcss",
"svelte",
"lua_ls",
"graphql",
"emmet_ls",
"prismals",
"pyright",
},
automatic_installation = true,
automatic_enable = false,
})
mason_tool_installer.setup({