fixed possibility of missed last result in more providers

main
bhagwan 3 years ago
parent dda1387536
commit 8813d5a5ea

@ -187,7 +187,14 @@ function M.setup(opts)
-- reset default window opts if set by user
fzf.default_window_options = config.winopts()
-- set the fzf binary if set by the user
if config.fzf_bin then fzf.fzf_binary = config.fzf_bin end
if config.fzf_bin then
if fzf.default_options ~= nil and
vim.fn.executable(config.fzf_bin) == 1 then
fzf.default_options.fzf_binary = config.fzf_bin
else
config.fzf_bin = nil
end
end
end
-- we usually send winopts with every fzf.fzf call

@ -87,7 +87,8 @@ local fzf_function = function (cb)
end
end
end
-- done
-- done, we can't call utils.delayed_cb here
-- because sleep() messes up the coroutine
cb(nil, function() end)
end)()
end

@ -144,10 +144,7 @@ local function set_lsp_fzf_fn(opts)
opts.lsp_handler.handler(opts, cb, co, result)
-- close the pipe to fzf, this
-- removes the loading indicator in fzf
-- HACK: slight delay to prevent missing results
-- otherwise the input stream closes too fast
vim.cmd("sleep! 10m")
cb(nil, function() end)
utils.delayed_cb(cb)
return
end
@ -407,8 +404,7 @@ M.diagnostics = function(opts)
-- coroutine.yield()
-- close the pipe to fzf, this
-- removes the loading indicator in fzf
vim.cmd("sleep! 10m")
cb(nil, function() end)
utils.delayed_cb(cb)
end)()
end

@ -59,7 +59,7 @@ M.oldfiles = function(opts)
cb(nil, function() end)
end)
end
cb(nil, function() end)
utils.delayed_cb(cb)
end
--[[ opts.cb_selected = function(_, x)

@ -36,7 +36,7 @@ local quickfix_run = function(opts, cfg, locations)
cb(nil, function() end)
end)
end
cb(nil, function() end)
utils.delayed_cb(cb)
end
--[[ opts.cb_selected = function(_, x)

@ -193,4 +193,11 @@ function M.send_ctrl_c()
vim.api.nvim_replace_termcodes("<C-c>", true, false, true), 'n', true)
end
function M.delayed_cb(cb)
-- HACK: slight delay to prevent missing results
-- otherwise the input stream closes too fast
vim.cmd("sleep! 10m")
cb(nil, function() end)
end
return M

Loading…
Cancel
Save