telescope-project.nvim
telescope-project.nvim copied to clipboard
Crash when switching to a non-existent project
When we try to switch to a non-existent project, the plugin crashes. I think it would be nice to handle such cases and display a warning message to the user.
To reproduce:
- Open
telescope-project
and enter the name of some non-existent project: - Press
Enter
to see the crash:
E5108: Error executing lua ...oject.nvim/lua/telescope/_extensions/project/actions.lua:18: attempt to index a nil value
stack traceback:
...oject.nvim/lua/telescope/_extensions/project/actions.lua:18: in function 'get_selected_path'
...oject.nvim/lua/telescope/_extensions/project/actions.lua:101: in function 'run_replace_or_original'
...nvim/plugged/telescope.nvim/lua/telescope/actions/mt.lua:30: in function 'find_project_files'
...-project.nvim/lua/telescope/_extensions/project/main.lua:73: in function 'run_replace_or_original'
...nvim/plugged/telescope.nvim/lua/telescope/actions/mt.lua:30: in function 'key_func'
...e/nvim/plugged/telescope.nvim/lua/telescope/mappings.lua:235: in function 'execute_keymap'
[string ":lua"]:1: in main chunk
It seems, that we could modify the M.get_selected_title
and M.get_selected_path
functions from actions.lua
to make them return a nil
value if there is no such project.