Skip to content

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

Open
yogeshwaran-c wants to merge 2 commits intomicrosoft:mainfrom
yogeshwaran-c:fix/settings-modified-elsewhere-hover-v2
Open

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

Conversation

@yogeshwaran-c
Copy link
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
Contributor

📬 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

@vs-code-engineering vs-code-engineering bot added this to the 1.114.0 milestone Mar 26, 2026
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

2 participants