fix: ensure telescope win is closed before calling callback

This commit is contained in:
Steven Arcangeli 2023-05-24 22:59:28 -07:00
parent 2f17eee4d7
commit f19cbd56f7
1 changed files with 5 additions and 0 deletions

View File

@ -67,6 +67,11 @@ M.select = function(config, items, opts, on_choice)
local finders = require("telescope.finders")
local conf = require("telescope.config").values
-- schedule_wrap because closing the windows is deferred
-- See https://github.com/nvim-telescope/telescope.nvim/pull/2336
-- And we only want to dispatch the callback when we're back in the original win
on_choice = vim.schedule_wrap(on_choice)
local entry_maker = function(item)
local formatted = opts.format_item(item)
return {