goto references on __init__
should show me all locations of construction
#2671
Replies: 3 comments
-
Thanks for the feature request. I think this is worth considering, although it introduces an inconsistency that gives me some pause. Since this is a language server feature rather than a core type checking feature, I'm going to transfer it to the pylance repo where it will get the appropriate attention and discussion. |
Beta Was this translation helpful? Give feedback.
-
I remember talking about this a few months ago. I'm surprised we didn't have a canonical issue for this, thanks. I think that this makes sense. |
Beta Was this translation helpful? Give feedback.
-
Moving this issue to discussion as an enhancement request for comments and upvotes. |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
The clangd language server has this nice feature where if you "goto reference" on a constructor, it shows all places where a new instance is constructed of that class.
pyright should do this for
__init__
methods as well. It currently reports "no references".It already shows references when I "goto reference" on the name of the class, but among those references are also import statements, and type annotations. That's too much noise if I just want to know where instances are constructed.
Describe the solution you'd like
Doing "goto references" on an
__init__
method should show me only the places of construction, not imports and type annotations.Additional context
Perhaps it's also an idea to show all places where the instance of a class is (implicitly) converted to a string if you "goto references" on a
__str__
method.Beta Was this translation helpful? Give feedback.
All reactions