Closed wonderturtle closed 11 months ago
Hmm, can you show me what you have in your plugin config? Will try to see what it can be. :)
And yes, wildcards would be nice in venv names. I think I could support regexp expressions here but need to look into it a bit.
A possible idea could be to "detect" virtual environment folders basing on the folder structure and contents. This could allow to present a very accurate choice list for target environments
I would like to be able to use wildcards in specifying the env list in name={"venv","venv_*"}
if anyway I hardcode my venvname there, I get an error apparently related to missing write privileges on a folder which appears writable.
E5108: Error executing lua Vim:E482: Can't open file %APPDATA%\venv-selector\venvs.json for writing: no such file or directory stack traceback: [C]: in function 'writefile' ...-data/lazy/venv-selector.nvim/lua/venv-selector/venv.lua:303: in function 'cache_venv' ...-data/lazy/venv-selector.nvim/lua/venv-selector/venv.lua:207: in function 'activate_venv' .../lazy/venv-selector.nvim/lua/venv-selector/telescope.lua:76: in function 'key_func' ...nvim-data/lazy/telescope.nvim/lua/telescope/mappings.lua:352: in function 'execute_keymap' [string ":lua"]:1: in main chunk Press ENTER or type command to continue``` Any hints?
I reproduced this issue, while selecting the venv_mfa project of ours (I work with Klaudija aka wonderturtle) on a windows desktop.
![]()
plugin config is straightforward from your sample
return { "linux-cultist/venv-selector.nvim", dependencies = { "neovim/nvim-lspconfig", "nvim-telescope/telescope.nvim" }, keys = {{ "<leader>vs", "<cmd>:VenvSelect<cr>", "<leader>vc", "<cmd>:VenvSelectCached<cr>" }}, config = function() require("venv-selector").setup({ auto_refresh = false, search_venv_managers = true, search_workspace = true, search = true, dap_enabled = false, parents = 2, name = {"venv","venv_mfa","venv_nvim"}, -- NOTE: You can also use a lua table here for multiple names: {"venv", ".venv"}` fd_binary_name = "fd", notify_user_on_activate = true, }) end; event = "VeryLazy", }
i thought this had to do with the fact that we launch neovim from its own python environment, but this is not the case. Error comes also if nvim is lauched without its venv being activated.
The error should be fixed now thanks to https://github.com/linux-cultist/venv-selector.nvim/pull/32 but that wasnt related to the virtual environment names.
So lets keep this issue open so someone (maybe me) can add regular expression possibility here for the venv names.
This idea with regular expressions has come up more than once now, and I think it would be a good idea. I will close this issue and open another issue for the regular expression idea.
Lua is not great at regular expressions though but maybe there is a way.
I would like to be able to use wildcards in specifying the env list in name={"venv","venv_*"}
if anyway I hardcode my venvname there, I get an error apparently related to missing write privileges on a folder which appears writable.