@@ -82,7 +82,7 @@ export class CommentsPanel extends FilterViewPane implements ICommentsView {
82
82
if ( ! this . focusedCommentNode ) {
83
83
return ;
84
84
}
85
- return this . getScreenReaderInfoForNode ( this . focusedCommentNode , 'accessibleViewContent' ) ;
85
+ return this . getScreenReaderInfoForNode ( this . focusedCommentNode ) ;
86
86
}
87
87
88
88
focusNextNode ( ) : void {
@@ -316,61 +316,70 @@ export class CommentsPanel extends FilterViewPane implements ICommentsView {
316
316
this . messageBoxContainer . classList . toggle ( 'hidden' , this . commentService . commentsModel . hasCommentThreads ( ) ) ;
317
317
}
318
318
319
- private getScreenReaderInfoForNode ( element : CommentNode , type : 'ariaLabel' | 'accessibleViewContent' ) {
319
+ private getScreenReaderInfoForNode ( element : CommentNode , forAriaLabel ?: boolean ) : string {
320
320
let accessibleViewHint = '' ;
321
- if ( type === 'ariaLabel' && this . configurationService . getValue ( AccessibilityVerbositySettingId . Comments ) ) {
321
+ if ( forAriaLabel && this . configurationService . getValue ( AccessibilityVerbositySettingId . Comments ) ) {
322
322
const kbLabel = this . keybindingService . lookupKeybinding ( AccessibleViewAction . id ) ?. getAriaLabel ( ) ;
323
323
accessibleViewHint = kbLabel ? nls . localize ( 'acessibleViewHint' , "Inspect this in the accessible view ({0}).\n" , kbLabel ) : nls . localize ( 'acessibleViewHintNoKbOpen' , "Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding.\n" ) ;
324
324
}
325
- const replies = this . getRepliesAsString ( element , type ) || '' ;
325
+ const replyCount = this . getReplyCountAsString ( element , forAriaLabel ) ;
326
+ const replies = this . getRepliesAsString ( element , forAriaLabel ) ;
326
327
if ( element . range ) {
327
328
if ( element . threadRelevance === CommentThreadApplicability . Outdated ) {
328
329
return accessibleViewHint + nls . localize ( 'resourceWithCommentLabelOutdated' ,
329
- "Outdated from $ {0} at line {1} column {2} in {3}, comment: {4 }" ,
330
+ "Outdated from {0} at line {1} column {2} in {3},{4} comment: {5 }" ,
330
331
element . comment . userName ,
331
332
element . range . startLineNumber ,
332
333
element . range . startColumn ,
333
334
basename ( element . resource ) ,
335
+ replyCount ,
334
336
( typeof element . comment . body === 'string' ) ? element . comment . body : element . comment . body . value
335
337
) + replies ;
336
338
} else {
337
339
return accessibleViewHint + nls . localize ( 'resourceWithCommentLabel' ,
338
- "$ {0} at line {1} column {2} in {3}, comment: {4 }" ,
340
+ "{0} at line {1} column {2} in {3},{4} comment: {5 }" ,
339
341
element . comment . userName ,
340
342
element . range . startLineNumber ,
341
343
element . range . startColumn ,
342
344
basename ( element . resource ) ,
345
+ replyCount ,
343
346
( typeof element . comment . body === 'string' ) ? element . comment . body : element . comment . body . value ,
344
347
) + replies ;
345
348
}
346
349
} else {
347
350
if ( element . threadRelevance === CommentThreadApplicability . Outdated ) {
348
351
return accessibleViewHint + nls . localize ( 'resourceWithCommentLabelFileOutdated' ,
349
- "Outdated from {0} in {1}, comment: {2 }" ,
352
+ "Outdated from {0} in {1},{2} comment: {3 }" ,
350
353
element . comment . userName ,
351
354
basename ( element . resource ) ,
355
+ replyCount ,
352
356
( typeof element . comment . body === 'string' ) ? element . comment . body : element . comment . body . value
353
357
) + replies ;
354
358
} else {
355
359
return accessibleViewHint + nls . localize ( 'resourceWithCommentLabelFile' ,
356
- "{0} in {1}, comment: {2 }" ,
360
+ "{0} in {1},{2} comment: {3 }" ,
357
361
element . comment . userName ,
358
362
basename ( element . resource ) ,
363
+ replyCount ,
359
364
( typeof element . comment . body === 'string' ) ? element . comment . body : element . comment . body . value
360
365
) + replies ;
361
366
}
362
367
}
363
368
}
364
369
365
- private getRepliesAsString ( node : CommentNode , type : 'ariaLabel' | 'accessibleViewContent' ) : string {
366
- if ( ! node . replies . length || type === 'ariaLabel' ) {
370
+ private getRepliesAsString ( node : CommentNode , forAriaLabel ?: boolean ) : string {
371
+ if ( ! node . replies . length || forAriaLabel ) {
367
372
return '' ;
368
373
}
369
- return nls . localize ( 'replies' , " {0} replies:\n{1}" , node . replies . length , node . replies . map ( reply => nls . localize ( 'resourceWithRepliesLabel' ,
370
- "$ {0} {1}" ,
374
+ return '\n' + node . replies . map ( reply => nls . localize ( 'resourceWithRepliesLabel' ,
375
+ "{0} {1}" ,
371
376
reply . comment . userName ,
372
377
( typeof reply . comment . body === 'string' ) ? reply . comment . body : reply . comment . body . value )
373
- ) . join ( '\n' ) ) ;
378
+ ) . join ( '\n' ) ;
379
+ }
380
+
381
+ private getReplyCountAsString ( node : CommentNode , forAriaLabel ?: boolean ) : string {
382
+ return node . replies . length && ! forAriaLabel ? nls . localize ( 'replyCount' , " {0} replies," , node . replies . length ) : '' ;
374
383
}
375
384
376
385
private createTree ( ) : void {
@@ -393,7 +402,7 @@ export class CommentsPanel extends FilterViewPane implements ICommentsView {
393
402
return nls . localize ( 'resourceWithCommentThreadsLabel' , "Comments in {0}, full path {1}" , basename ( element . resource ) , element . resource . fsPath ) ;
394
403
}
395
404
if ( element instanceof CommentNode ) {
396
- return this . getScreenReaderInfoForNode ( element , 'ariaLabel' ) ;
405
+ return this . getScreenReaderInfoForNode ( element , true ) ;
397
406
}
398
407
return '' ;
399
408
} ,
0 commit comments