@@ -7,7 +7,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
7
7
import { Disposable } from 'vs/base/common/lifecycle' ;
8
8
import { localize } from 'vs/nls' ;
9
9
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
10
- import { ContextKeyExpr , IContextKeyService , RawContextKey } from 'vs/platform/contextkey/common/contextkey' ;
10
+ import { ContextKeyExpr , IContextKey , IContextKeyService , RawContextKey } from 'vs/platform/contextkey/common/contextkey' ;
11
11
import { Event , Emitter } from 'vs/base/common/event' ;
12
12
import { CommentsViewFilterFocusContextKey , ICommentsView } from 'vs/workbench/contrib/comments/browser/comments' ;
13
13
import { MenuId , MenuRegistry , registerAction2 } from 'vs/platform/actions/common/actions' ;
@@ -74,9 +74,9 @@ export class CommentsFilters extends Disposable {
74
74
}
75
75
}
76
76
77
- private _sortBy = CONTEXT_KEY_SORT_BY . bindTo ( this . contextKeyService ) ;
77
+ private _sortBy : IContextKey < CommentsSortOrder > = CONTEXT_KEY_SORT_BY . bindTo ( this . contextKeyService ) ;
78
78
get sortBy ( ) : CommentsSortOrder {
79
- return this . _sortBy . get ( ) ! ;
79
+ return this . _sortBy . get ( ) ?? CommentsSortOrder . ResourceAscending ;
80
80
}
81
81
set sortBy ( sortBy : CommentsSortOrder ) {
82
82
if ( this . _sortBy . get ( ) !== sortBy ) {
@@ -208,7 +208,7 @@ registerAction2(class extends ViewAction<ICommentsView> {
208
208
icon : Codicon . history ,
209
209
viewId : COMMENTS_VIEW_ID ,
210
210
toggled : {
211
- condition : ContextKeyExpr . equals ( 'commentsView.sortBy' , CommentsSortOrder . UpdatedAtDescending ) ,
211
+ condition : ContextKeyExpr . equals ( CONTEXT_KEY_SORT_BY . key , CommentsSortOrder . UpdatedAtDescending ) ,
212
212
title : localize ( 'sorting by updated at' , "Updated Time" ) ,
213
213
} ,
214
214
menu : {
@@ -229,13 +229,13 @@ registerAction2(class extends ViewAction<ICommentsView> {
229
229
constructor ( ) {
230
230
super ( {
231
231
id : `workbench.actions.${ COMMENTS_VIEW_ID } .toggleSortByResource` ,
232
- title : localize ( 'toggle sorting by resource' , "File" ) ,
232
+ title : localize ( 'toggle sorting by resource' , "Position in File" ) ,
233
233
category : localize ( 'comments' , "Comments" ) ,
234
234
icon : Codicon . history ,
235
235
viewId : COMMENTS_VIEW_ID ,
236
236
toggled : {
237
- condition : ContextKeyExpr . equals ( 'commentsView.sortBy' , CommentsSortOrder . ResourceAscending ) ,
238
- title : localize ( 'sorting by file' , "File" ) ,
237
+ condition : ContextKeyExpr . equals ( CONTEXT_KEY_SORT_BY . key , CommentsSortOrder . ResourceAscending ) ,
238
+ title : localize ( 'sorting by position in file' , "Position in File" ) ,
239
239
} ,
240
240
menu : {
241
241
id : commentSortSubmenu ,
0 commit comments