diff --git a/src/vs/workbench/contrib/accessibility/browser/accessibilityContributions.ts b/src/vs/workbench/contrib/accessibility/browser/accessibilityContributions.ts index 11bf6795196..74e5dcdd655 100644 --- a/src/vs/workbench/contrib/accessibility/browser/accessibilityContributions.ts +++ b/src/vs/workbench/contrib/accessibility/browser/accessibilityContributions.ts @@ -37,7 +37,10 @@ import { ThemeIcon } from 'vs/base/common/themables'; import { Codicon } from 'vs/base/common/codicons'; import { InlineCompletionsController } from 'vs/editor/contrib/inlineCompletions/browser/inlineCompletionsController'; import { InlineCompletionContextKeys } from 'vs/editor/contrib/inlineCompletions/browser/inlineCompletionContextKeys'; -import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; +import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { CommentContextKeys } from 'vs/workbench/contrib/comments/common/commentContextKeys'; +import { ADD_COMMENT_COMMAND, NextCommentingRangeAction, PreviousCommentingRangeAction } from 'vs/workbench/contrib/comments/browser/commentsEditorContribution'; +import { CommentAccessibilityHelpNLS } from 'vs/workbench/contrib/comments/browser/comments.contribution'; export class EditorAccessibilityHelpContribution extends Disposable { static ID: 'editorAccessibilityHelpContribution'; @@ -66,7 +69,8 @@ class AccessibilityHelpProvider implements IAccessibleContentProvider { verbositySettingKey = AccessibilityVerbositySettingId.Editor; constructor( private readonly _editor: ICodeEditor, - @IKeybindingService private readonly _keybindingService: IKeybindingService + @IKeybindingService private readonly _keybindingService: IKeybindingService, + @IContextKeyService private readonly _contextKeyService: IContextKeyService ) { } @@ -96,6 +100,12 @@ class AccessibilityHelpProvider implements IAccessibleContentProvider { } } + if (this._contextKeyService.getContextKeyValue(CommentContextKeys.activeEditorHasCommentingRange.key)) { + content.push(this._descriptionForCommand(ADD_COMMENT_COMMAND, CommentAccessibilityHelpNLS.addComment, CommentAccessibilityHelpNLS.addCommentNoKb)); + content.push(this._descriptionForCommand(NextCommentingRangeAction.ID, CommentAccessibilityHelpNLS.nextRange, CommentAccessibilityHelpNLS.nextRangeNoKb)); + content.push(this._descriptionForCommand(PreviousCommentingRangeAction.ID, CommentAccessibilityHelpNLS.previousRange, CommentAccessibilityHelpNLS.previousRangeNoKb)); + } + if (options.get(EditorOption.stickyScroll).enabled) { content.push(this._descriptionForCommand('editor.action.focusStickyScroll', AccessibilityHelpNLS.stickScrollKb, AccessibilityHelpNLS.stickScrollNoKb)); } diff --git a/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts b/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts index 171730f7447..bfae89f49af 100644 --- a/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts +++ b/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts @@ -119,7 +119,11 @@ export class CommentThreadWidget extends })); this._register(tracker.onDidFocus(() => this._focusedContextKey.set(true))); this._register(tracker.onDidBlur(() => this._focusedContextKey.reset())); - + this._register(this.configurationService.onDidChangeConfiguration(e => { + if (e.affectsConfiguration(AccessibilityVerbositySettingId.Comments)) { + this._setAriaLabel(); + } + })); this._body = this._scopedInstantiationService.createInstance( CommentThreadBody, this._owner, diff --git a/src/vs/workbench/contrib/comments/browser/comments.contribution.ts b/src/vs/workbench/contrib/comments/browser/comments.contribution.ts index 7a56f0e89ab..96f7bd91ae9 100644 --- a/src/vs/workbench/contrib/comments/browser/comments.contribution.ts +++ b/src/vs/workbench/contrib/comments/browser/comments.contribution.ts @@ -67,12 +67,16 @@ Registry.as(ConfigurationExtensions.Configuration).regis registerSingleton(ICommentService, CommentService, InstantiationType.Delayed); -namespace CommentAccessibilityHelpNLS { +export namespace CommentAccessibilityHelpNLS { export const escape = nls.localize('escape', "Dismiss the comment widget via Escape."); - export const next = nls.localize('next', "Navigate to the next commenting range via ({0})."); - export const nextNoKb = nls.localize('nextNoKb', "Run the command: Go to Next Commenting Range, which is currently not triggerable via keybinding."); - export const previous = nls.localize('previous', "Navigate to the previous comment range via ({0})."); - export const previousNoKb = nls.localize('previousNoKb', "Run the command: Go to Previous Commenting Range, which is currently not triggerable via keybinding."); + export const nextRange = nls.localize('next', "Navigate to the next commenting range via ({0})."); + export const nextRangeNoKb = nls.localize('nextNoKb', "Run the command: Go to Next Commenting Range, which is currently not triggerable via keybinding."); + export const previousRange = nls.localize('previous', "Navigate to the previous comment range via ({0})."); + export const previousRangeNoKb = nls.localize('previousNoKb', "Run the command: Go to Previous Commenting Range, which is currently not triggerable via keybinding."); + export const nextCommentThreadKb = nls.localize('nextCommentThreadKb', "Navigate to the next comment thread via ({0})."); + export const nextCommentThreadNoKb = nls.localize('nextCommentThreadNoKb', "Run the command: Go to Next Comment Thread, which is currently not triggerable via keybinding."); + export const previousCommentThreadKb = nls.localize('previousCommentThreadKb', "Navigate to the previous comment thread via ({0})."); + export const previousCommentThreadNoKb = nls.localize('previousCommentThreadNoKb', "Run the command: Go to Previous Comment Thread, which is currently not triggerable via keybinding."); export const addComment = nls.localize('addComment', "Add a comment via ({0})."); export const addCommentNoKb = nls.localize('addCommentNoKb', "Add a comment via the command: Add Comment on Current Selection, which is currently not triggerable via keybinding."); export const submitComment = nls.localize('submitComment', "Submit the comment via ({0})."); @@ -112,8 +116,8 @@ export class CommentsAccessibilityHelpProvider implements IAccessibleContentProv const content: string[] = []; content.push(CommentAccessibilityHelpNLS.escape); content.push(this._descriptionForCommand(ADD_COMMENT_COMMAND, CommentAccessibilityHelpNLS.addComment, CommentAccessibilityHelpNLS.addCommentNoKb)); - content.push(this._descriptionForCommand(NextCommentingRangeAction.ID, CommentAccessibilityHelpNLS.next, CommentAccessibilityHelpNLS.nextNoKb)); - content.push(this._descriptionForCommand(PreviousCommentingRangeAction.ID, CommentAccessibilityHelpNLS.previous, CommentAccessibilityHelpNLS.previousNoKb)); + content.push(this._descriptionForCommand(NextCommentingRangeAction.ID, CommentAccessibilityHelpNLS.nextRange, CommentAccessibilityHelpNLS.nextRangeNoKb)); + content.push(this._descriptionForCommand(PreviousCommentingRangeAction.ID, CommentAccessibilityHelpNLS.previousRange, CommentAccessibilityHelpNLS.previousRangeNoKb)); content.push(this._descriptionForCommand(SUBMIT_COMMENT_COMMAND_ID, CommentAccessibilityHelpNLS.submitComment, CommentAccessibilityHelpNLS.submitCommentNoKb)); return content.join('\n\n'); }