-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Go To Definition jumps to source rather than typeshed stubs #795
Comments
It defaults to the type stub, is there a way to default to the more useful source instead? (or even better, ignore the type stub altogether) |
Duplicate microsoft/pylance-release#65 |
I'm not sure what you mean by "it defaults to the type stub". You should see both options appear, as in the screen shot above. It doesn't default to one or the other. Both the type stub and the source contain valuable information depending on your objective. From a type perspective, the information in the type stub is typically more definitive than any type information inferred from the source. Type stubs often provide overloads, generic definitions, functions definitions with generic parameter types, etc. that the original source does not contain. |
We should be selecting the |
@jakebailey VS Code ignores the server results ordering. I've tested by having the server reverse() the results before returning them, and it made no difference to the order displayed in VS Code, no difference to which one is selected. Is there something in particular you were thinking of that would allow control over this? |
Huh, I really had thought that the specification allowed you to mark one as the "preferred" choice. But, it's just a plain list? Unfortunately this'd mean we need the LSP to change to allow us to pick a result (or some change in VS Code to prefer the first one, for example). |
I'm also having the same problem. I understand that it may make sense in certain cases (overloading etc as you mentioned) to show the pyi file, so it probably shouldn't be hidden. |
I don't even see an option to view the stdlib source. When I peek the module it only shows the typestub. |
I met the same problem and would appreciate if also add built-in class/functions into options choosing py or pyi. |
Please reopen the issue. I have searched so many issues that claims to be solved with lengthy discussions, but none of them actually helps me. |
@cangyin, you're commenting on an issue that has been closed for multiple years. If you have a question, please post it to the pyright discussion forum with details about your situation. If you think that you are seeing a bug, please create a new bug report with repro details. |
"Go to Definition" on stdlib functions jumps to the module source rather than the typeshed stubs.
The behaviour of the default python extension ie: without pyright, is to jump to the module source.
This is also the behaviour in PyCharm.
The text was updated successfully, but these errors were encountered: