linux-cultist / venv-selector.nvim

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

Add context-aware sorting of results #131

Closed linux-cultist closed 4 weeks ago

linux-cultist commented 1 month ago

User feedback:

Some kind of sorting would be nice. I think in many cases you can pretty much infer what venv the user want to activate. If the current file is something like my_monorepo/my_project/src/__init__.py and my_monorepo/my_project/.venv exists then the users almost always wants to pick that over something like my_monorepo/my_other_project/.venv.

In the same way, if there was a poetry project called something like .../pypoetry/virtualenvs/my-project-... then that is almost certainly the on the users want to pick

I think this could be implemented by looking at what the currently opened file and directory is, and putting any results found in the same path at the top of the telescope viewer. Will experiment a bit with this.

linux-cultist commented 4 weeks ago

VenvSelect now should put venvs that are closer to the opened file or directory at the top of the list (after the activated venv).