@@ -14,7 +14,7 @@ import * as strings from 'vs/base/common/strings';
14
14
import { AccessibilityVerbositySettingId , AccessibleViewProviderId } from 'vs/workbench/contrib/accessibility/browser/accessibilityConfiguration' ;
15
15
import { AccessibleViewType , IAccessibleContentProvider , IAccessibleViewOptions , IAccessibleViewService } from 'vs/workbench/contrib/accessibility/browser/accessibleView' ;
16
16
import { AccessibilityHelpAction } from 'vs/workbench/contrib/accessibility/browser/accessibleViewActions' ;
17
- import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
17
+ import { IInstantiationService , ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
18
18
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
19
19
import { Disposable , IDisposable , MutableDisposable } from 'vs/base/common/lifecycle' ;
20
20
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey' ;
@@ -27,6 +27,62 @@ import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/co
27
27
import { COMMENTS_VIEW_ID } from 'vs/workbench/contrib/comments/browser/commentsTreeViewer' ;
28
28
import { CommentThreadState } from 'vs/editor/common/languages' ;
29
29
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle' ;
30
+ import { CommandsRegistry } from 'vs/platform/commands/common/commands' ;
31
+ import { IViewsService } from 'vs/workbench/services/views/common/viewsService' ;
32
+ import { MenuId , registerAction2 } from 'vs/platform/actions/common/actions' ;
33
+ import { CONTEXT_KEY_HAS_COMMENTS , CONTEXT_KEY_SOME_COMMENTS_EXPANDED , CommentsPanel } from 'vs/workbench/contrib/comments/browser/commentsView' ;
34
+ import { ViewAction } from 'vs/workbench/browser/parts/views/viewPane' ;
35
+ import { Codicon } from 'vs/base/common/codicons' ;
36
+
37
+ CommandsRegistry . registerCommand ( {
38
+ id : 'workbench.action.focusCommentsPanel' ,
39
+ handler : async ( accessor ) => {
40
+ const viewsService = accessor . get ( IViewsService ) ;
41
+ viewsService . openView ( COMMENTS_VIEW_ID , true ) ;
42
+ }
43
+ } ) ;
44
+
45
+ registerAction2 ( class Collapse extends ViewAction < CommentsPanel > {
46
+ constructor ( ) {
47
+ super ( {
48
+ viewId : COMMENTS_VIEW_ID ,
49
+ id : 'comments.collapse' ,
50
+ title : nls . localize ( 'collapseAll' , "Collapse All" ) ,
51
+ f1 : false ,
52
+ icon : Codicon . collapseAll ,
53
+ menu : {
54
+ id : MenuId . ViewTitle ,
55
+ group : 'navigation' ,
56
+ when : ContextKeyExpr . and ( ContextKeyExpr . and ( ContextKeyExpr . equals ( 'view' , COMMENTS_VIEW_ID ) , CONTEXT_KEY_HAS_COMMENTS ) , CONTEXT_KEY_SOME_COMMENTS_EXPANDED ) ,
57
+ order : 100
58
+ }
59
+ } ) ;
60
+ }
61
+ runInView ( _accessor : ServicesAccessor , view : CommentsPanel ) {
62
+ view . collapseAll ( ) ;
63
+ }
64
+ } ) ;
65
+
66
+ registerAction2 ( class Expand extends ViewAction < CommentsPanel > {
67
+ constructor ( ) {
68
+ super ( {
69
+ viewId : COMMENTS_VIEW_ID ,
70
+ id : 'comments.expand' ,
71
+ title : nls . localize ( 'expandAll' , "Expand All" ) ,
72
+ f1 : false ,
73
+ icon : Codicon . expandAll ,
74
+ menu : {
75
+ id : MenuId . ViewTitle ,
76
+ group : 'navigation' ,
77
+ when : ContextKeyExpr . and ( ContextKeyExpr . and ( ContextKeyExpr . equals ( 'view' , COMMENTS_VIEW_ID ) , CONTEXT_KEY_HAS_COMMENTS ) , ContextKeyExpr . not ( CONTEXT_KEY_SOME_COMMENTS_EXPANDED . key ) ) ,
78
+ order : 100
79
+ }
80
+ } ) ;
81
+ }
82
+ runInView ( _accessor : ServicesAccessor , view : CommentsPanel ) {
83
+ view . expandAll ( ) ;
84
+ }
85
+ } ) ;
30
86
31
87
Registry . as < IConfigurationRegistry > ( ConfigurationExtensions . Configuration ) . registerConfiguration ( {
32
88
id : 'comments' ,
0 commit comments