Skip to content

Commit 7ee8137

Browse files
authored
Add a11y settings in getSimpleEditorOptions (microsoft#184623)
* Add a11y settings in getSimpleEditorOptions * Forgot a file * Fix AccessibleView * Rebase and fix merge conflict * Apply suggestion
1 parent e4751e3 commit 7ee8137

File tree

10 files changed

+15
-26
lines changed

10 files changed

+15
-26
lines changed

src/vs/workbench/contrib/accessibility/browser/accessibleView.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class AccessibleView extends Disposable {
6060
contributions: EditorExtensionsRegistry.getSomeEditorContributions([LinkDetector.ID, SelectionClipboardContributionID, 'editor.contrib.selectionAnchorController'])
6161
};
6262
const editorOptions: IEditorConstructionOptions = {
63-
...getSimpleEditorOptions(),
63+
...getSimpleEditorOptions(this._configurationService),
6464
lineDecorationsWidth: 6,
6565
dragAndDrop: true,
6666
cursorWidth: 1,
@@ -70,8 +70,6 @@ class AccessibleView extends Disposable {
7070
quickSuggestions: false,
7171
renderWhitespace: 'none',
7272
dropIntoEditor: { enabled: true },
73-
accessibilitySupport: this._configurationService.getValue<'auto' | 'off' | 'on'>('editor.accessibilitySupport'),
74-
cursorBlinking: this._configurationService.getValue('terminal.integrated.cursorBlinking'),
7573
readOnly: true
7674
};
7775
this._editorWidget = this._register(this._instantiationService.createInstance(CodeEditorWidget, this._editorContainer, editorOptions, codeEditorWidgetOptions));

src/vs/workbench/contrib/chat/browser/chatInputPart.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
190190
historyNavigationForwardsEnablement.set(enabled);
191191
};
192192

193-
const options = getSimpleEditorOptions();
193+
const options = getSimpleEditorOptions(this.configurationService);
194194
options.readOnly = false;
195195
options.ariaLabel = this._getAriaLabel();
196196
options.fontFamily = DEFAULT_FONT_FAMILY;

src/vs/workbench/contrib/chat/browser/chatListRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ class CodeBlockPart extends Disposable implements IChatResultCodeBlockPart {
612612
}));
613613
const editorElement = dom.append(this.element, $('.interactive-result-editor'));
614614
this.editor = this._register(scopedInstantiationService.createInstance(CodeEditorWidget, editorElement, {
615-
...getSimpleEditorOptions(),
615+
...getSimpleEditorOptions(this.configurationService),
616616
readOnly: true,
617617
lineNumbers: 'off',
618618
selectOnLineNumbers: true,

src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ import { MenuPreventer } from 'vs/workbench/contrib/codeEditor/browser/menuPreve
1212
import { SelectionClipboardContributionID } from 'vs/workbench/contrib/codeEditor/browser/selectionClipboard';
1313
import { TabCompletionController } from 'vs/workbench/contrib/snippets/browser/tabCompletion';
1414
import { EditorExtensionsRegistry } from 'vs/editor/browser/editorExtensions';
15+
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
1516

16-
export function getSimpleEditorOptions(): IEditorOptions {
17+
export function getSimpleEditorOptions(configurationService: IConfigurationService): IEditorOptions {
1718
return {
1819
wordWrap: 'on',
1920
overviewRulerLanes: 0,
@@ -39,7 +40,9 @@ export function getSimpleEditorOptions(): IEditorOptions {
3940
},
4041
guides: {
4142
indentation: false
42-
}
43+
},
44+
accessibilitySupport: configurationService.getValue<'auto' | 'off' | 'on'>('editor.accessibilitySupport'),
45+
cursorBlinking: configurationService.getValue<'blink' | 'smooth' | 'phase' | 'expand' | 'solid'>('editor.cursorBlinking')
4346
};
4447
}
4548

src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,9 @@ export class SuggestEnabledInput extends Widget {
155155
this.placeholderText = append(this.stylingContainer, $('.suggest-input-placeholder', undefined, options.placeholderText || ''));
156156

157157
const editorOptions: IEditorConstructionOptions = mixin(
158-
getSimpleEditorOptions(),
158+
getSimpleEditorOptions(configurationService),
159159
getSuggestEnabledInputOptions(ariaLabel));
160160
editorOptions.overflowWidgetsDomNode = options.overflowWidgetsDomNode;
161-
editorOptions.accessibilitySupport = configurationService.getValue<'auto' | 'off' | 'on'>('editor.accessibilitySupport');
162-
editorOptions.cursorBlinking = configurationService.getValue<'blink' | 'smooth' | 'phase' | 'expand' | 'solid'>('editor.cursorBlinking');
163161

164162
const scopedContextKeyService = this.getScopedContextKeyService(contextKeyService);
165163

src/vs/workbench/contrib/debug/browser/breakpointWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWi
291291

292292
private createEditorOptions(): IEditorOptions {
293293
const editorConfig = this._configurationService.getValue<IEditorOptions>('editor');
294-
const options = getSimpleEditorOptions();
294+
const options = getSimpleEditorOptions(this._configurationService);
295295
options.fontSize = editorConfig.fontSize;
296296
options.fontFamily = editorConfig.fontFamily;
297297
options.lineHeight = editorConfig.lineHeight;

src/vs/workbench/contrib/debug/browser/repl.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,15 +649,12 @@ export class Repl extends FilterViewPane implements IHistoryNavigationWidget {
649649
CONTEXT_IN_DEBUG_REPL.bindTo(this.scopedContextKeyService).set(true);
650650

651651
this.scopedInstantiationService = this.instantiationService.createChild(new ServiceCollection([IContextKeyService, this.scopedContextKeyService]));
652-
const options = getSimpleEditorOptions();
652+
const options = getSimpleEditorOptions(this.configurationService);
653653
options.readOnly = true;
654654
options.suggest = { showStatusBar: true };
655655
const config = this.configurationService.getValue<IDebugConfiguration>('debug');
656656
options.acceptSuggestionOnEnter = config.console.acceptSuggestionOnEnter === 'on' ? 'on' : 'off';
657657
options.ariaLabel = localize('debugConsole', "Debug Console");
658-
// We must respect some accessibility related settings
659-
options.accessibilitySupport = this.configurationService.getValue<'auto' | 'off' | 'on'>('editor.accessibilitySupport');
660-
options.cursorBlinking = this.configurationService.getValue<'blink' | 'smooth' | 'phase' | 'expand' | 'solid'>('editor.cursorBlinking');
661658

662659
this.replInput = this.scopedInstantiationService.createInstance(CodeEditorWidget, this.replInputContainer, options, getSimpleCodeEditorWidgetOptions());
663660

src/vs/workbench/contrib/interactive/browser/interactiveEditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export class InteractiveEditor extends EditorPane {
276276
overrideIdentifier = this.#codeEditorWidget.getModel()?.getLanguageId();
277277
}
278278
const editorOptions = deepClone(this.#configurationService.getValue<IEditorOptions>('editor', { overrideIdentifier }));
279-
const editorOptionsOverride = getSimpleEditorOptions();
279+
const editorOptionsOverride = getSimpleEditorOptions(this.#configurationService);
280280
const computed = Object.freeze({
281281
...editorOptions,
282282
...editorOptionsOverride,

src/vs/workbench/contrib/scm/browser/scmViewPane.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,17 +2005,14 @@ class SCMInputWidget {
20052005
const fontFamily = this.getInputEditorFontFamily();
20062006
const fontSize = this.getInputEditorFontSize();
20072007
const lineHeight = this.computeLineHeight(fontSize);
2008-
// We must respect some accessibility related settings
2009-
const accessibilitySupport = this.configurationService.getValue<'auto' | 'off' | 'on'>('editor.accessibilitySupport');
2010-
const cursorBlinking = this.configurationService.getValue<'blink' | 'smooth' | 'phase' | 'expand' | 'solid'>('editor.cursorBlinking');
20112008

20122009
this.setPlaceholderFontStyles(fontFamily, fontSize, lineHeight);
20132010

20142011
const contextKeyService2 = contextKeyService.createScoped(this.element);
20152012
this.repositoryIdContextKey = contextKeyService2.createKey('scmRepository', undefined);
20162013

20172014
const editorOptions: IEditorConstructionOptions = {
2018-
...getSimpleEditorOptions(),
2015+
...getSimpleEditorOptions(configurationService),
20192016
lineDecorationsWidth: 6,
20202017
dragAndDrop: true,
20212018
cursorWidth: 1,
@@ -2029,9 +2026,7 @@ class SCMInputWidget {
20292026
scrollbar: { alwaysConsumeMouseWheel: false },
20302027
overflowWidgetsDomNode,
20312028
renderWhitespace: 'none',
2032-
dropIntoEditor: { enabled: true },
2033-
accessibilitySupport,
2034-
cursorBlinking
2029+
dropIntoEditor: { enabled: true }
20352030
};
20362031

20372032
const codeEditorWidgetOptions: ICodeEditorWidgetOptions = {

src/vs/workbench/contrib/terminalContrib/accessibility/browser/terminalAccessibleWidget.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export abstract class TerminalAccessibleWidget extends DisposableStore {
6666
};
6767
const font = _xterm.getFont();
6868
const editorOptions: IEditorConstructionOptions = {
69-
...getSimpleEditorOptions(),
69+
...getSimpleEditorOptions(this._configurationService),
7070
lineDecorationsWidth: 6,
7171
dragAndDrop: true,
7272
cursorWidth: 1,
@@ -80,8 +80,6 @@ export abstract class TerminalAccessibleWidget extends DisposableStore {
8080
quickSuggestions: false,
8181
renderWhitespace: 'none',
8282
dropIntoEditor: { enabled: true },
83-
accessibilitySupport: this._configurationService.getValue<'auto' | 'off' | 'on'>('editor.accessibilitySupport'),
84-
cursorBlinking: this._configurationService.getValue('terminal.integrated.cursorBlinking'),
8583
readOnly: true
8684
};
8785
this._editorWidget = this.add(this._instantiationService.createInstance(CodeEditorWidget, this._editorContainer, editorOptions, codeEditorWidgetOptions));

0 commit comments

Comments
 (0)