Skip to content

fix: use setupDelayedHover for settings indicator hovers to support Ctrl+K I#304990

Merged
rzhao271 merged 3 commits intomicrosoft:mainfrom
yogeshwaran-c:fix/settings-modified-elsewhere-hover-v2
Apr 24, 2026
Merged

fix: use setupDelayedHover for settings indicator hovers to support Ctrl+K I#304990
rzhao271 merged 3 commits intomicrosoft:mainfrom
yogeshwaran-c:fix/settings-modified-elsewhere-hover-v2

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

When a settings editor indicator (e.g. "Modified Elsewhere", "Workspace Trust", "Not Synced", "Default value changed") is focused via Tab, pressing Ctrl+K I does not show that indicator's hover. Instead, the setting ID hover from a parent element is shown.

This happens because the indicators use showInstantHover with manual event handlers (addHoverDisposables), which does not register the hover in the hover service's _delayedHovers map. When _showAndFocusHoverForActiveElement is invoked by Ctrl+K I, it walks up the DOM tree and finds a parent element's hover instead.

Closes #257903

What is the new behavior?

All setting indicator hovers now use setupDelayedHover with setupKeyboardEvents: true, which:

  • Registers the hover in _delayedHovers so _showAndFocusHoverForActiveElement finds the correct hover for Ctrl+K I
  • Maintains existing mouse hover behavior
  • Maintains Space/Enter keyboard support via setupKeyboardEvents

The now-unused addHoverDisposables method and its related imports (RunOnceScheduler, IHoverWidget) are removed.

Additional context

This affects all setting indicators: Modified Elsewhere, Workspace Trust, Sync Ignored, Preview, Experimental, Advanced, Default Override, Policy, and Application Setting indicators.

When ensureConfigurationForDocument is called and no visible text editor
is found for the document, getFormattingOptions returns undefined and
the method returns early without sending any configuration including
user preferences like preferTypeOnlyAutoImports to the TS server.

This causes source.addMissingImports to ignore the user's
preferTypeOnlyAutoImports setting.

Fix by falling back to undefined formatting options when no visible
editor is found, ensuring user preferences are always sent.

Closes microsoft#272479
…trl+K I

Switch all indicator hovers from showInstantHover+addHoverDisposables
to setupDelayedHover with setupKeyboardEvents. This registers hovers
in _delayedHovers, allowing _showAndFocusHoverForActiveElement to find
and trigger the correct hover when Ctrl+K I is pressed while a setting
indicator (Modified Elsewhere, Workspace Trust, etc.) is focused.

Previously, Ctrl+K I would walk up the DOM tree and find a parent
element hover (showing the setting ID) instead of the indicator hover.

Fixes microsoft#257903
@vs-code-engineering
Copy link
Copy Markdown
Contributor

vs-code-engineering Bot commented Mar 26, 2026

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@rzhao271

Matched files:

  • src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts

Copy link
Copy Markdown
Collaborator

@rzhao271 rzhao271 left a comment

Choose a reason for hiding this comment

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

LGTM as a refactor. Ctrl+K I is still not supported, but I can close the original issue as not planned.

@rzhao271 rzhao271 modified the milestones: 1.117.0, 1.118.0 Apr 17, 2026
@rzhao271 rzhao271 merged commit 4651bee into microsoft:main Apr 24, 2026
40 of 41 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.

Ctrl+K I on Modified Elsewhere indicator does not open the hover

3 participants