linux-cultist / venv-selector.nvim

Allows selection of python virtual environment from within neovim
MIT License
378 stars 40 forks source link

Also search for hidden folders in the current directory on default #123

Closed rabinadk1 closed 1 month ago

rabinadk1 commented 1 month ago

The current defaults only search for the Python binary in non-hidden directories when searching in the current working directory. It ignores the folders like '.venv' and '.env', commonly used patterns to name a virtual environment when created using the command python3 -m venv .venv.

linux-cultist commented 1 month ago

This is actually intentional, but im still thinking about what should be default behavior here.

This is because on my system, there are tons of hidden files, including wine symlinks to different parts on the file system, and even links to NAS disks being mounted. Just to mention a few things.

So im worried about the use case where a user starts VenvSelect in $HOME and nothing shows up, and his CPU goes to 100% for a long time until he force quits neovim.

On the other hand, I really want the plugin to search for hidden files in CWD when its not $HOME.

Maybe a good default would be to warn the user if he tries to launch a search in $HOME, and have an option to enable it.

Or maybe just have VenvSelect kill the search if it doesn't finish in 10 seconds and tell the user it took too long and he should try a directory with less files.

linux-cultist commented 1 month ago

I added code to make VenvSelect stop on searches that take more than 5 seconds. Now I feel we can change the default search to include hidden files, since the plugin will complain if it leads to problems.