ibhagwan/fzf-lua

Bug: `:FzfLua awesome_colorschemes` stack overflow

Closed this issue · 2 comments

RTFM Checklist

  • I have searched exisiting issues / discussions
  • I have read the Wiki including the Advanced section
  • I have read man fzf / I am well versed in shell fzf

Operating system

archlinux (Linux arch 6.10.3-zen1-2-zen #1 ZEN SMP PREEMPT_DYNAMIC Tue, 06 Aug 2024 07:47:21 +0000 x86_64 GNU/Linux )

Shell

fish, version 3.7.1

Neovim version (nvim --version)

NVIM v0.11.0-dev-605+g51d495f22

Fzf version (fzf --version)

0.54.3 (af4917db)

Output of :lua print(os.getenv('FZF_DEFAULT_OPTS'))

nil

Is the problem reproducible with mini.sh?

  • My issue is reproducible with mini.sh
  • My issue IS NOT reproducible with mini.sh
  • I have not tested with mini.sh (not relevant, requires LSP, Windows, etc)

Fzf-lua configuration

require('fzf-lua').setup({
})

Describe the bug / steps to reproduce

:FzfLua awesome_colorschemes<cr> failed with:

Error executing Lua callback: ...nvim/site/pack/vendor/start/fzf-lua/lua/fzf-lua/core.lua:242: ...vim/site/pack/vendor/start/fzf-lua/lua/fzf-lua/utils.lua:372: stack overflow

stack traceback:
        [builtin#36]: at 0x7de6301d90f0
        ...nvim/site/pack/vendor/start/fzf-lua/lua/fzf-lua/core.lua:242: in function <...nvim/site/pack/vendor/start/fzf-lua/lua/fzf-lua/core.lua:221>
        .../nvim/site/pack/vendor/start/fzf-lua/lua/fzf-lua/cmd.lua:35: in function 'run_command'
        ...p/nvim/site/pack/vendor/start/fzf-lua/plugin/fzf-lua.lua:12: in function <...p/nvim/site/pack/vendor/start/fzf-lua/plugin/fzf-lua.lua:11>

bisect to 61d7f17

Here is a weird workaround for me...

diff --git lua/fzf-lua/core.lua lua/fzf-lua/core.lua
index 54f94bf..6e95120 100644
--- lua/fzf-lua/core.lua
+++ lua/fzf-lua/core.lua
@@ -220,9 +220,10 @@ end
 ---@return thread
 M.fzf_wrap = function(opts, contents, fn_selected)
   opts = opts or {}
+  local _co
   coroutine.wrap(function()
-    opts._co = coroutine.running()
-    if type(opts.cb_co) == "function" then opts.cb_co(opts._co) end
+    _co = coroutine.running()
+    if type(opts.cb_co) == "function" then opts.cb_co(_co) end
     opts.fn_selected = opts.fn_selected or fn_selected
     local selected = M.fzf(contents, opts)
     if opts.fn_selected then
@@ -240,7 +241,7 @@ M.fzf_wrap = function(opts, contents, fn_selected)
       end)
     end
   end)()
-  return opts._co
+  return _co
 end
 
 -- conditionally update the context if fzf-lua

Ty for the troubleshooting @phanen! I'd still like to understand what in awesome_colorschemes causes this to stack overflow vs other pickers with no issues...

Strange case, whatever, nobody really needs the internal opts._co anyways, it was just a "bonus" :-)