Skip to content

Fix occasional missed hover trigger#3006

Merged
nighca merged 1 commit intogoplus:devfrom
nighca:fix-hover-trigger-mouse-gap
Apr 3, 2026
Merged

Fix occasional missed hover trigger#3006
nighca merged 1 commit intogoplus:devfrom
nighca:fix-hover-trigger-mouse-gap

Conversation

@nighca
Copy link
Copy Markdown
Collaborator

@nighca nighca commented Apr 3, 2026

Refs #2978

Summary

This PR only fixes the hover trigger issue in the code editor.

When the pointer is near the middle between two characters, Monaco may still report a CONTENT_TEXT target while the previous range.isEmpty() check can classify the target in a way that causes the hover popup to be skipped unexpectedly.

This change switches that guard to mightBeForeignElement, which is a better fit for filtering injected or foreign content such as inlay-hint-like decorations while still allowing normal text hover to trigger reliably.

Scope

This PR intentionally includes only the hover trigger fix.

The separate hover content display changes remain in:

Validation

  • Checked file-level diagnostics for the modified hover controller file
  • Verified the diff only changes the hover trigger guard in hover/index.ts

Copilot AI review requested due to automatic review settings April 3, 2026 03:08
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the hover controller logic in the code editor to identify foreign elements, such as inlay hints, using the mightBeForeignElement property instead of checking for an empty range. Feedback was provided to use optional chaining when accessing the detail property to avoid potential runtime errors.

@fennoai
Copy link
Copy Markdown
Contributor

fennoai Bot commented Apr 3, 2026

Clean, surgical fix. Using mightBeForeignElement is semantically more accurate than the range.isEmpty() proxy for detecting injected content. No security or performance concerns. One minor consideration inline.

Copy link
Copy Markdown
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 adjusts the code editor hover trigger guard to avoid occasionally skipping hover popups when the pointer is between characters (a Monaco edge case), improving hover reliability without changing hover content rendering.

Changes:

  • Replace the range.isEmpty() hover-suppression guard with e.target.detail.mightBeForeignElement.
  • Update the inline comment to reflect the new guard’s intent (filter injected/foreign content such as inlay-hint-like decorations).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nighca nighca merged commit c1a5fbc into goplus:dev Apr 3, 2026
8 checks passed
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.

3 participants