nvim: Split python venv fetching into multiple
Now we can either fetch the python venv basefolder
(`require('core.util').get_python_venv_basefolder()`) or specifically
the python binary contained within (`.get_python_bin()`).
Additionally, the venv result should be cached for the duration of using
nvim so that we only have to fetch it once, regardless of how many
modules require it.
This commit is contained in:
parent
4f5445cc0e
commit
0bac43eb91
2 changed files with 24 additions and 10 deletions
|
|
@ -167,7 +167,7 @@ local python_path
|
|||
lspconfig.basedpyright.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
if python_path == nil then
|
||||
python_path, _ = require("core.util").get_python_venv(client.config.root_dir)
|
||||
python_path, _ = vim.fn.expand(require("core.util").get_python_venv_bin(client.config.root_dir))
|
||||
end
|
||||
-- print(string.format("[PYTHON VENV]: %s", vim.inspect(python_path)))
|
||||
client.config.settings.python = {} or client.config.settings.python
|
||||
|
|
@ -179,7 +179,7 @@ lspconfig.ruff_lsp.setup({
|
|||
on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
if python_path == nil then
|
||||
python_path, _ = require("core.util").get_python_venv(client.config.root_dir)
|
||||
python_path, _ = vim.fn.expand(require("core.util").get_python_venv_bin(client.config.root_dir))
|
||||
end
|
||||
client.config.settings.python = {} or client.config.settings.python
|
||||
client.config.settings.python.pythonPath = python_path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue