Closed kuator closed 1 month ago
Yes, but this plugin is for switching between venvs dynamically. But maybe you are suggesting that the plugin would pick up whatever is in pyrightconfig.json
if its in the current working directory?
Yes, but this plugin is for switching between venvs dynamically. But maybe you are suggesting that the plugin would pick up whatever is in
pyrightconfig.json
if its in the current working directory?
Yes. pyrgithtconfig.json
file is located at the root of the project most of the time, that's why picking up virtual environment for it would make sense, in my opinion
I went for a slightly different solution here, but one that i think works equally well.
VenvSelect in the regexp
branch remembers what python you have picked for each working directory, and activates it automatically the next time you open a python file in that directory.
I felt this was a better solution since its not depending on parsing any files, and it will work for any lsp, not just pyright.
If you want to give it a try, here is some instructions for the new branch:
Configuration for lazy.nvim:
return {
"linux-cultist/venv-selector.nvim",
dependencies = {
"neovim/nvim-lspconfig",
"mfussenegger/nvim-dap", "mfussenegger/nvim-dap-python", --optional
{ "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } },
},
lazy = false,
branch = "regexp", -- This is the regexp branch, use this until its merged with the main branch later
config = function()
require("venv-selector").setup()
end,
keys = {
{ ",v", "<cmd>VenvSelect<cr>" },
},
},
Closing this since regexp branch will remember the activated venv for a specific directory. Please try it. :)
Closing this since regexp branch will remember the activated venv for a specific directory. Please try it. :)
Thank, will do
Pyright and Pylance have a
pyrightconfig.json
which can be used to determine venv location. Samplepyrightconfig.json