Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to view VSCode "find in files" results organized by folder hierarchy?

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?

like image 686
sferrari Avatar asked Dec 05 '25 21:12

sferrari


1 Answers

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.

https://user-images.githubusercontent.com/31675041/190530991-7f4b0501-4fc4-4ac6-b383-c248f876c049.png

And

https://user-images.githubusercontent.com/31675041/190531035-cb35e877-cf9c-4832-8acc-71988445d12b.png


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

https://camo.githubusercontent.com/9e563a6d56f8dd0eafb2f9da11a3b3756f97f80719155ca7504d9717a4d391ea/68747470733a2f2f692e6779617a6f2e636f6d2f66623136333363373063333337366562303866633935306530353039393332662e676966

like image 77
VonC Avatar answered Dec 07 '25 14:12

VonC



Donate For Us

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