Autocomplete for function definition using a TypeAlias is broken #6172
Replies: 5 comments
-
Thanks to @davep for coming up with the MRE code. |
Beta Was this translation helpful? Give feedback.
-
Thank you for reporting this issue. Our current design is to print the original return type instead of the type alias for overridden methods. I don't consider it a bug, but tagging @heejaechang to see if he has a different perspective. |
Beta Was this translation helpful? Give feedback.
-
Thanks, @StellaHuang95! Is there a rationale for this? The tooltip that appears when you are in the process of overriding a method does show the type alias. When you subclass something, you're probably not interested in returning the original type, but in the type alias. You may not even know or understand what the original type is. |
Beta Was this translation helpful? Give feedback.
-
Ran into this problem a few more times while creating subclasses. Whenever I override def __init__(
self,
*content: Option | Separator | None | ConsoleRenderable | RichCast | str,
tooltip: ConsoleRenderable | RichCast | str | None = None,
): while this is the original class definition: def __init__(
self,
*content: NewOptionListContent,
tooltip: RenderableType | None = None,
): (I removed some other parameters which were simple types and thus unchanged.) Since I just want to subclass something, I don't want the type definition to change. That confuses my users... |
Beta Was this translation helpful? Give feedback.
-
Thanks for the clarification. We could potentially add a setting to control the printed return type to be either original type or type alias. Moving this issue to discussion as an enhancement request for comments and upvotes. |
Beta Was this translation helpful? Give feedback.
-
Environment data
Code Snippet
Consider this definition:
Repro Steps
Thing
.list[int]
instead ofThing
.Expected behavior
Expected output:
Actual behavior
Logs
Could not create the issue with the logs; they were too long although I cleared the log output, enabled the trace setting, pressed n and tab and copied the resulting logs. Not sure what part I'll have to paste from the logs...
Beta Was this translation helpful? Give feedback.
All reactions