diff --git a/nvim/.config/nvim/lua/plugins/config/lsp.lua b/nvim/.config/nvim/lua/plugins/config/lsp.lua index 25ae1cb..d3b6704 100644 --- a/nvim/.config/nvim/lua/plugins/config/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/config/lsp.lua @@ -126,15 +126,29 @@ lsp.setup({ local lspconfig = require("lspconfig") +local python_path -- ensure python virtualenv is determined automatically on lsp start lspconfig.pyright.setup({ on_attach = function(client, bufnr) - on_attach(client, bufnr) - local python_path, _ = require("util").get_python_venv(client.config.root_dir) - vim.notify_once(string.format("[PYTHON VENV]\n%s", python_path)) + if python_path == nil then + python_path, _ = require("util").get_python_venv(client.config.root_dir) + end + print(string.format("[PYTHON VENV]: %s", vim.inspect(python_path))) client.config.settings.python.pythonPath = python_path + on_attach(client, bufnr) end, }) +lspconfig.ruff_lsp.setup({ + on_attach = function(client, bufnr) + if python_path == nil then + python_path, _ = require("util").get_python_venv(client.config.root_dir) + end + print(string.format("[PYTHON VENV]: %s", vim.inspect(python_path))) + client.config.settings.python.pythonPath = python_path + on_attach(client, bufnr) + end, +}) + -- set up arduino with the help of arduino.nvim plugin if require("util").is_available("arduino") then lspconfig.arduino_language_server.setup({