nvim-telescope / telescope-file-browser.nvim

File Browser extension for telescope.nvim
MIT License
1.68k stars 92 forks source link

Error when loading directory preview #391

Closed gmmyung closed 4 months ago

gmmyung commented 4 months ago

Description

Error happens when loading directory preview

Neovim version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1710088188

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.5/share/nvim"

Run :checkhealth for more info

Operating system and version

macOS 14.4.1

Steps to reproduce

  1. nvim -nu minimal.lua
  2. :Telescope file_browser

Expected behavior

Telescope should show directory preview

Actual behavior

Error executing luv callback:
...yung/.repro/plugins/plenary.nvim/lua/plenary/scandir.lua:7: E5560: vimL function must not be called in a lua loop callback
stack traceback:
        [C]: in function 'has'
        ...yung/.repro/plugins/plenary.nvim/lua/plenary/scandir.lua:7: in function 'flatten'
        ...yung/.repro/plugins/plenary.nvim/lua/plenary/scandir.lua:214: in function 'scan_dir_async'
        ...yung/.repro/plugins/plenary.nvim/lua/plenary/scandir.lua:623: in function 'ls_async'
        ...scope.nvim/lua/telescope/previewers/buffer_previewer.lua:148: in function 'handle_directory_preview'
        ...scope.nvim/lua/telescope/previewers/buffer_previewer.lua:271: in function <...scope.nvim/lua/telescope/previewers/buffer_previewer.lua:266>
Press ENTER or type command to continue

Minimal config

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
endm

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "nvim-telescope/telescope-file-browser.nvim",
    dependencies = {
      "nvim-telescope/telescope.nvim",
      "nvim-lua/plenary.nvim",
    },
    config = function()
      require("telescope").setup({})
      require("telescope").load_extension("file_browser")
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})
Mmasson-01 commented 4 months ago

I have the same problem since a recent update running on Macbook Pro M1 (Sonoma 14.4.1).

Neovim version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1710088188

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.5/share/nvim"

Run :checkhealth for more info
GeorgiChochev commented 4 months ago

I've been getting the same problem starting today after updating the plugins

NVIM v0.10.0-dev-2066+g1813661a6
Build type: RelWithDebInfo
LuaJIT 2.1.1703358377
Run "nvim -V1 -v" for more info
jamestrew commented 4 months ago

Looks like an issue upstream in plenary related to the recent neovim 0.10 API breaking changes fix. I'll try to create a ticket for it over on plenary and link it here later today. Until that's merged, the easiest thing might be to downpatch neovim to pre-release neovim 0.10 (or stick with 0.9.5) and freeze plenary 2 commits back.

jamestrew commented 4 months ago

Looks like it got fixed by https://github.com/nvim-lua/plenary.nvim/pull/589