From 3a444cb7b0cee6b1e2ed31b7e76f37509075dc46 Mon Sep 17 00:00:00 2001 From: William Boman Date: Sat, 15 Feb 2025 21:00:35 +0100 Subject: fix: avoid calling vim.fn in fast event (#1878) --- lua/mason-core/platform.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lua/mason-core/platform.lua') diff --git a/lua/mason-core/platform.lua b/lua/mason-core/platform.lua index cd958abc..1fe20e5e 100644 --- a/lua/mason-core/platform.lua +++ b/lua/mason-core/platform.lua @@ -66,7 +66,7 @@ end) -- Most of the code that calls into these functions executes outside of the main event loop, where API/fn functions are -- disabled. We evaluate these immediately here to avoid issues with main loop synchronization. -local cached_features = { +M.cached_features = { ["win"] = vim.fn.has "win32", ["win32"] = vim.fn.has "win32", ["win64"] = vim.fn.has "win64", @@ -74,6 +74,7 @@ local cached_features = { ["darwin"] = vim.fn.has "mac", ["unix"] = vim.fn.has "unix", ["linux"] = vim.fn.has "linux", + ["nvim-0.11"] = vim.fn.has "nvim-0.11", } ---@type fun(env: string): boolean @@ -104,7 +105,7 @@ local check_env = _.memoize(_.cond { M.is = setmetatable({}, { __index = function(__, key) local os, arch, env = unpack(vim.split(key, "_", { plain = true })) - if not cached_features[os] or cached_features[os] ~= 1 then + if not M.cached_features[os] or M.cached_features[os] ~= 1 then return false end if arch and arch ~= M.arch then -- cgit v1.2.3-70-g09d2