project.nvim icon indicating copy to clipboard operation
project.nvim copied to clipboard

attempt to call field 'file_browser' (a nil value)

Open alisonjenkins opened this issue 3 years ago • 3 comments

Hey @ahmedkhalf,

Thanks for developing project.nvim it is one of my favourite Neovim plugins. I just attempted to try out the shortcut for browsing a project's files but got hit with the following:

E5108: Error executing lua ...tart/project.nvim/lua/telescope/_extensions/projects.lua:97: attempt to call field 'file_browser' (a nil value)
stack traceback:
        ...tart/project.nvim/lua/telescope/_extensions/projects.lua:97: in function 'key_func'
        ...k/packer/start/telescope.nvim/lua/telescope/mappings.lua:242: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk

Is there a dependency that is required for the file_browser?

My Neovim config is at https://github.com/alanjjenkins/chezmoi-dotfiles/tree/master/private_dot_config/nvim if you want to look at it.

Thanks,

Alan Jenkins

alisonjenkins avatar May 31 '22 05:05 alisonjenkins

I've installed nvim-telescope/telescope-file-browser.nvim and enabled it with telescope.load_extension("file_browser") but I still have the following error:

E5108: Error executing lua ...tart/project.nvim/lua/telescope/_extensions/projects.lua:97: attempt to c
all field 'file_browser' (a nil value)
stack traceback:
        ...tart/project.nvim/lua/telescope/_extensions/projects.lua:97: in function 'key_func'
        ...k/packer/start/telescope.nvim/lua/telescope/mappings.lua:242: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk

So I looked into the code:

local function browse_project_files(prompt_bufnr)
  local project_path, cd_successful = change_working_directory(prompt_bufnr, true)
  local opt = {
    cwd = project_path,
    hidden = config.options.show_hidden,
  }
  if cd_successful then
    builtin.file_browser(opt)
  end
end

still not sure why it's throwing error though. I think telescope.load_extension("file_browser") is not needed.

kohane27 avatar Jun 08 '22 06:06 kohane27

Experiencing the same issue here in Lunarvim (most recent version). If I open projects through :Telescope projects and then hit <C-b>, I get this error message;

E5108: Error executing lua ...tart/project.nvim/lua/telescope/_extensions/projects.lua:97: attempt to call field 'file_browser' (a nil value)
stack traceback:
        ...tart/project.nvim/lua/telescope/_extensions/projects.lua:97: in function 'key_func'
        ...k/packer/start/telescope.nvim/lua/telescope/mappings.lua:242: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk

onno-schuit avatar Jul 15 '22 13:07 onno-schuit

Telescope moved file browser into a seperate repository, which changes how you open the file browser from lua. It's fixed in https://github.com/ahmedkhalf/project.nvim/pull/59, we are just waiting for merge.

gepbird avatar Jul 29 '22 22:07 gepbird