I have 2 problems. Here was my set-up. I have all of my respositories in ~/dev/, and I had all of my Python virtualenvs in ~/virtualenvs/. This worked OK, but one annoying thing was that it was difficult to switch between virtualenvs, because for some reason VSCode doesn't automatically see where all of my virtualenvs are (which were in ~/virtualenvs/), and I had to enter the full path to the Python executable of my virtualenv every single time. So my first question is, is there a way to tell VSCode where to go and search for virtualenvs?
In order to solve this I started making my virtualenvs inside the repositories themselves, correspondingly. So, in ~/dev/project_1 I'd have ~/dev/project_1/project_1.virtualenv, and inside ~/dev/project_2 I'd have ~/dev/project_2/project_2.virtualenv, and so forth, and both ~/dev/project_1 and ~/dev/project_2 and other projects will be in my workspace. However, VSCode now starts trying to analyse all of the python modules inside those virtualenvs, tens of thousands of files. This is despite my trying to stop it from doing it using Pylance exclude settings. So my second question is, how do I stop VSCode from analysing my virtualenvs?
Answers to either or both of my problems would be much appreciated.
EDIT (the answer):
It was my mistake. I have a pyrightconfig.json file that overrides any code analysis setting in VSCode. All I had to do is to add .venv to the ignore-list in pyrightconfig.json and everything works fine now.
code path/to/code), so that it inherits the venv's setup.