nvim-telescope / telescope-project.nvim

MIT License
583 stars 53 forks source link

Can't call two actions in on_project_selected #134

Closed alexhuot1 closed 1 year ago

alexhuot1 commented 1 year ago

Hi, Disclamer: I'm a total noob on vim/neovim/lua/etc!

I'm trying to setup telescope-project so that when a project is selected the folder is set as the CWD and find_files opens (default behavior):

local telescope = require('telescope')
local _actions = require("telescope._extensions.project.actions")

telescope.setup {
 ...
  extensions = {
    project = {
      hidden_files = true, -- default: false
      order_by = "asc",
      search_by = "title",
      on_project_selected = function(prompt_bufnr)
        _actions.find_project_files(prompt_bufnr, false)
        _actions.change_working_directory(prompt_bufnr, false)
      end
    },
    ...
  }
}

When I select a project I get this error:

E5108: Error executing lua ...-data/lazy/telescope.nvim/lua/telescope/actions/init.lua:343: attempt to index local 'picker' (a nil value)
stack traceback:
        ...-data/lazy/telescope.nvim/lua/telescope/actions/init.lua:343: in function 'run_replace_or_original'
        ...im-data/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'close'
        ...oject.nvim/lua/telescope/_extensions/project/actions.lua:170: in function 'run_replace_or_original'
        ...im-data/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'change_working_directory'
        C:/Users/huotalex/AppData/Local/nvim/lua/alex/telescope.lua:42: in function 'on_project_selected'
        ...-project.nvim/lua/telescope/_extensions/project/main.lua:90: in function 'run_replace_or_original'
        ...im-data/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
        ...nvim-data/lazy/telescope.nvim/lua/telescope/mappings.lua:352: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk

Clearly, I'm doing something wrong, can someone help me out?

Thanks!