How to use Visual Studio Code with the Pylance extension in a poetry2nix.mkPoetryEnv
shell:
Run code .
from the shell. Then CtrlShiftP, choose the command Python: Select interpreter, and select a python
from the /nix/store
.
How to use Visual Studio Code with the Pylance extension in a poetry2nix.mkPoetryEnv
shell:
Run code .
from the shell. Then CtrlShiftP, choose the command Python: Select interpreter, and select a python
from the /nix/store
.
This does not seem to work for me. Some of the dependencies are recognized, but others are not. It seems the ones recognized are those with their own entry in PYTHONPATH
instead of being symlinked into the site-packages
folder of the python environment, but manually adding them to the PYTHONPATH
did not help either.
This seems to be specifically a Pylance problem, because importing the modules in Python works normally, and Jedi also manages to give me code completion for the modules.
Addendum:
Each new nix develop
shell will create a new environment which VS Code will remember in its history. When you Python: Select interpreter, the correct current environment selection includes the string -env
and always appears in this third position in the environment list. For me, anyway.