Change:
let canCollapseFileMatchLevel = false; let canCollapseFirstLevel = false; <del> if (node instanceof FolderMatchWorkspaceRoot) { </del> <ins> if (node instanceof FolderMatchWorkspaceRoot || searchView.isTreeLayoutViewVisible) { </ins> while (node = navigator.next()) { if (node instanceof Match) { canCollapseFileMatchLevel = true;

Discussion:
The newly introduced « Search Tree » (, ) breaks the Expand/Collapse action that was designed to show/hide in-file result matches. Expand All ! Collapse All ! Add intermediate actions (or better: a new button dedicated to theses actions, that would help to not break current folder tree state) : Expand In-file results Collapse In-file results Add these 2 new actions would help to achieve this result: !
Just to clarify, are you describing a desired behavior for results in a tree view, where an extra step to collapse singular matches exists on single-root results (results that are only in one workspace)? I believe that multi-root search results already support this, but I could also add it to the case where there are results from only one root. Does this break anything from the existing search results in a list view?
No it is not related to multi-root, I was just trying to explain that the collapse/expand button behavior is different between 1.72 and 1.72. For me, in-file results are these, and they can be closed (collapsed) or opened (expanded). I'm using a different terminology to opposite them to the folders/files structure: ! In VSCode <= 1.71: Expand: Open all in-file results Collapse: Close all in-file results Expanded ! Collapsed ! Since VSCode 1.72: Expand: Expand folder structure + Open all in-file results Collapse: Collapse folder structure + Close all in-file results Expanded ! Collapsed ! To mimic 1.71 collapsed result, you need: Make your search Collapse All View as List View as Tree Tree expanded, In-file results collapsed ! Thinking about it, the solution could be to keep the current behavior, but pressing ALT+ Collapse/Expand would apply a collapse/expand action only on in-file results: Expand: Expand folder structure + Open all in-file results Collapse: Collapse folder structure + Close all in-file results (ALT + Expand) OR (ALT + Collapse) : IF at least one in-file results is open THEN close all in-file results ELSE open all in-file results WITHOUT changing current tree (means folder expanded/collapsed) state.
Oh ok I think I understand where you're going with this! Just to get this clear: When you press the collapse button, you expect all of the individual matches to be hidden, but that isn't happening in the new tree view.

Instead, all of the folders are being collapsed.
Exactly, that's why I made the ALT modifier suggestion that would help to restore previous functionnality
See also where I ask for a behavior as described in and the button to be a toggle
Now that I think about, I think the default functionality should be the collapse the individual matches and only see the files/folders. Similar to how multi-root works, we could probably have a multi-step collapse: ]() Your idea about ALT seems good too, but I don't want to complicate the process if it could just be multi-step (which is already what we have in multi-root).
verif steps: tree view in search the collapse button to collapse the items ! should be two steps to the collapse: first hiding the file contents, then collapsing all of the first-level folders.