Skip to content
13 changes: 13 additions & 0 deletions src/vs/editor/common/config/editorOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ export interface IEditorOptions {
* The aria label for the editor's textarea (when it is focused).
*/
ariaLabel?: string;

/**
* Control whether a screen reader announces inline suggestion content immediately.
*/
screenReaderAnnounceInlineSuggestion?: boolean;
/**
* The `tabindex` property of the editor's textarea
*/
Expand Down Expand Up @@ -4752,6 +4757,7 @@ export const enum EditorOption {
acceptSuggestionOnEnter,
accessibilitySupport,
accessibilityPageSize,
screenReaderAnnounceInlineSuggestion,
ariaLabel,
autoClosingBrackets,
autoClosingDelete,
Expand Down Expand Up @@ -4918,6 +4924,13 @@ export const EditorOptions = {
ariaLabel: register(new EditorStringOption(
EditorOption.ariaLabel, 'ariaLabel', nls.localize('editorViewAccessibleLabel', "Editor content")
)),
screenReaderAnnounceInlineSuggestion: register(new EditorBooleanOption(
EditorOption.screenReaderAnnounceInlineSuggestion, 'screenReaderAnnounceInlineSuggestion', false,
{
description: nls.localize('ariaAssertiveInlineSuggestion', "Control whether aria-live assertive & role alert are on the inline suggestion element so that a screen reader detects it immediately."),
tags: ['accessibility']
}
)),
autoClosingBrackets: register(new EditorStringEnumOption(
EditorOption.autoClosingBrackets, 'autoClosingBrackets',
'languageDefined' as 'always' | 'languageDefined' | 'beforeWhitespace' | 'never',
Expand Down
273 changes: 137 additions & 136 deletions src/vs/editor/common/standalone/standaloneEnums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,142 +177,143 @@ export enum EditorOption {
acceptSuggestionOnEnter = 1,
accessibilitySupport = 2,
accessibilityPageSize = 3,
ariaLabel = 4,
autoClosingBrackets = 5,
autoClosingDelete = 6,
autoClosingOvertype = 7,
autoClosingQuotes = 8,
autoIndent = 9,
automaticLayout = 10,
autoSurround = 11,
bracketPairColorization = 12,
guides = 13,
codeLens = 14,
codeLensFontFamily = 15,
codeLensFontSize = 16,
colorDecorators = 17,
colorDecoratorsLimit = 18,
columnSelection = 19,
comments = 20,
contextmenu = 21,
copyWithSyntaxHighlighting = 22,
cursorBlinking = 23,
cursorSmoothCaretAnimation = 24,
cursorStyle = 25,
cursorSurroundingLines = 26,
cursorSurroundingLinesStyle = 27,
cursorWidth = 28,
disableLayerHinting = 29,
disableMonospaceOptimizations = 30,
domReadOnly = 31,
dragAndDrop = 32,
dropIntoEditor = 33,
emptySelectionClipboard = 34,
experimentalWhitespaceRendering = 35,
extraEditorClassName = 36,
fastScrollSensitivity = 37,
find = 38,
fixedOverflowWidgets = 39,
folding = 40,
foldingStrategy = 41,
foldingHighlight = 42,
foldingImportsByDefault = 43,
foldingMaximumRegions = 44,
unfoldOnClickAfterEndOfLine = 45,
fontFamily = 46,
fontInfo = 47,
fontLigatures = 48,
fontSize = 49,
fontWeight = 50,
fontVariations = 51,
formatOnPaste = 52,
formatOnType = 53,
glyphMargin = 54,
gotoLocation = 55,
hideCursorInOverviewRuler = 56,
hover = 57,
inDiffEditor = 58,
inlineSuggest = 59,
letterSpacing = 60,
lightbulb = 61,
lineDecorationsWidth = 62,
lineHeight = 63,
lineNumbers = 64,
lineNumbersMinChars = 65,
linkedEditing = 66,
links = 67,
matchBrackets = 68,
minimap = 69,
mouseStyle = 70,
mouseWheelScrollSensitivity = 71,
mouseWheelZoom = 72,
multiCursorMergeOverlapping = 73,
multiCursorModifier = 74,
multiCursorPaste = 75,
multiCursorLimit = 76,
occurrencesHighlight = 77,
overviewRulerBorder = 78,
overviewRulerLanes = 79,
padding = 80,
parameterHints = 81,
peekWidgetDefaultFocus = 82,
definitionLinkOpensInPeek = 83,
quickSuggestions = 84,
quickSuggestionsDelay = 85,
readOnly = 86,
renameOnType = 87,
renderControlCharacters = 88,
renderFinalNewline = 89,
renderLineHighlight = 90,
renderLineHighlightOnlyWhenFocus = 91,
renderValidationDecorations = 92,
renderWhitespace = 93,
revealHorizontalRightPadding = 94,
roundedSelection = 95,
rulers = 96,
scrollbar = 97,
scrollBeyondLastColumn = 98,
scrollBeyondLastLine = 99,
scrollPredominantAxis = 100,
selectionClipboard = 101,
selectionHighlight = 102,
selectOnLineNumbers = 103,
showFoldingControls = 104,
showUnused = 105,
snippetSuggestions = 106,
smartSelect = 107,
smoothScrolling = 108,
stickyScroll = 109,
stickyTabStops = 110,
stopRenderingLineAfter = 111,
suggest = 112,
suggestFontSize = 113,
suggestLineHeight = 114,
suggestOnTriggerCharacters = 115,
suggestSelection = 116,
tabCompletion = 117,
tabIndex = 118,
unicodeHighlighting = 119,
unusualLineTerminators = 120,
useShadowDOM = 121,
useTabStops = 122,
wordBreak = 123,
wordSeparators = 124,
wordWrap = 125,
wordWrapBreakAfterCharacters = 126,
wordWrapBreakBeforeCharacters = 127,
wordWrapColumn = 128,
wordWrapOverride1 = 129,
wordWrapOverride2 = 130,
wrappingIndent = 131,
wrappingStrategy = 132,
showDeprecated = 133,
inlayHints = 134,
editorClassName = 135,
pixelRatio = 136,
tabFocusMode = 137,
layoutInfo = 138,
wrappingInfo = 139
screenReaderAnnounceInlineSuggestion = 4,
ariaLabel = 5,
autoClosingBrackets = 6,
autoClosingDelete = 7,
autoClosingOvertype = 8,
autoClosingQuotes = 9,
autoIndent = 10,
automaticLayout = 11,
autoSurround = 12,
bracketPairColorization = 13,
guides = 14,
codeLens = 15,
codeLensFontFamily = 16,
codeLensFontSize = 17,
colorDecorators = 18,
colorDecoratorsLimit = 19,
columnSelection = 20,
comments = 21,
contextmenu = 22,
copyWithSyntaxHighlighting = 23,
cursorBlinking = 24,
cursorSmoothCaretAnimation = 25,
cursorStyle = 26,
cursorSurroundingLines = 27,
cursorSurroundingLinesStyle = 28,
cursorWidth = 29,
disableLayerHinting = 30,
disableMonospaceOptimizations = 31,
domReadOnly = 32,
dragAndDrop = 33,
dropIntoEditor = 34,
emptySelectionClipboard = 35,
experimentalWhitespaceRendering = 36,
extraEditorClassName = 37,
fastScrollSensitivity = 38,
find = 39,
fixedOverflowWidgets = 40,
folding = 41,
foldingStrategy = 42,
foldingHighlight = 43,
foldingImportsByDefault = 44,
foldingMaximumRegions = 45,
unfoldOnClickAfterEndOfLine = 46,
fontFamily = 47,
fontInfo = 48,
fontLigatures = 49,
fontSize = 50,
fontWeight = 51,
fontVariations = 52,
formatOnPaste = 53,
formatOnType = 54,
glyphMargin = 55,
gotoLocation = 56,
hideCursorInOverviewRuler = 57,
hover = 58,
inDiffEditor = 59,
inlineSuggest = 60,
letterSpacing = 61,
lightbulb = 62,
lineDecorationsWidth = 63,
lineHeight = 64,
lineNumbers = 65,
lineNumbersMinChars = 66,
linkedEditing = 67,
links = 68,
matchBrackets = 69,
minimap = 70,
mouseStyle = 71,
mouseWheelScrollSensitivity = 72,
mouseWheelZoom = 73,
multiCursorMergeOverlapping = 74,
multiCursorModifier = 75,
multiCursorPaste = 76,
multiCursorLimit = 77,
occurrencesHighlight = 78,
overviewRulerBorder = 79,
overviewRulerLanes = 80,
padding = 81,
parameterHints = 82,
peekWidgetDefaultFocus = 83,
definitionLinkOpensInPeek = 84,
quickSuggestions = 85,
quickSuggestionsDelay = 86,
readOnly = 87,
renameOnType = 88,
renderControlCharacters = 89,
renderFinalNewline = 90,
renderLineHighlight = 91,
renderLineHighlightOnlyWhenFocus = 92,
renderValidationDecorations = 93,
renderWhitespace = 94,
revealHorizontalRightPadding = 95,
roundedSelection = 96,
rulers = 97,
scrollbar = 98,
scrollBeyondLastColumn = 99,
scrollBeyondLastLine = 100,
scrollPredominantAxis = 101,
selectionClipboard = 102,
selectionHighlight = 103,
selectOnLineNumbers = 104,
showFoldingControls = 105,
showUnused = 106,
snippetSuggestions = 107,
smartSelect = 108,
smoothScrolling = 109,
stickyScroll = 110,
stickyTabStops = 111,
stopRenderingLineAfter = 112,
suggest = 113,
suggestFontSize = 114,
suggestLineHeight = 115,
suggestOnTriggerCharacters = 116,
suggestSelection = 117,
tabCompletion = 118,
tabIndex = 119,
unicodeHighlighting = 120,
unusualLineTerminators = 121,
useShadowDOM = 122,
useTabStops = 123,
wordBreak = 124,
wordSeparators = 125,
wordWrap = 126,
wordWrapBreakAfterCharacters = 127,
wordWrapBreakBeforeCharacters = 128,
wordWrapColumn = 129,
wordWrapOverride1 = 130,
wordWrapOverride2 = 131,
wrappingIndent = 132,
wrappingStrategy = 133,
showDeprecated = 134,
inlayHints = 135,
editorClassName = 136,
pixelRatio = 137,
tabFocusMode = 138,
layoutInfo = 139,
wrappingInfo = 140
}

/**
Expand Down
10 changes: 10 additions & 0 deletions src/vs/editor/contrib/inlineCompletions/browser/ghostTextWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { RenderLineInput, renderViewLine } from 'vs/editor/common/viewLayout/vie
import { InlineDecorationType } from 'vs/editor/common/viewModel';
import { GhostTextReplacement, GhostTextWidgetModel } from 'vs/editor/contrib/inlineCompletions/browser/ghostText';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { AudioCue, IAudioCueService } from 'vs/platform/audioCues/browser/audioCueService';

const ttPolicy = window.trustedTypes?.createPolicy('editorGhostText', { createHTML: value => value });

Expand All @@ -36,6 +37,7 @@ export class GhostTextWidget extends Disposable {
private readonly model: GhostTextWidgetModel,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@ILanguageService private readonly languageService: ILanguageService,
@IAudioCueService private readonly audioCueService: IAudioCueService
) {
super();

Expand Down Expand Up @@ -157,6 +159,14 @@ export class GhostTextWidget extends Disposable {
hiddenTextStartColumn !== undefined ? { column: hiddenTextStartColumn, length: textBufferLine.length + 1 - hiddenTextStartColumn } : undefined);
this.additionalLinesWidget.updateLines(ghostText.lineNumber, additionalLines, ghostText.additionalReservedLineCount);


this.audioCueService.playAudioCue(AudioCue.inlineSuggestion).then(() => {
if (this.editor.getOption(EditorOption.screenReaderAnnounceInlineSuggestion)) {
const lineText = this.editor.getModel()!.getLineContent(ghostText.lineNumber);
alert(ghostText.renderForScreenReader(lineText));
}
});

if (0 < 0) {
// Not supported at the moment, condition is always false.
this.viewMoreContentWidget = this.renderViewMoreLines(
Expand Down
Loading