sdk icon indicating copy to clipboard operation
sdk copied to clipboard

[Request] On variable hover, show the typedef instead of the full type if possible

Open rrousselGit opened this issue 6 years ago • 13 comments

From https://github.com/Dart-Code/Dart-Code/issues/2088#issuecomment-552514074

Consider this snippet:

typedef MyTypedef = T Function();

MyTypedef variable;

In this snippet, hovering variable will show a contextual menu where the type of variable is said to be T Function().

This is not ideal when the typedef is more complex as it becomes rapidly unreadable. For example, I have a typedef that looks like this:

typedef Complex<A> = T Function<T>(
  T Function(A value),
  Function _,
  Function __,
);

It is incredibly more readable to see Complex<A> than the full-blown function prototype.

The suggestion would be that since variable explicitly uses MyTypedef, the tooltip should say that variable is of type MyTypedef instead of T Function().

rrousselGit avatar Nov 11 '19 16:11 rrousselGit