6
6
import * as nls from 'vs/nls' ;
7
7
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet' ;
8
8
import { normalize , isAbsolute , posix } from 'vs/base/common/path' ;
9
- import { ViewPane } from 'vs/workbench/browser/parts/views/viewPane' ;
9
+ import { ViewPane , ViewAction } from 'vs/workbench/browser/parts/views/viewPane' ;
10
+ import { IInstantiationService , ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
10
11
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView' ;
11
12
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
12
- import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
13
13
import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
14
14
import { renderViewTree } from 'vs/workbench/contrib/debug/browser/baseDebugView' ;
15
- import { IDebugSession , IDebugService , CONTEXT_LOADED_SCRIPTS_ITEM_TYPE } from 'vs/workbench/contrib/debug/common/debug' ;
15
+ import { IDebugSession , IDebugService , CONTEXT_LOADED_SCRIPTS_ITEM_TYPE , LOADED_SCRIPTS_VIEW_ID } from 'vs/workbench/contrib/debug/common/debug' ;
16
16
import { Source } from 'vs/workbench/contrib/debug/common/debugSource' ;
17
17
import { IWorkspaceContextService , IWorkspaceFolder } from 'vs/platform/workspace/common/workspace' ;
18
- import { IContextKey , IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
18
+ import { IContextKey , IContextKeyService , ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey' ;
19
19
import { normalizeDriveLetter , tildify } from 'vs/base/common/labels' ;
20
20
import { isWindows } from 'vs/base/common/platform' ;
21
21
import { URI } from 'vs/base/common/uri' ;
@@ -34,6 +34,9 @@ import { DebugContentProvider } from 'vs/workbench/contrib/debug/common/debugCon
34
34
import { ILabelService } from 'vs/platform/label/common/label' ;
35
35
import type { ICompressedTreeNode } from 'vs/base/browser/ui/tree/compressedObjectTreeModel' ;
36
36
import type { ICompressibleTreeRenderer } from 'vs/base/browser/ui/tree/objectTree' ;
37
+ import { registerAction2 , MenuId } from 'vs/platform/actions/common/actions' ;
38
+ import { Codicon } from 'vs/base/common/codicons' ;
39
+
37
40
import { IViewDescriptorService } from 'vs/workbench/common/views' ;
38
41
import { IOpenerService } from 'vs/platform/opener/common/opener' ;
39
42
import { IThemeService } from 'vs/platform/theme/common/themeService' ;
@@ -622,6 +625,10 @@ export class LoadedScriptsView extends ViewPane {
622
625
this . tree . layout ( height , width ) ;
623
626
}
624
627
628
+ collapseAll ( ) : void {
629
+ this . tree . collapseAll ( ) ;
630
+ }
631
+
625
632
override dispose ( ) : void {
626
633
dispose ( this . tree ) ;
627
634
dispose ( this . treeLabels ) ;
@@ -764,3 +771,24 @@ class LoadedScriptsFilter implements ITreeFilter<BaseTreeItem, FuzzyScore> {
764
771
return TreeVisibility . Recurse ;
765
772
}
766
773
}
774
+ registerAction2 ( class Collapse extends ViewAction < LoadedScriptsView > {
775
+ constructor ( ) {
776
+ super ( {
777
+ id : 'loadedScripts.collapse' ,
778
+ viewId : LOADED_SCRIPTS_VIEW_ID ,
779
+ title : nls . localize ( 'collapse' , "Collapse All" ) ,
780
+ f1 : false ,
781
+ icon : Codicon . collapseAll ,
782
+ menu : {
783
+ id : MenuId . ViewTitle ,
784
+ order : 30 ,
785
+ group : 'navigation' ,
786
+ when : ContextKeyExpr . equals ( 'view' , LOADED_SCRIPTS_VIEW_ID )
787
+ }
788
+ } ) ;
789
+ }
790
+
791
+ runInView ( _accessor : ServicesAccessor , view : LoadedScriptsView ) {
792
+ view . collapseAll ( ) ;
793
+ }
794
+ } ) ;
0 commit comments