webdev icon indicating copy to clipboard operation
webdev copied to clipboard

Hover over types could be more useful

Open vsmenon opened this issue 5 years ago • 4 comments

Right now, if I hover on Future, I see the following:

Screen Shot 2020-06-09 at 12 06 51 PM

I see similar hovering on anything that is a type. At a minimum, shouldn't see the getObject error. It'd be nice to show any relevant info (e.g., where it's defined, links) if possible.

FYI - @annagrin

vsmenon avatar Jun 09 '20 19:06 vsmenon

Alternatively, is there a way to suppress and trigger whatever the editor would do statically?

E.g., when I'm stopped at a breakpoint in VSCode and I hover over a symbol in the same file, I get eval - i.e., the above when I hover on Future. If I move to a different file (or I'm not at a breakpint), I get the static doc for a class symbol instead - e.g., the dartdoc for Future.

@DanTup

vsmenon avatar Jun 09 '20 19:06 vsmenon

Alternatively, is there a way to suppress and trigger whatever the editor would do statically?

Unfortunately not - this came up at https://github.com/microsoft/vscode/pull/48747#issuecomment-392735931 and although we can make it trigger the static hover provider, it won't render the results(!).

I still think it's a good idea though, so since there's no existing issue about it, I've opened https://github.com/microsoft/vscode/issues/99856 to see if it could be considered. If it was implemented as an option, then maybe having it automatically fall back to that if the debug provide returns nothing (or a specific type of a result) would be even better.

What you're seeing for now, is the debugger evaluating the expression under the cursor (Future<CardSet>) which returns a Type. We then call the VM Service's getObject on that type but in this case it returns an error.

We could add special handling for types if there's something better to do, but we should ensure the real VM and web proxy behave roughly the same, so that what we do makes sense in both cases.

DanTup avatar Jun 11 '20 11:06 DanTup

...which returns a Type. We then call the VM Service's getObject on that type but in this case it returns an error

It sounds like this issue is about improving package:dwds's support for the vm_service Type object.

devoncarew avatar Jun 12 '20 12:06 devoncarew

Good point about consistency. Here's the same on the VM / MacOS:

Screen Shot 2020-06-12 at 5 59 02 AM

No error, though it'd be nice to show static info here too.

vsmenon avatar Jun 12 '20 13:06 vsmenon