Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pylance does not allow me to navigate to the source code, bringing me to the .pyi stub instead

I am using pylance for vs code and it works really nice, except that since I use it, when I try to check code from an installed library, I can get only to the stub, I think generated by pylance.

For example, the information shown about the function:

Or, crtl + click on the function brings me to the .pyi stub, which at
~/.vscode-server/extensions/ms-python.vscode-pylance-2020.11.0/dist/bundled/stubs/pandas/io/parsers.pyi

I can't find a way to navigate to the actual code (of pandas in this case).

If I deactivate Pylance and use Microsoft as language server by setting "python.languageServer": "Microsoft", in setting.json, the navigation to the library works fine.

Is it possible to navigate to the actual code with pylance active?

OS: Ubuntu 18.04
Visual Studio Code: Version: 1.50.1
Pylance: v2020.11.0

like image 998
rpicatoste Avatar asked Jan 19 '26 09:01

rpicatoste


1 Answers

I had the same issue and realized I was using Docker. So I set up virtualenv and installed Django using pip. Then I switched Python interpreter in the bottom-left corner of VS Code and it started working.

I know this is a specific case but I hope this answer helps someone in the same problem.

enter image description here

like image 110
ohkts11 Avatar answered Jan 22 '26 04:01

ohkts11



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!