Skip to content

Commit

Permalink
fix(lsp): trigger FileType commands after installing LSP servers
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Oct 14, 2023
1 parent 5e1a86d commit 5b89bc8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lua/lazyvim/plugins/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5b89bc8

Please sign in to comment.