Quick fix to auto fill annotations from parent class #2700
Replies: 4 comments
-
Parameters with no annotation are always assumed to have an Pylance attempts to help by copying the signature for you when you define a method override in a subclass. For example, if you were to type After accepting the auto-complete: |
Beta Was this translation helpful? Give feedback.
-
For method overrides that are already defined, perhaps it would make sense to offer a code action that adds any missing type annotations from the parent class. |
Beta Was this translation helpful? Give feedback.
-
Hello @erictraut, thank you for the answer
Yes I use it, but in case of previous scripts or external, it must be rewritten. I really like Typescript, without the propagation of types it would be difficult to understand and verify old scripts (or parts of code written by someone else.).
Yes I think it could be a flexible solution. |
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.
-
Please search existing feature requests to avoid creating duplicates.
Surprisingly, I did not find any questions on this topic
Describe the feature you'd like.
When a function is overloaded inside a subclass, the parameters have an Any type
Use case
it would be useful to have this functionality. In my case, I am developing a Blender plugin and I am using fake-bpy-module for types.
All the additions of features in the Blender software (Event, Ui, Command, GPU draw, ...) are done by overloading the base classes.
this makes the use of pylance of little use as all types are Any.
It is possible to rewrite the signature, but it's a shame and some functions have complex types, like dict which include tuples including union lists, etc.
Thanks for what you do
Beta Was this translation helpful? Give feedback.
All reactions