Autocomplete self/cls in class methods #3237
matthewbastien
started this conversation in
Enhancement
Replies: 3 comments
-
Since this isn't a core type checking feature request, I'm going to transfer it to the pylance issue tracker. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Related: #2538 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Moving this issue to discussion as an enhancement request for comments and upvotes. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
Not necessarily a problem, but there are IDEs such as PyCharm that offer a very helpful feature that auto-completes class arguments for you so that you don't have to type the full signature. This reduces the amount of code one has to write manually and would be very helpful if brought to Pyright.
Describe the solution you'd like
When typing the opening parenthesis in the following class method, the
cls
argument is required and should be entered automatically by Pyright:In this more basic method, the
self
argument is required and should be entered automatically by Pyright when the opening parenthesis is typed:In fact, it would be even be better to have Pyright complete the full class definition for you when you ask it for completions on
@classmethod
. Perhaps even when you typedef
there could be snippets (or some equivalent) that will write all of the basic method boilerplate for you and allow you to enter a method name.Beta Was this translation helpful? Give feedback.
All reactions