mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
feat(picker.finder): added assertions that finder is still running when receiving results
This commit is contained in:
parent
0760abd293
commit
a45503b957
1 changed files with 15 additions and 0 deletions
|
|
@ -141,6 +141,8 @@ function M:run(picker)
|
|||
return
|
||||
end
|
||||
|
||||
local running = true
|
||||
|
||||
collectgarbage("stop") -- moar speed
|
||||
---@cast finder snacks.picker.finder.async
|
||||
---@diagnostic disable-next-line: await-in-sync
|
||||
|
|
@ -151,6 +153,18 @@ function M:run(picker)
|
|||
if #self.items >= limit then
|
||||
return self.task:abort()
|
||||
end
|
||||
if not running then
|
||||
Snacks.debug.backtrace({
|
||||
"Finder yielded after done. This is a bug.",
|
||||
("- aborted: `%s`"):format(self.task:aborted() or false),
|
||||
"",
|
||||
"# Backtrace",
|
||||
}, {
|
||||
level = vim.log.levels.ERROR,
|
||||
title = "Snacks Picker Finder",
|
||||
})
|
||||
return
|
||||
end
|
||||
add(item)
|
||||
picker.matcher.task:resume()
|
||||
yield = yield or Async.yielder(YIELD_FIND)
|
||||
|
|
@ -162,6 +176,7 @@ function M:run(picker)
|
|||
picker.matcher.task:resume()
|
||||
picker:update()
|
||||
end
|
||||
running = false
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue