Skip to content

Commit ffa44ee

Browse files
committed
fix(lsp_finder): async multiple LSPs (closes #2703)
1 parent 58f52b7 commit ffa44ee

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lua/fzf-lua/providers/lsp.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ local function gen_lsp_contents(opts)
579579
utils.warn("%s[%s]: %s", tostring(client.name), lsp_handler.method, err)
580580
end
581581
end
582-
coroutine.resume(co, done, err, result, context, lspcfg)
582+
coroutine.resume(co --[[@as thread]], done, err, result, context, lspcfg)
583583
end)
584584
end
585585

@@ -599,7 +599,7 @@ local function gen_lsp_contents(opts)
599599
-- Only populate jump1 with the first entry
600600
if jump1 then jump1 = false end
601601
if x and jump1 == nil then jump1 = { result = x.result, encoding = x.encoding } end
602-
fzf_cb(e, function() coroutine.resume(co) end)
602+
fzf_cb(e, function() coroutine.resume(co --[[@as thread]]) end)
603603
coroutine.yield()
604604
end
605605
lsp_handler.handler(opts, cb, lsp_handler.method, result, context, lspcfg)
@@ -787,8 +787,10 @@ M.finder = function(opts)
787787
-- make sure we add only valid contents
788788
-- sync returns empty table when no results are found
789789
if type(c) == "function" then
790-
table.insert(contents,
791-
{ prefix = (p.prefix or "") .. (opts.separator or ""), contents = c })
790+
table.insert(contents, {
791+
prefix = (p.prefix or "") .. (opts.separator or ""),
792+
contents = vim.schedule_wrap(c)
793+
})
792794
end
793795
end
794796
end

0 commit comments

Comments
 (0)