Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Goto definition goes to stub files instead of actual definitions #949

Closed
ewerybody opened this issue Feb 13, 2021 · 7 comments
Closed

Goto definition goes to stub files instead of actual definitions #949

ewerybody opened this issue Feb 13, 2021 · 7 comments
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@ewerybody
Copy link

Seems like the issue (#65) has not been solved entirely :/
Examples from the old report still show "some" preference to the stub files although there are source files in place.:

from http import HTTPStatus

print(HTTPStatus.GATEWAY_TIMEOUT)

performing Goto Definition/Goto Declaration DOES work on HTTPStatus but always goes to Declaration on http and GATEWAY_TIMEOUT

from operator import attrgetter

neither operator nor attrgetter bring you to the source code definition on Goto Definition or Goto Declaration

from xml.etree import ElementTree

all goto the Declaration stub whatever I do

import pipes
pipes.quote()

only quote works here.

Expected

IF there is source code
Goto Definition brings you to the source code .py
Goto Declaration opens the stub .pyi

Environment data

Version: 1.54.0-insider (user setup)
Commit: 93f705ab40b37aade9d3b5165ed09114a8c87ac9
Date: 2021-02-11T05:44:31.644Z (2 days ago)
Electron: 11.2.3
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.19042

@savannahostrowski savannahostrowski added the needs investigation Could be an issue - needs investigation label Feb 16, 2021
@github-actions github-actions bot removed the triage label Feb 16, 2021
@jakebailey
Copy link
Member

#65 was about filtering the navigation, so that was closed. These above issues were with source mapping (mapping pyi contents to py content) and required a different fix.

All of the above will work in the next version, except attrgetter, because the type listed in the stub (function) doesn't match the type in the code (class) and our source mapper thinks it has found the wrong thing.

gotothing3

@microsoft microsoft deleted a comment from heejaechang Feb 19, 2021
@jakebailey
Copy link
Member

attrgetter now works, so everything you've listed will be fixed in our next release.

gotothing4

@jakebailey jakebailey added fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed needs investigation Could be an issue - needs investigation labels Feb 19, 2021
@ewerybody
Copy link
Author

whow! Thats great news!! 🤩

So the attrgetter stub with the def type is from the Python extension, right? Did they fix it as well?

@jakebailey
Copy link
Member

That stub is sourced from typeshed and would need to be fixed there. I don't know what the history of that stub is to know if it was intentional or not. I've seen that sort of thing a few times.

@jakebailey
Copy link
Member

This issue has been fixed in version 2021.2.4, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202124-24-february-2021

@cloud-yu
Copy link

same problem.
version: v2021.10.2
hover show annotation from source file(.py)
goto definition still go to stub file(.pyi)

11

@jakebailey
Copy link
Member

@cloud-yu Please file a new issue with the bug template; your issue is likely unrelated to this old, closed issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

4 participants