mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-26 10:48:45 +02:00
fix(lsp): trigger FileType commands after installing LSP servers
This commit is contained in:
parent
5e1a86d3b2
commit
5b89bc8cbf
1 changed files with 9 additions and 0 deletions
|
@ -218,6 +218,15 @@ return {
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require("mason").setup(opts)
|
require("mason").setup(opts)
|
||||||
local mr = require("mason-registry")
|
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()
|
local function ensure_installed()
|
||||||
for _, tool in ipairs(opts.ensure_installed) do
|
for _, tool in ipairs(opts.ensure_installed) do
|
||||||
local p = mr.get_package(tool)
|
local p = mr.get_package(tool)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue