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 -- local hl = "DiagnosticSign" .. type
-- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) -- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
-- end -- end
--
for _, server in ipairs({
"html",
"cssls",
"tailwindcss",
"lua_ls",
"pyright",
}) do
lspconfig[server].setup({ capabilities = capabilities })
end
mason_lspconfig.setup_handlers({ -- lua config
-- default handler for installed servers lspconfig.lua_ls.setup({
function(server_name) capabilities = capabilities,
lspconfig[server_name].setup({ settings = {
capabilities = capabilities, Lua = {
}) diagnostics = { globals = { "vim" } },
end, completion = { callSnippet = "Replace" },
["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 = {
"html",
"typescriptreact",
"javascriptreact",
"css",
"sass",
"scss",
"less",
"svelte",
},
})
end,
["lua_ls"] = function()
-- configure lua server (with special settings)
lspconfig["lua_ls"].setup({
capabilities = capabilities,
settings = {
Lua = {
-- make the language server recognize "vim" global
diagnostics = {
globals = { "vim" },
},
completion = {
callSnippet = "Replace",
},
},
},
})
end,
}) })
end, end,
} }

View File

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