mirror of
https://github.com/kristoferssolo/telescope-frecency.nvim.git
synced 2025-10-21 20:10:38 +00:00
fix: detect async context more robustly (#254)
This commit is contained in:
parent
476f70e1b0
commit
38f2a2207e
@ -21,7 +21,8 @@ local frecency = setmetatable({}, {
|
||||
return function(...)
|
||||
if not instance() then
|
||||
rawset(self, "instance", require("frecency.klass").new())
|
||||
instance():setup()
|
||||
local is_async = key == "delete" or key == "validate_database" or key == "register"
|
||||
instance():setup(is_async)
|
||||
end
|
||||
return instance()[key](instance(), ...)
|
||||
end
|
||||
|
||||
@ -23,8 +23,9 @@ Frecency.new = function()
|
||||
end
|
||||
|
||||
---This is called when `:Telescope frecency` is called at the first time.
|
||||
---@param is_async boolean
|
||||
---@return nil
|
||||
function Frecency:setup()
|
||||
function Frecency:setup(is_async)
|
||||
---@async
|
||||
local function init()
|
||||
timer.track "init() start"
|
||||
@ -36,7 +37,6 @@ function Frecency:setup()
|
||||
timer.track "init() finish"
|
||||
end
|
||||
|
||||
local is_async = not not coroutine.running()
|
||||
if is_async then
|
||||
init()
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user