-
Notifications
You must be signed in to change notification settings - Fork 31
Support local venv dirs #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
lua/swenv/project.lua
Outdated
| return get_local_env(venv_path) | ||
| end | ||
| if not file then | ||
| if isdir(venv_path) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if isdir(venv_path) is true shouldn't the above line already have returned so no need for this statement here?
| local file = io.open(project_dir .. '/.venv', 'r') -- r read mode | ||
| M.get_project_venv_data = function(project_dir) | ||
| local venv_path = project_dir .. '/.venv' | ||
| local file = io.open(venv_path, 'r') -- r read mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe move this below the if-statement since it's not needed if the body is executed
lua/swenv/project.lua
Outdated
| -- Get the name from a `.venv` file in the project root directory. | ||
| M.read_venv_name = function(project_dir) | ||
| local file = io.open(project_dir .. '/.venv', 'r') -- r read mode | ||
| M.get_project_venv_data = function(project_dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function is now a bit strange, it either returns a string or a table? Would be better to have a single return type
lua/swenv/api.lua
Outdated
| local closest_match = best_match(venvs, project_venv_name) | ||
| if type(venv_data) == type({}) then | ||
| vim.list_extend(venvs, venv_data) | ||
| set_venv(venv_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nicer if this and the below could be unified, see my comment about the return type of get_project_venv_data
e689014 to
5f66f35
Compare
|
Hi @palandovalex, let me know when you want me to take another look. Just fyi I will assume you're still working on the PR until you reply to the comments :) |
|
@palandovalex I am also interested in this. Let me know if you need support to finalize the PR by addressing @AckslD comments. I can spend sometime on this in the next 1-2 weeks. |
#32
solved