@@ -77,6 +77,31 @@ registerAction2(class RestrictSearchToFolderAction extends Action2 {
77
77
}
78
78
} ) ;
79
79
80
+
81
+ registerAction2 ( class ExpandSelectedTreeCommandAction extends Action2 {
82
+ constructor (
83
+ ) {
84
+ super ( {
85
+ id : Constants . SearchCommandIds . ExpandRecursivelyCommandId ,
86
+ title : nls . localize ( 'search.expandRecursively' , "Expand Recursively" ) ,
87
+ category,
88
+ menu : [ {
89
+ id : MenuId . SearchContext ,
90
+ when : ContextKeyExpr . and (
91
+ ContextKeyExpr . or ( Constants . SearchContext . FileFocusKey , Constants . SearchContext . FolderFocusKey ) ,
92
+ Constants . SearchContext . HasSearchResults
93
+ ) ,
94
+ group : 'search' ,
95
+ order : 4
96
+ } ]
97
+ } ) ;
98
+ }
99
+
100
+ override async run ( accessor : any ) : Promise < any > {
101
+ await expandSelectSubtree ( accessor ) ;
102
+ }
103
+ } ) ;
104
+
80
105
registerAction2 ( class ExcludeFolderFromSearchAction extends Action2 {
81
106
constructor ( ) {
82
107
super ( {
@@ -270,6 +295,16 @@ registerAction2(class FindInWorkspaceAction extends Action2 {
270
295
} ) ;
271
296
272
297
//#region Helpers
298
+ function expandSelectSubtree ( accessor : ServicesAccessor ) {
299
+ const viewsService = accessor . get ( IViewsService ) ;
300
+ const searchView = getSearchView ( viewsService ) ;
301
+ if ( searchView ) {
302
+ const viewer = searchView . getControl ( ) ;
303
+ const selected = viewer . getFocus ( ) [ 0 ] ;
304
+ viewer . expand ( selected , true ) ;
305
+ }
306
+ }
307
+
273
308
async function searchWithFolderCommand ( accessor : ServicesAccessor , isFromExplorer : boolean , isIncludes : boolean , resource ?: URI , folderMatch ?: FolderMatchWithResource ) {
274
309
const listService = accessor . get ( IListService ) ;
275
310
const fileService = accessor . get ( IFileService ) ;
0 commit comments