Change nvim lspconfig to work with mason and vue

This commit is contained in:
Nico
2025-10-24 19:21:22 +02:00
parent f60bf4608f
commit 2224c25e2b
8 changed files with 186 additions and 71 deletions

View File

@@ -1,37 +1,46 @@
return {
"williamboman/mason.nvim",
cmd = "Mason",
keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
build = ":MasonUpdate",
opts_extend = { "ensure_installed" },
opts = {
ensure_installed = {
"stylua",
"shfmt",
},
},
---@param opts MasonSettings | {ensure_installed: string[]}
config = function(_, opts)
require("mason").setup(opts)
local mr = require("mason-registry")
mr:on("package:install:success", function()
vim.defer_fn(function()
-- trigger FileType event to possibly load this newly installed LSP server
require("lazy.core.handler.event").trigger({
event = "FileType",
buf = vim.api.nvim_get_current_buf(),
})
end, 100)
end)
mr.refresh(function()
for _, tool in ipairs(opts.ensure_installed) do
local p = mr.get_package(tool)
if not p:is_installed() then
p:install()
end
end
end)
end,
"mason-org/mason.nvim",
config = function ()
require("mason").setup()
end
}
-- return {
--
-- "williamboman/mason.nvim",
-- cmd = "Mason",
-- keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
-- build = ":MasonUpdate",
-- opts_extend = { "ensure_installed" },
-- opts = {
-- ensure_installed = {
-- -- "stylua",
-- -- "shfmt",
-- },
-- },
-- ---@param opts MasonSettings | {ensure_installed: string[]}
-- config = function(_, opts)
-- require("mason").setup(opts)
-- local mr = require("mason-registry")
-- mr:on("package:install:success", function()
-- vim.defer_fn(function()
-- -- trigger FileType event to possibly load this newly installed LSP server
-- require("lazy.core.handler.event").trigger({
-- event = "FileType",
-- buf = vim.api.nvim_get_current_buf(),
-- })
-- end, 100)
-- end)
--
-- mr.refresh(function()
-- for _, tool in ipairs(opts.ensure_installed) do
-- local p = mr.get_package(tool)
-- if not p:is_installed() then
-- p:install()
-- end
-- end
-- end)
-- end,
-- }