@@ -81,13 +81,14 @@ M.get_current_venv = function()
8181 return current_venv
8282end
8383
84+
8485local get_venvs_for = function (base_path , source , opts )
8586 local venvs = {}
8687 if base_path == nil then
8788 return venvs
8889 end
8990 local paths = scan_dir (base_path , vim .tbl_extend (' force' , { depth = 1 , only_dirs = true , silent = true }, opts or {}))
90- for _ , path in ipairs (paths ) do
91+ for _ , path in pairs (paths ) do
9192 table.insert (venvs , {
9293 name = Path :new (path ):make_relative (base_path ),
9394 path = path ,
@@ -117,7 +118,7 @@ local get_conda_base_path = function()
117118 end
118119end
119120
120- local get_conda_base_env = function ()
121+ local get_conda_base_env = function ()
121122 local venvs = {}
122123 local path = os.getenv (" CONDA_EXE" )
123124 if path then
@@ -148,15 +149,33 @@ local get_pyenv_base_path = function()
148149 end
149150end
150151
152+ local to_set = function (some_list )
153+ local set = {}
154+ for _ , key in ipair (some_list ) do
155+ set [key ] = true
156+ end
157+ return set
158+ end
159+
151160M .get_venvs = function (venvs_path )
152161 local venvs = {}
153162 vim .list_extend (venvs , get_venvs_for (venvs_path , ' venv' ))
154- vim .list_extend (venvs , get_venvs_for (get_pixi_base_path (), ' pixi' ))
155- vim .list_extend (venvs , get_venvs_for (get_conda_base_path (), ' conda' ))
156- vim .list_extend (venvs , get_conda_base_env ())
157- vim .list_extend (venvs , get_venvs_for (get_micromamba_base_path (), ' micromamba' ))
158- vim .list_extend (venvs , get_venvs_for (get_pyenv_base_path (), ' pyenv' ))
159- vim .list_extend (venvs , get_venvs_for (get_pyenv_base_path (), ' pyenv' , { only_dirs = false }))
163+
164+ local ignore_envs = to_set (settings .ignore_envs_groups )
165+ if ignore_envs and not ignore_envs [' conda' ] then
166+ vim .list_extend (venvs , get_venvs_for (get_conda_base_path (), ' conda' ))
167+ vim .list_extend (venvs , get_conda_base_env ())
168+ end
169+ if ignore_envs and not ignore_envs [' pixi' ] then
170+ vim .list_extend (venvs , get_venvs_for (get_pixi_base_path (), ' pixi' ))
171+ end
172+ if ignore_envs and not ignore_envs [' micromamba' ] then
173+ vim .list_extend (venvs , get_venvs_for (get_micromamba_base_path (), ' micromamba' ))
174+ end
175+ if ignore_envs and not ignore_envs [' pyenv' ] then
176+ vim .list_extend (venvs , get_venvs_for (get_pyenv_base_path (), ' pyenv' ))
177+ vim .list_extend (venvs , get_venvs_for (get_pyenv_base_path (), ' pyenv' , { only_dirs = false }))
178+ end
160179 return venvs
161180end
162181
0 commit comments