Skip to content

Conversation

@ChaseKnowlden
Copy link
Contributor

Fixes #276558

Copilot AI review requested due to automatic review settings November 10, 2025 19:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR makes hover trigger instantly when a keyboard modifier is pressed, eliminating the need to move the mouse again. When hover is configured for "onKeyboardModifier" mode, pressing the triggering modifier key (opposite of the multi-cursor modifier) now immediately shows the hover at the last known mouse position.

Key changes:

  • Added tracking of hover delay setting in IHoverSettings interface
  • Implemented instant hover triggering on keyboard modifier press in _onKeyDown method
  • Used last known mouse position from _mouseMoveEvent to display hover without requiring mouse movement

@benvillalobos
Copy link
Member

Thanks for the contribution @ChaseKnowlden ! Please take a look at Copilot's feedback, I'll take a look once the comments are resolved.

@ChaseKnowlden
Copy link
Contributor Author

Ready to check.

Copy link
Member

@benvillalobos benvillalobos left a comment

Choose a reason for hiding this comment

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

Looking good! I noticed a bug where the hover wouldn't go away when moving the mouse to an area that wasn't the squiggly or the hover itself.

When the mouse moves away from the hover and the squiggly, the hover should go away. It should essentially mimic the behavior of how hover works in the "On" state.

20251119-1914-00.5824948.mp4

if (this._ignoreMouseEvents) {
return;
}
// New behavior: if hover is configured for keyboard modifier and the user presses the triggering modifier
Copy link
Member

Choose a reason for hiding this comment

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

We can remove this comment. The code explains itself here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

Comment on lines 275 to 277
const multiCursorModifier = this._editor.getOption(EditorOption.multiCursorModifier); // 'altKey' | 'ctrlKey' | 'metaKey'
const triggerPressed = isTriggerModifierPressed(multiCursorModifier, e);
if (triggerPressed) {
Copy link
Member

Choose a reason for hiding this comment

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

Nit, this is simpler:

Suggested change
const multiCursorModifier = this._editor.getOption(EditorOption.multiCursorModifier); // 'altKey' | 'ctrlKey' | 'metaKey'
const triggerPressed = isTriggerModifierPressed(multiCursorModifier, e);
if (triggerPressed) {
const multiCursorModifier = this._editor.getOption(EditorOption.multiCursorModifier);
if (isTriggerModifierPressed(multiCursorModifier, e)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

} else {
return mouseEvent.event.altKey;
}
// onKeyboardModifier
Copy link
Member

Choose a reason for hiding this comment

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

nit: This comment is unnecessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@ChaseKnowlden ChaseKnowlden force-pushed the ChaseKnowlden/issue276558 branch from 9b83ac2 to d0a9afc Compare November 21, 2025 02:24
@benvillalobos
Copy link
Member

Thanks for the updates @ChaseKnowlden! Before we merge, we should fix the issue mentioned here: #276582 (review)

Any idea what might be causing it? Happy to take a look as well if you'd like.

@ChaseKnowlden
Copy link
Contributor Author

Thanks for the updates @ChaseKnowlden! Before we merge, we should fix the issue mentioned here: #276582 (review)

Any idea what might be causing it? Happy to take a look as well if you'd like.

Fixed.

@benvillalobos
Copy link
Member

Hey @ChaseKnowlden, thanks again for the work here. Also letting you know that I'm on vacation and plan to get this PR through when I get back early next year.

Happy holidays!

@benvillalobos
Copy link
Member

benvillalobos commented Jan 6, 2026

Made a few changes:

  1. Added support for glyph hovers (like breakpoints)
  2. Modified the content hover controller to call showsOrWillShow (fixes an issue where triggering a hover on a glyph showed both the content hover and glyph hover)
  3. Removed the onKeyUp logic. It was added to allow the hovers to hide when moving the mouse, but it wasn't needed.

Looking to get this merged later this week, it will have ~2 weeks to breathe before the next release kicks in.

Feel free to test ahead of time!

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.

Hover on keyboard modifier should trigger instantly

2 participants