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
|
return venv_path_cached
|
||||||
end
|
end
|
||||||
local match
|
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
|
-- Look downwards for file, can be nested. Limit to 1 depth for speed rn
|
||||||
-- TODO: Maybe not hardcode 1-depth but allow choice.
|
-- TODO: Maybe not hardcode 1-depth but allow choice.
|
||||||
match = vim.fn.findfile("pyvenv.cfg", "**1")
|
match = vim.fn.findfile("pyvenv.cfg", "**1")
|
||||||
|
|
@ -79,8 +84,8 @@ function T.get_python_venv_basefolder(workspace)
|
||||||
if obj.code ~= 0 then
|
if obj.code ~= 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local venv_base_folder = obj.stdout:match("^%s*(.-)%s*$")
|
match = obj.stdout:match("^%s*(.-)%s*$")
|
||||||
venv_path_cached = venv_base_folder
|
venv_path_cached = match
|
||||||
return venv_path_cached
|
return venv_path_cached
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue