mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
provide screen reader with inline suggestions (#175823)
This commit is contained in:
@@ -57,6 +57,10 @@ 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
|
||||
*/
|
||||
@@ -4754,6 +4758,7 @@ export const enum EditorOption {
|
||||
accessibilityPageSize,
|
||||
ariaLabel,
|
||||
autoClosingBrackets,
|
||||
screenReaderAnnounceInlineSuggestion,
|
||||
autoClosingDelete,
|
||||
autoClosingOvertype,
|
||||
autoClosingQuotes,
|
||||
@@ -4918,6 +4923,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('screenReaderAnnounceInlineSuggestion', "Control whether inline suggestions are announced by a screen reader. Note that this does not work on MacOS with VoiceOver."),
|
||||
tags: ['accessibility']
|
||||
}
|
||||
)),
|
||||
autoClosingBrackets: register(new EditorStringEnumOption(
|
||||
EditorOption.autoClosingBrackets, 'autoClosingBrackets',
|
||||
'languageDefined' as 'always' | 'languageDefined' | 'beforeWhitespace' | 'never',
|
||||
|
||||
@@ -179,140 +179,141 @@ export enum EditorOption {
|
||||
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 = 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
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,8 @@ 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 { alert } from 'vs/base/browser/ui/aria/aria';
|
||||
import { AudioCue, IAudioCueService } from 'vs/platform/audioCues/browser/audioCueService';
|
||||
|
||||
const ttPolicy = window.trustedTypes?.createPolicy('editorGhostText', { createHTML: value => value });
|
||||
|
||||
@@ -36,6 +38,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();
|
||||
|
||||
@@ -61,10 +64,8 @@ export class GhostTextWidget extends Disposable {
|
||||
this.viewMoreContentWidget = undefined;
|
||||
}));
|
||||
|
||||
this._register(model.onDidChange(() => {
|
||||
this.update();
|
||||
}));
|
||||
this.update();
|
||||
this._register(model.onDidChange(() => this.update(true)));
|
||||
this.update(true);
|
||||
}
|
||||
|
||||
public shouldShowHoverAtViewZone(viewZoneId: string): boolean {
|
||||
@@ -73,7 +74,7 @@ export class GhostTextWidget extends Disposable {
|
||||
|
||||
private readonly replacementDecoration = this._register(new DisposableDecorations(this.editor));
|
||||
|
||||
private update(): void {
|
||||
private update(notifyUser?: boolean): void {
|
||||
const ghostText = this.model.ghostText;
|
||||
|
||||
if (!this.editor.hasModel() || !ghostText || this.disposed) {
|
||||
@@ -157,6 +158,17 @@ export class GhostTextWidget extends Disposable {
|
||||
hiddenTextStartColumn !== undefined ? { column: hiddenTextStartColumn, length: textBufferLine.length + 1 - hiddenTextStartColumn } : undefined);
|
||||
this.additionalLinesWidget.updateLines(ghostText.lineNumber, additionalLines, ghostText.additionalReservedLineCount);
|
||||
|
||||
if (notifyUser) {
|
||||
this.audioCueService.playAudioCue(AudioCue.inlineSuggestion).then(() => {
|
||||
if (this.editor.getOption(EditorOption.screenReaderAnnounceInlineSuggestion)) {
|
||||
const lineText = this.editor.getModel()?.getLineContent(ghostText.lineNumber);
|
||||
if (lineText) {
|
||||
alert(ghostText.renderForScreenReader(lineText));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (0 < 0) {
|
||||
// Not supported at the moment, condition is always false.
|
||||
this.viewMoreContentWidget = this.renderViewMoreLines(
|
||||
|
||||
274
src/vs/monaco.d.ts
vendored
274
src/vs/monaco.d.ts
vendored
@@ -3029,6 +3029,10 @@ declare namespace monaco.editor {
|
||||
* 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
|
||||
*/
|
||||
@@ -4589,140 +4593,141 @@ declare namespace monaco.editor {
|
||||
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 = 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
|
||||
}
|
||||
|
||||
export const EditorOptions: {
|
||||
@@ -4731,6 +4736,7 @@ declare namespace monaco.editor {
|
||||
accessibilitySupport: IEditorOption<EditorOption.accessibilitySupport, AccessibilitySupport>;
|
||||
accessibilityPageSize: IEditorOption<EditorOption.accessibilityPageSize, number>;
|
||||
ariaLabel: IEditorOption<EditorOption.ariaLabel, string>;
|
||||
screenReaderAnnounceInlineSuggestion: IEditorOption<EditorOption.screenReaderAnnounceInlineSuggestion, boolean>;
|
||||
autoClosingBrackets: IEditorOption<EditorOption.autoClosingBrackets, 'always' | 'languageDefined' | 'beforeWhitespace' | 'never'>;
|
||||
autoClosingDelete: IEditorOption<EditorOption.autoClosingDelete, 'always' | 'never' | 'auto'>;
|
||||
autoClosingOvertype: IEditorOption<EditorOption.autoClosingOvertype, 'always' | 'never' | 'auto'>;
|
||||
|
||||
@@ -13,7 +13,6 @@ import { IMarkerService, MarkerSeverity } from 'vs/platform/markers/common/marke
|
||||
import { FoldingController } from 'vs/editor/contrib/folding/browser/folding';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { GhostTextController } from 'vs/editor/contrib/inlineCompletions/browser/ghostTextController';
|
||||
import { CursorChangeReason } from 'vs/editor/common/cursorEvents';
|
||||
import { autorun, autorunDelta, constObservable, debouncedObservable, derived, IObservable, observableFromEvent, observableFromPromise, wasEventTriggeredRecently } from 'vs/base/common/observable';
|
||||
import { AudioCue, IAudioCueService } from 'vs/platform/audioCues/browser/audioCueService';
|
||||
@@ -31,7 +30,6 @@ export class AudioCueLineFeatureContribution
|
||||
this.instantiationService.createInstance(MarkerLineFeature, AudioCue.warning, MarkerSeverity.Warning),
|
||||
this.instantiationService.createInstance(FoldedAreaLineFeature),
|
||||
this.instantiationService.createInstance(BreakpointLineFeature),
|
||||
this.instantiationService.createInstance(InlineCompletionLineFeature),
|
||||
];
|
||||
|
||||
private readonly isEnabledCache = new CachedFunction<AudioCue, IObservable<boolean>>((cue) => observableFromEvent(
|
||||
@@ -258,37 +256,3 @@ class BreakpointLineFeature implements LineFeature {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class InlineCompletionLineFeature implements LineFeature {
|
||||
public readonly audioCue = AudioCue.inlineSuggestion;
|
||||
|
||||
getObservableState(editor: ICodeEditor, _model: ITextModel): IObservable<LineFeatureState> {
|
||||
const ghostTextController = GhostTextController.get(editor);
|
||||
if (!ghostTextController) {
|
||||
return constObservable<LineFeatureState>({
|
||||
isPresent: () => false,
|
||||
});
|
||||
}
|
||||
|
||||
const activeGhostText = observableFromEvent(
|
||||
ghostTextController.onActiveModelDidChange,
|
||||
() => /** @description ghostTextController.onActiveModelDidChange */ ghostTextController.activeModel
|
||||
).map((activeModel) => (
|
||||
activeModel
|
||||
? observableFromEvent(
|
||||
activeModel.inlineCompletionsModel.onDidChange,
|
||||
() => /** @description activeModel.inlineCompletionsModel.onDidChange */ activeModel.inlineCompletionsModel.ghostText
|
||||
)
|
||||
: undefined
|
||||
));
|
||||
|
||||
return derived<LineFeatureState>('ghostText', reader => {
|
||||
const ghostText = activeGhostText.read(reader)?.read(reader);
|
||||
return {
|
||||
isPresent(position) {
|
||||
return ghostText?.lineNumber === position.lineNumber;
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user