Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search tree in multiroot doesn't collapse to one below root #161863

Merged
merged 1 commit into from Sep 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/vs/workbench/contrib/search/browser/searchActions.ts
Expand Up @@ -300,7 +300,7 @@ export function collapseDeepestExpandedLevel(accessor: ServicesAccessor) {
}
if (searchView.isTreeLayoutViewVisible && !canCollapseFirstLevel) {
const immediateParent = node.parent();
if (immediateParent instanceof FolderMatchWorkspaceRoot || immediateParent instanceof FolderMatchNoRoot) {
if (!(immediateParent instanceof FolderMatchWorkspaceRoot || immediateParent instanceof FolderMatchNoRoot || immediateParent instanceof SearchResult)) {
Copy link
Member

Choose a reason for hiding this comment

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

Might be easier to list the positive case at this point? (I guess, instanceof Match, FileMatch, FolderMatch?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True! It's a little clearer for me this way, though, since it lists the node types near the root that it can't be.

canCollapseFirstLevel = true;
}
}
Expand All @@ -320,8 +320,8 @@ export function collapseDeepestExpandedLevel(accessor: ServicesAccessor) {
do {
const immediateParent = node.parent();
if (immediateParent instanceof FolderMatchWorkspaceRoot || immediateParent instanceof FolderMatchNoRoot) {
if (viewer.hasElement(immediateParent) && viewer.isCollapsed(immediateParent)) {
viewer.collapse(immediateParent, true);
if (viewer.hasElement(node)) {
viewer.collapse(node, true);
} else {
viewer.collapseAll();
}
Expand Down