I'm coming from Eclipse where searching for a string across files using ^h organizes the results by the folder in which they were found, like this:
search results
This is very handy, as folders can be collapsed and expanded to narrow the results. Is there a similar capability (out of the box or via an extension) for vscode?
VSCode 1.72 (Sept. 2022) should help, since issue 20224 is now fixed by PR 161022.
There is a new action "View as Tree" (search.action.viewAsTree).
This is available in VSCode Insiders today.
Anil reports in the comments:
The settings value is
search.defaultViewMode. See "Default settings".
// Controls the default search result view mode.
// - tree: Shows search results as a tree.
// - list: Shows search results as a list.
"search.defaultViewMode": "list",
Search Tree
Shows the search results in a toggle-able tree.
And
With PR 173080, VSCode 1.76 (Feb. 2023) introduces an extra state for search tree view collapse, as described in issue 162812.
The default functionality should be the collapse the individual matches and only see the files/folders.
Similar to how multi-root works

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With