aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-core/package/init.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-12-05 17:48:34 +0100
committerGitHub <noreply@github.com>2022-12-05 17:48:34 +0100
commit2381f507189e3e10a43c3932a3ec6c2847180abc (patch)
treeaf51bec9c83583b6033bd193effc289c2c2b590a /lua/mason-core/package/init.lua
parentchore: update generated code (#728) (diff)
downloadmason-2381f507189e3e10a43c3932a3ec6c2847180abc.tar
mason-2381f507189e3e10a43c3932a3ec6c2847180abc.tar.gz
mason-2381f507189e3e10a43c3932a3ec6c2847180abc.tar.bz2
mason-2381f507189e3e10a43c3932a3ec6c2847180abc.tar.lz
mason-2381f507189e3e10a43c3932a3ec6c2847180abc.tar.xz
mason-2381f507189e3e10a43c3932a3ec6c2847180abc.tar.zst
mason-2381f507189e3e10a43c3932a3ec6c2847180abc.zip
fix(package): don't call vim API functions inside fast event (#730)
Diffstat (limited to 'lua/mason-core/package/init.lua')
-rw-r--r--lua/mason-core/package/init.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/lua/mason-core/package/init.lua b/lua/mason-core/package/init.lua
index e46219b7..faf25764 100644
--- a/lua/mason-core/package/init.lua
+++ b/lua/mason-core/package/init.lua
@@ -81,12 +81,10 @@ function Package:new_handle()
local handle = InstallationHandle.new(self)
self.handle = handle
- -- First emit a private autocmd via the native event bus. This is to enable some internal perf improvements (helps avoid loading some Lua modules).
- if vim.fn.has "nvim-0.8.0" == 1 then
- vim.api.nvim_exec_autocmds("User", { pattern = "__MasonPackageHandle", data = self.name })
- else
- vim.api.nvim_exec_autocmds("User", { pattern = "__MasonPackageHandle" })
- end
+ -- Ideally we'd decouple this and leverage Mason's event system, but to allow loading as little as possible during
+ -- setup (i.e. not load modules related to Mason's event system) of the mason.nvim plugin we explicitly call into
+ -- terminator here.
+ require("mason-core.terminator").register(handle)
self:emit("handle", handle)
registry:emit("package:handle", self, handle)