Fix occasional missed hover trigger#3006
Conversation
There was a problem hiding this comment.
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.
|
Clean, surgical fix. Using |
There was a problem hiding this comment.
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 withe.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.
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_TEXTtarget while the previousrange.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
hover/index.ts