Skip to content

Respect explorer.compactFolders in the search results tree - #325654

Open
varshitha (dobbydobap) wants to merge 4 commits into
microsoft:mainfrom
dobbydobap:fix-301832-search-compactfolders
Open

varshitha (dobbydobap) wants to merge 4 commits into
microsoft:mainfrom
dobbydobap:fix-301832-search-compactfolders

Conversation

@dobbydobap

@dobbydobap varshitha (dobbydobap) commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #301832. The Search view's results tree (WorkbenchCompressibleAsyncDataTree) never set compressionEnabled, so it always compacted single-child folders regardless of explorer.compactFolders. This reads the setting at construction and updates on change, mirroring how the Explorer view already does it — no new setting, just honoring the existing one in Search too.

The Explorer also turns compression off when a screen reader is optimized, so this now does the same and updates live via onDidChangeScreenReaderOptimized. Both conditions go through a single isCompressionEnabled() helper rather than being repeated at each call site.

Copilot AI review requested due to automatic review settings July 13, 2026 16:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates Search tree folder compression to honor explorer.compactFolders.

Changes:

  • Initializes Search tree compression from the setting.
  • Updates compression when the setting changes.

],
this.searchDataSource,
{
compressionEnabled: this.configurationService.getValue<boolean>('explorer.compactFolders'),
Comment on lines +1013 to +1014
this._register(Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('explorer.compactFolders'))(() =>
this.tree.updateOptions({ compressionEnabled: this.configurationService.getValue<boolean>('explorer.compactFolders') })));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I'd only mirrored half of the Explorer's isCompressionEnabled. Added the screen-reader-optimized guard to compressionEnabled and a matching onDidChangeScreenReaderOptimized subscription so both update paths recompute together, same as explorerView. Thanks!

@dobbydobap

Copy link
Copy Markdown
Contributor Author

pushed an update, besides the explorer.compactFolders fix this now also disables compression when a screen reader is optimized, matching what the explorer does in explorerView.ts. it felt wrong to say this mirrors the explorer while leaving that part out. both conditions go through one isCompressionEnabled() helper instead of repeating the expression at each call site.

@dobbydobap

Copy link
Copy Markdown
Contributor Author

verified this in a dev build. with a nested alpha/beta/gamma chain in the results, the tree shows a single compressed alpha\beta\gamma row; flipping editor.accessibilitySupport to on splits it into three rows immediately and back to off recompresses it, no reload either way. toggling explorer.compactFolders behaves the same.

one thing worth flagging for anyone reproducing: this is only visible with search.defaultViewMode: "tree". in the default list mode results render as flat files with the folder as a description, so there are no folder rows to compress and nothing appears to change.

This branch has not been deployed

No deployments
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.

Search pane compacts folders despite "explorer.compactFolders": false in settings

3 participants