Open
Conversation
AckslD
reviewed
Mar 9, 2024
lua/swenv/api.lua
Outdated
| vim.list_extend(venvs, get_venvs_for(get_pyenv_base_path(), 'pyenv', { only_dirs = false })) | ||
|
|
||
| local ignore_envs = to_set(settings.ignore_envs_groups) | ||
| if ignore_envs and not ignore_envs['conda'] then |
Owner
There was a problem hiding this comment.
Suggested change
| if ignore_envs and not ignore_envs['conda'] then | |
| if not ignore_envs['conda'] then |
wouldn't this work as well?
|
|
||
| local ignore_envs = to_set(settings.ignore_envs_groups) | ||
| if ignore_envs and not ignore_envs['conda'] then | ||
| vim.list_extend(venvs, get_venvs_for(get_conda_base_path(), 'conda')) |
Owner
There was a problem hiding this comment.
Just to structure things a bit more, what do you think about moving this to a module level table such as:
local venvs_getters = {
conda = function()
local venvs = {}
vim.list_extend(venvs, get_venvs_for(get_conda_base_path(), 'conda'))
vim.list_extend(venvs, get_conda_base_env())
return venvs
end,
pixi = function()
return get_venvs_for(get_pixi_base_path(), 'pixi')
end,
micromamba = function()
return get_venvs_for(get_micromamba_base_path(), 'micromamba')
end,
pyenv = function()
local venvs = {}
vim.list_extend(venvs, get_venvs_for(get_pyenv_base_path(), 'pyenv'))
vim.list_extend(venvs, get_venvs_for(get_pyenv_base_path(), 'pyenv', { only_dirs = false }))
return venvs
end,
}and then this main function could be something like:
for name, getter in pairs(venvs_getters) do
if not ignore_envs[name] then
vim.list_extend(venvs, getter())
end
end
Author
There was a problem hiding this comment.
May be, may be... Extract this table and venv_getters file ("venv_profiles"), ore some thing other?
Owner
There was a problem hiding this comment.
Sorry, not fully sure what you're asking?
8412c04 to
b90189d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The author of the plugin noted that the support of many different groups of virtual environments can negatively affect the performance of the plugin. In this regard, I added the "ignore_envs_groups" parameter. this is a table that should contain rows with the names of virtual environment groups. By default, the table is empty so as not to break the backward compatibility of the plugin. But anyone can add to this variable all the groups of environments that they do not use, thereby saving the plugin time.