nvim: Add check for local .venv python dir
This commit is contained in:
parent
8b5e4dc097
commit
90161be418
1 changed files with 7 additions and 2 deletions
|
|
@ -64,6 +64,11 @@ function T.get_python_venv_basefolder(workspace)
|
|||
return venv_path_cached
|
||||
end
|
||||
local match
|
||||
match = vim.fn.finddir(".venv", "**1")
|
||||
if match ~= "" then
|
||||
venv_path_cached = match
|
||||
return venv_path_cached
|
||||
end
|
||||
-- Look downwards for file, can be nested. Limit to 1 depth for speed rn
|
||||
-- TODO: Maybe not hardcode 1-depth but allow choice.
|
||||
match = vim.fn.findfile("pyvenv.cfg", "**1")
|
||||
|
|
@ -79,8 +84,8 @@ function T.get_python_venv_basefolder(workspace)
|
|||
if obj.code ~= 0 then
|
||||
return
|
||||
end
|
||||
local venv_base_folder = obj.stdout:match("^%s*(.-)%s*$")
|
||||
venv_path_cached = venv_base_folder
|
||||
match = obj.stdout:match("^%s*(.-)%s*$")
|
||||
venv_path_cached = match
|
||||
return venv_path_cached
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue