linux-cultist / venv-selector.nvim

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

Can't select an venv when mypy is installed inside of it #109

Closed smorokin closed 1 month ago

smorokin commented 3 months ago

Hi,

when mypy is installed the plugin only list the venv folder inside the mypy package instead of the containing venv.

Example:

~/project/venv/lib/python3.11/site-packages/mypy/typeshed/stdlib/venv

is available in the list instead of

~/project/venv

which is not available at all.

A workaround is to use a different name for the venv, e.g. .venv and changing your settings accordingly.

linux-cultist commented 2 months ago

I'm working on a new version of the plugin where regular expressions can be used to filter out exactly what you want. The current version of the plugin is a bit buggy since supporting all the different venv managers have required a lot of edge cases.

The new version is all about using fd with regular expressions to filter out what you want. If you want to try it out already, you can grab the regexp branch of the plugin and read the Readme for a quick example how to configure it.

It's still under development and not released yet, but I expect it to be done in a few weeks.

smorokin commented 2 months ago

Thank you, @linux-cultist, that sounds very good! I will try it next week!

smorokin commented 1 month ago

Currently the regexp branch is not working for me - it throws vim/lazy/venv-selector.nvim/lua/venv-selector/search.lua:81: attempt to concatenate local 'job_name' (a nil value)

linux-cultist commented 1 month ago

Ok, thanks for testing it.

I will add a lot more debug output so I can see whats wrong. Are you on linux/mac? And what does your config look like?

smorokin commented 1 month ago

I use Linux and AstroNvim - it is still the "default config", but I don't think it is a good idea to test it with that first.

linux-cultist commented 1 month ago

I think this may be fixed now, please try the regexp branch again.

smorokin commented 1 month ago

You fixed it, @linux-cultist! Thank you very much!

linux-cultist commented 1 month ago

Very good :)

Make sure to have a look at the readme in the regexp branch often since things change quite a lot. I added callback functions just now so if you want the telescope results to look different, you can use that... :)