-
Notifications
You must be signed in to change notification settings - Fork 35
Description
The instructions added in aee3832 don't work in the presence of additional directories. Consider:
- libA
- pyproject.toml
- subDirA
- myfile.py
- libB
- pyproject.toml
when running on myfile.py I want the cwd to be libA, not subDirA. I think the correct value should be ${fileWorkspaceFolder} but this produces a crash before and after this patch.
It would also be good to log something better when this crash happens. Right now you just get
2024-01-24 10:04:59.330 [info] Server: Start requested.
2024-01-24 10:04:59.330 [info] [Error - 10:04:59 AM] Mypy Type Checker client: couldn't create connection to server.
2024-01-24 10:04:59.331 [info] Launching server using command python_monorepo/common/.venv/bin/python failed. Error: spawn python_monorepo/common/.venv/bin/python ENOENT
2024-01-24 10:04:59.331 [error] Server: Start failed: Launching server using command python_monorepo/common/.venv/bin/python failed. Error: spawn python_monorepo/common/.venv/bin/python ENOENT
This is a common thing when using multiple virtual environments as suggested in https://github.com/microsoft/vscode-python/wiki/Mono-Repo-Set%E2%80%90up-Guide#scenario-2-separate-virtual-environments. I think what we want is ${fileWorkspaceFolder} or ${workspaceFolder} -- I'm not sure because the docs are confusing. But we want the workspace folder to which the currently open file belongs.
https://code.visualstudio.com/docs/editor/variables-reference