Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hover fixes #3065

Merged
merged 4 commits into from May 27, 2021
Merged

Hover fixes #3065

merged 4 commits into from May 27, 2021

Conversation

grouma
Copy link
Member

@grouma grouma commented May 26, 2021

  • Increase delay in showing the hover card (as requested by some internal users)
  • Ensure only one hover card is displayed at a time
  • Make the hover card scrollable for large inspected variables

Closes #3062

@grouma grouma requested a review from kenzieschmoll May 26, 2021 20:39
@@ -632,7 +632,7 @@ class LineItem extends StatefulWidget {
this.activeSearchMatch,
}) : super(key: key);

static const _hoverDelay = Duration(milliseconds: 50);
static const _hoverDelay = Duration(milliseconds: 150);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this better?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to show the hover card too quickly. This feels about right.

@@ -684,6 +687,8 @@ class _LineItemState extends State<LineItem> {
if (response is! InstanceRef) return;
final variable = Variable.fromRef(response);
await _debuggerController.buildVariablesTree(variable);
if (_hasMouseExited) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should do more. _onHoverExit only gets called if you changed the line. If the user moved more than a couple pixels within the same line, this hover is also obsolete.
we need to verify that we haven't gotten a mouseMove to a different location within the line as opposed to an exit from the line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already handle that scenario. If the hoverWord is the same we don't change the hover card just like in Chrome.


void _onHoverExit() {
_showTimer?.cancel();
_hasMouseExited = true;
_removeTimer = Timer(LineItem._hoverDelay, () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a separate delay. I don't think this delay should be made longer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree. We are less likely to "flash" a hover card if a user accidentally moves outside the line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with jacob. Look at the difference between the hover card show and hover card hide delays in IntelliJ. There is a longer delay to show than exit.

hover-intellij

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can shorten the delay but we don't want it too small as we want to allow users to hover "into" the card which keeps it around. Otherwise it's frustrating to expand variables displayed in the hover card.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would hope this code path isn't needed to make the case of hovering into a card work. ideally the area treated as in the card and the current location should have a border so you don't need to rely on the delay to move over the hover crd.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is not the case. Note that the card is rendered below the source line which is why this is required. This also mirrors the Chrome DevTools behavior. There appears to be a grace period where you can move your mouse outside the hovercard and into before it is removed.

@grouma
Copy link
Member Author

grouma commented May 27, 2021

PTAL

Comment on lines 694 to 695
child: Container(
constraints: const BoxConstraints(maxHeight: 250.0),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make 250.0 a const var on the theme. maxHoverCardHeight or similar

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. PTAL.

Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kenzieschmoll kenzieschmoll merged commit b3bf672 into master May 27, 2021
@kenzieschmoll kenzieschmoll deleted the hover-fixes branch May 27, 2021 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debug hover card is not scrollable
3 participants