nvim: Refactor automatic py venv call

This commit is contained in:
Marty Oehme 2023-06-20 16:16:01 +02:00
parent 1c8c5ca6d9
commit 1665dd6cf6
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
3 changed files with 9 additions and 5 deletions

View file

@ -126,9 +126,10 @@ local lspconfig = require("lspconfig")
-- ensure python virtualenv is determined automatically on lsp start
lspconfig.pyright.setup({
on_attach = function(client, _)
local python_path, msg = require("util.pyenv").get_path(client.config.root_dir)
vim.notify(string.format("%s\n%s", msg, python_path))
on_attach = function(client, bufnr)
on_attach(client, bufnr)
local python_path, msg = require("util").get_python_venv(client.config.root_dir)
vim.notify_once(string.format("[PYTHON VENV]\n%s", python_path))
client.config.settings.python.pythonPath = python_path
end,
})