Open Morikko opened 1 year ago
I'm able to reproduce and believe this is an issue with how Jedi's Script.goto
logic prioritizes the Jedi-managed typeshed stubs.
Note: we don't use jedi.Interpreter
within the editing environment. Instead, we rely on jedi.Script
. See: https://jedi.readthedocs.io/en/latest/docs/api.html?highlight=interpreter#script
Expected vs. Actual
Expected: When Ctrl-clicking on a function from a given package, the editor opens the actual file in which the function definition is found in the virtual environment.
Actual: When Ctrl-clicking on a function from a given package, the editor opens the typeshed file matching the definition installed within the extension itself.
How to reproduce
(Using Flask here as an example)
python -m venv env
&&source env/bin/activate
The editor will bring up the typeshed in the extension directory,
~/.vscode-oss/extensions/ms-python.python-2023.4.1-universal/pythonFiles/lib/jedilsp/jedi/third_party/typeshed/third_party/2and3/flask/blueprints.pyi
instead of openingenv/lib64/python3.X/site-packages/flask/blueprints.py
, which is what eg. mypy will use to check the project against.The hover I see:
Technical details
The Flask v2 signature: https://github.com/pallets/flask/blob/main/src/flask/blueprints.py#L408
While it is the old Flask v1 here: https://github.com/davidhalter/typeshed/blob/jedi/third_party/2and3/flask/blueprints.pyi#L55
Jedi looks to act normally, so I believe the problem is how it is used by
jedi-language-server
:provide_automatic_options
parameter is present and only Flask v2.Note: The issue was originally open here: https://github.com/microsoft/vscode-python/issues/20988