fix(lsp): trigger FileType commands after installing LSP servers

This commit is contained in:
Folke Lemaitre
2023-10-14 16:56:18 +02:00
parent 5e1a86d3b2
commit 5b89bc8cbf

View File

@ -218,6 +218,15 @@ return {
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)
local function ensure_installed()
for _, tool in ipairs(opts.ensure_installed) do
local p = mr.get_package(tool)