Closed rogeriofrsouza closed 9 months ago
Thanks for reporting, I can replicate this. Let me take a look.
After a little bit of digging, it looks like this bug existed ever since this option was added. Probably says something about how few people use it :smile:.
What do you think is the expected behavior? Simply open the file directly or open the folder regularly (option to only collapse directories to the last directory)?
I'm leaning collapsing only directory (option B) since I think that falls closer in line with the name of the option.
In hindsight, I'm not sure this option should really exist though. Seems useful, until you want to create a file/folder in one of the child folders that were collapse. Then suddenly you need to relaunch telescope disabling collapse_dirs
or use another file browser.
I think it should open the folder regularly, this avoids some key presses when browsing in a Java project from root directory 😄
However, how you mentioned, it seems useful while browsing but would make it harder to manage files/directories directly. I've been using another plugin for that!
I agree with removing this option but I'm not certain if this may be useful in another situation or a different kind of project.
I've been going back and forth about keeping this option. Considering we have the folder browser (<C-f>
by default after :Telescope file_browser
, or :Telescope file_browser files=false
), it feels redundant since that let's you open any child directory directly.
I'm leaning on deprecating it eventually. But for now, I've put in a fix for this bug making it so it opens folders regularly if it only has one file.
Description
I did setup collapse_dirs to true and an annoying bug is happening every time I open a directory with a single file inside.
I am currently using LazyVim 10.8.2 (2023-11-30) with
telescope
andtelescope-file-browser
plugins updated to the last version.My
telescope.lua
is:And
telescope-file-browser.lua
:Neovim version
Operating system and version
Manjaro Linux x86_64 - 6.1.69-1-MANJARO
Steps to reproduce
nvim -nu minimal.lua
:Telescope file_browser
Expected behavior
Open the selected directory and show the contained file without crashing the plugin.
Actual behavior
This is the actual behavior, it shows this error output message and crashes the plugin.
Minimal config