mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-05 03:08:13 +00:00
fix(picker.lsp): use async from ctx
This commit is contained in:
parent
b24886c995
commit
b878caaddc
2 changed files with 3 additions and 28 deletions
|
@ -216,30 +216,4 @@ function M.multi(finders)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param finder snacks.picker.finder
|
|
||||||
---@param transform snacks.picker.transform
|
|
||||||
---@return snacks.picker.finder
|
|
||||||
function M.wrap(finder, transform)
|
|
||||||
return function(opts, filter, picker)
|
|
||||||
local find = finder(opts, filter, picker)
|
|
||||||
return function(cb, task)
|
|
||||||
---@param item snacks.picker.finder.Item
|
|
||||||
local function add(item)
|
|
||||||
local t = transform(item)
|
|
||||||
if t ~= false then
|
|
||||||
cb(type(t) == "table" and t or item)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if type(find) == "table" then
|
|
||||||
---@cast find snacks.picker.finder.Item[]
|
|
||||||
for _, item in ipairs(find) do
|
|
||||||
add(item)
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
find(add, task)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
---@diagnostic disable: await-in-sync
|
||||||
local Async = require("snacks.picker.util.async")
|
local Async = require("snacks.picker.util.async")
|
||||||
|
|
||||||
---@module 'uv'
|
---@module 'uv'
|
||||||
|
@ -336,8 +337,8 @@ function M.symbols(opts, ctx)
|
||||||
vim.defer_fn(function()
|
vim.defer_fn(function()
|
||||||
vim.api.nvim_del_autocmd(id)
|
vim.api.nvim_del_autocmd(id)
|
||||||
end, 10000)
|
end, 10000)
|
||||||
return function(_, async)
|
return function()
|
||||||
async:sleep(2000)
|
ctx.async:sleep(2000)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue