feat: add Collapse Other Results context menu action in search view#304994
Open
yogeshwaran-c wants to merge 2 commits into
Open
feat: add Collapse Other Results context menu action in search view#304994yogeshwaran-c wants to merge 2 commits into
yogeshwaran-c wants to merge 2 commits into
Conversation
Adds a new context menu action in the search results view that collapses all sibling results except the focused one. This allows users to focus on a specific group of results without losing other results. The action appears in the context menu when right-clicking a file or folder match in the search results tree. Closes microsoft#163590
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a "Collapse Other Results" context menu action in the search results view, enabling users to collapse all sibling matches except the focused file/folder.
Changes:
- New command ID
CollapseOtherSearchResultsActionIdadded toSearchCommandIds. - New
CollapseOtherResultsActionregistered toMenuId.SearchContextfor file/folder focus when search results exist. - Action obtains the focused element's parent node from the tree and collapses each non-focused, expanded sibling.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/search/common/constants.ts | Adds the new CollapseOtherSearchResultsActionId command id. |
| src/vs/workbench/contrib/search/browser/searchActionsFind.ts | Implements and registers the new CollapseOtherResultsAction context menu action. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Feature
What is the current behavior?
In the search results view, users can collapse all results or expand recursively, but there is no way to collapse all results except the one they're focused on. Users who want to focus on a specific group of results have to manually collapse each other group.
Closes #163590
What is the new behavior?
Adds a "Collapse Other Results" context menu action that appears when right-clicking a file or folder match in the search results tree. Selecting it collapses all sibling results except the focused one, allowing users to quickly focus on a specific set of results.
Additional context
search.action.collapseOtherResultsadded toSearchCommandIdsMenuId.SearchContextfor folder and file focus contextsviewer.getNode()to get siblings and collapses all except the focused element