commonEditorConfig.ts 46.8 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

A
Alex Dima 已提交
6
import * as nls from 'vs/nls';
A
Alex Dima 已提交
7
import { Emitter, Event } from 'vs/base/common/event';
J
Johannes Rieken 已提交
8
import { Disposable } from 'vs/base/common/lifecycle';
A
Alex Dima 已提交
9
import * as objects from 'vs/base/common/objects';
A
Alex Dima 已提交
10
import * as platform from 'vs/base/common/platform';
11
import * as editorOptions from 'vs/editor/common/config/editorOptions';
A
Alex Dima 已提交
12 13 14 15 16
import { EditorZoom } from 'vs/editor/common/config/editorZoom';
import { BareFontInfo, FontInfo } from 'vs/editor/common/config/fontInfo';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { ConfigurationScope, Extensions, IConfigurationNode, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
17 18 19
import EDITOR_DEFAULTS = editorOptions.EDITOR_DEFAULTS;
import EDITOR_FONT_DEFAULTS = editorOptions.EDITOR_FONT_DEFAULTS;
import EDITOR_MODEL_DEFAULTS = editorOptions.EDITOR_MODEL_DEFAULTS;
20
import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
E
Erich Gamma 已提交
21

22 23 24 25 26 27 28
/**
 * Control what pressing Tab does.
 * If it is false, pressing Tab or Shift-Tab will be handled by the editor.
 * If it is true, pressing Tab or Shift-Tab will move the browser focus.
 * Defaults to false.
 */
export interface ITabFocus {
J
Johannes Rieken 已提交
29
	onDidChangeTabFocus: Event<boolean>;
30
	getTabFocusMode(): boolean;
J
Johannes Rieken 已提交
31
	setTabFocusMode(tabFocusMode: boolean): void;
32 33
}

A
Alex Dima 已提交
34
export const TabFocus: ITabFocus = new class implements ITabFocus {
35 36
	private _tabFocus: boolean = false;

37
	private readonly _onDidChangeTabFocus = new Emitter<boolean>();
38
	public readonly onDidChangeTabFocus: Event<boolean> = this._onDidChangeTabFocus.event;
39 40 41 42 43

	public getTabFocusMode(): boolean {
		return this._tabFocus;
	}

J
Johannes Rieken 已提交
44
	public setTabFocusMode(tabFocusMode: boolean): void {
45 46 47 48 49 50 51 52 53
		if (this._tabFocus === tabFocusMode) {
			return;
		}

		this._tabFocus = tabFocusMode;
		this._onDidChangeTabFocus.fire(this._tabFocus);
	}
};

A
Alex Dima 已提交
54 55 56 57
export interface IEnvConfiguration {
	extraEditorClassName: string;
	outerWidth: number;
	outerHeight: number;
58
	emptySelectionClipboard: boolean;
A
Alex Dima 已提交
59 60
	pixelRatio: number;
	zoomLevel: number;
61
	accessibilitySupport: AccessibilitySupport;
62 63
}

64 65
const hasOwnProperty = Object.hasOwnProperty;

A
Alex Dima 已提交
66
export abstract class CommonEditorConfiguration extends Disposable implements editorCommon.IConfiguration {
E
Erich Gamma 已提交
67

68 69
	protected _rawOptions: editorOptions.IEditorOptions;
	protected _validatedOptions: editorOptions.IValidatedEditorOptions;
70
	public editor: editorOptions.InternalEditorOptions;
J
Johannes Rieken 已提交
71
	private _isDominatedByLongLines: boolean;
72
	private _lineNumbersDigitCount: number;
E
Erich Gamma 已提交
73

74
	private _onDidChange = this._register(new Emitter<editorOptions.IConfigurationChangedEvent>());
75
	public readonly onDidChange: Event<editorOptions.IConfigurationChangedEvent> = this._onDidChange.event;
A
Alex Dima 已提交
76

A
Alex Dima 已提交
77
	constructor(options: editorOptions.IEditorOptions) {
A
Alex Dima 已提交
78
		super();
79

80 81 82 83 84
		// Do a "deep clone of sorts" on the incoming options
		this._rawOptions = objects.mixin({}, options || {});
		this._rawOptions.scrollbar = objects.mixin({}, this._rawOptions.scrollbar || {});
		this._rawOptions.minimap = objects.mixin({}, this._rawOptions.minimap || {});
		this._rawOptions.find = objects.mixin({}, this._rawOptions.find || {});
A
Alex Dima 已提交
85
		this._rawOptions.hover = objects.mixin({}, this._rawOptions.hover || {});
86
		this._rawOptions.parameterHints = objects.mixin({}, this._rawOptions.parameterHints || {});
87

88
		this._validatedOptions = editorOptions.EditorOptionsValidator.validate(this._rawOptions, EDITOR_DEFAULTS);
E
Erich Gamma 已提交
89
		this._isDominatedByLongLines = false;
90
		this._lineNumbersDigitCount = 1;
A
Alex Dima 已提交
91

92
		this._register(EditorZoom.onDidChangeZoomLevel(_ => this._recomputeOptions()));
93
		this._register(TabFocus.onDidChangeTabFocus(_ => this._recomputeOptions()));
E
Erich Gamma 已提交
94 95
	}

A
Alex Dima 已提交
96 97 98
	public observeReferenceElement(dimension?: editorCommon.IDimension): void {
	}

E
Erich Gamma 已提交
99 100 101 102 103
	public dispose(): void {
		super.dispose();
	}

	protected _recomputeOptions(): void {
A
Alex Dima 已提交
104 105
		const oldOptions = this.editor;
		const newOptions = this._computeInternalOptions();
106

A
Alex Dima 已提交
107
		if (oldOptions && oldOptions.equals(newOptions)) {
108
			return;
E
Erich Gamma 已提交
109 110
		}

111
		this.editor = newOptions;
E
Erich Gamma 已提交
112

A
Alex Dima 已提交
113 114
		if (oldOptions) {
			this._onDidChange.fire(oldOptions.createChangeEvent(newOptions));
115
		}
E
Erich Gamma 已提交
116
	}
117

118
	public getRawOptions(): editorOptions.IEditorOptions {
119
		return this._rawOptions;
E
Erich Gamma 已提交
120
	}
121

122
	private _computeInternalOptions(): editorOptions.InternalEditorOptions {
123
		const opts = this._validatedOptions;
A
Alex Dima 已提交
124 125
		const partialEnv = this._getEnvConfiguration();
		const bareFontInfo = BareFontInfo.createFromRawSettings(this._rawOptions, partialEnv.zoomLevel);
A
Alex Dima 已提交
126
		const env: editorOptions.IEnvironmentalOptions = {
A
Alex Dima 已提交
127 128
			outerWidth: partialEnv.outerWidth,
			outerHeight: partialEnv.outerHeight,
129
			fontInfo: this.readConfiguration(bareFontInfo),
130
			extraEditorClassName: partialEnv.extraEditorClassName,
131 132
			isDominatedByLongLines: this._isDominatedByLongLines,
			lineNumbersDigitCount: this._lineNumbersDigitCount,
133
			emptySelectionClipboard: partialEnv.emptySelectionClipboard,
A
Alex Dima 已提交
134
			pixelRatio: partialEnv.pixelRatio,
135 136
			tabFocusMode: TabFocus.getTabFocusMode(),
			accessibilitySupport: partialEnv.accessibilitySupport
A
Alex Dima 已提交
137
		};
138
		return editorOptions.InternalEditorOptionsFactory.createInternalEditorOptions(env, opts);
E
Erich Gamma 已提交
139 140
	}

141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
	private static _primitiveArrayEquals(a: any[], b: any[]): boolean {
		if (a.length !== b.length) {
			return false;
		}
		for (let i = 0; i < a.length; i++) {
			if (a[i] !== b[i]) {
				return false;
			}
		}
		return true;
	}

	private static _subsetEquals(base: object, subset: object): boolean {
		for (let key in subset) {
			if (hasOwnProperty.call(subset, key)) {
				const subsetValue = subset[key];
				const baseValue = base[key];

				if (baseValue === subsetValue) {
					continue;
				}
				if (Array.isArray(baseValue) && Array.isArray(subsetValue)) {
					if (!this._primitiveArrayEquals(baseValue, subsetValue)) {
						return false;
					}
					continue;
				}
				if (typeof baseValue === 'object' && typeof subsetValue === 'object') {
					if (!this._subsetEquals(baseValue, subsetValue)) {
						return false;
					}
					continue;
				}

				return false;
			}
		}
		return true;
	}

181
	public updateOptions(newOptions: editorOptions.IEditorOptions): void {
182 183 184 185 186 187
		if (typeof newOptions === 'undefined') {
			return;
		}
		if (CommonEditorConfiguration._subsetEquals(this._rawOptions, newOptions)) {
			return;
		}
188
		this._rawOptions = objects.mixin(this._rawOptions, newOptions || {});
189
		this._validatedOptions = editorOptions.EditorOptionsValidator.validate(this._rawOptions, EDITOR_DEFAULTS);
E
Erich Gamma 已提交
190 191 192
		this._recomputeOptions();
	}

J
Johannes Rieken 已提交
193
	public setIsDominatedByLongLines(isDominatedByLongLines: boolean): void {
E
Erich Gamma 已提交
194 195 196 197
		this._isDominatedByLongLines = isDominatedByLongLines;
		this._recomputeOptions();
	}

J
Johannes Rieken 已提交
198
	public setMaxLineNumber(maxLineNumber: number): void {
199
		let digitCount = CommonEditorConfiguration._digitCount(maxLineNumber);
200
		if (this._lineNumbersDigitCount === digitCount) {
A
Alex Dima 已提交
201 202
			return;
		}
203
		this._lineNumbersDigitCount = digitCount;
E
Erich Gamma 已提交
204 205 206
		this._recomputeOptions();
	}

207
	private static _digitCount(n: number): number {
A
Alex Dima 已提交
208
		let r = 0;
209 210 211 212 213 214
		while (n) {
			n = Math.floor(n / 10);
			r++;
		}
		return r ? r : 1;
	}
A
Alex Dima 已提交
215
	protected abstract _getEnvConfiguration(): IEnvConfiguration;
216

217
	protected abstract readConfiguration(styling: BareFontInfo): FontInfo;
218

E
Erich Gamma 已提交
219 220
}

221
const configurationRegistry = Registry.as<IConfigurationRegistry>(Extensions.Configuration);
222
const editorConfiguration: IConfigurationNode = {
E
Erich Gamma 已提交
223 224 225
	'id': 'editor',
	'order': 5,
	'type': 'object',
226
	'title': nls.localize('editorConfigurationTitle', "Editor"),
227
	'overridable': true,
S
Sandeep Somavarapu 已提交
228
	'scope': ConfigurationScope.RESOURCE,
J
Johannes Rieken 已提交
229 230
	'properties': {
		'editor.fontFamily': {
E
Erich Gamma 已提交
231
			'type': 'string',
232
			'default': EDITOR_FONT_DEFAULTS.fontFamily,
E
Erich Gamma 已提交
233 234
			'description': nls.localize('fontFamily', "Controls the font family.")
		},
J
Johannes Rieken 已提交
235
		'editor.fontWeight': {
236
			'type': 'string',
237
			'enum': ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
238
			'default': EDITOR_FONT_DEFAULTS.fontWeight,
239 240
			'description': nls.localize('fontWeight', "Controls the font weight.")
		},
J
Johannes Rieken 已提交
241
		'editor.fontSize': {
E
Erich Gamma 已提交
242
			'type': 'number',
243
			'default': EDITOR_FONT_DEFAULTS.fontSize,
244
			'description': nls.localize('fontSize', "Controls the font size in pixels.")
E
Erich Gamma 已提交
245
		},
J
Johannes Rieken 已提交
246
		'editor.lineHeight': {
E
Erich Gamma 已提交
247
			'type': 'number',
248
			'default': EDITOR_FONT_DEFAULTS.lineHeight,
S
SteVen Batten 已提交
249
			'description': nls.localize('lineHeight', "Controls the line height. Use 0 to compute the line height from the font size.")
E
Erich Gamma 已提交
250
		},
251 252
		'editor.letterSpacing': {
			'type': 'number',
253
			'default': EDITOR_FONT_DEFAULTS.letterSpacing,
254 255
			'description': nls.localize('letterSpacing', "Controls the letter spacing in pixels.")
		},
J
Johannes Rieken 已提交
256
		'editor.lineNumbers': {
257
			'type': 'string',
258
			'enum': ['off', 'on', 'relative', 'interval'],
259 260 261
			'enumDescriptions': [
				nls.localize('lineNumbers.off', "Line numbers are not rendered."),
				nls.localize('lineNumbers.on', "Line numbers are rendered as absolute number."),
262 263
				nls.localize('lineNumbers.relative', "Line numbers are rendered as distance in lines to cursor position."),
				nls.localize('lineNumbers.interval', "Line numbers are rendered every 10 lines.")
264
			],
265
			'default': 'on',
A
Alex Dima 已提交
266
			'description': nls.localize('lineNumbers', "Controls the display of line numbers.")
E
Erich Gamma 已提交
267
		},
A
Alex Dima 已提交
268
		'editor.renderFinalNewline': {
269
			'type': 'boolean',
A
Alex Dima 已提交
270 271
			'default': EDITOR_DEFAULTS.viewInfo.renderFinalNewline,
			'description': nls.localize('renderFinalNewline', "Render last line number when the file ends with a newline.")
272
		},
J
Johannes Rieken 已提交
273
		'editor.rulers': {
274 275 276 277
			'type': 'array',
			'items': {
				'type': 'number'
			},
A
Alex Dima 已提交
278
			'default': EDITOR_DEFAULTS.viewInfo.rulers,
S
SteVen Batten 已提交
279
			'description': nls.localize('rulers', "Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty.")
280
		},
J
Johannes Rieken 已提交
281
		'editor.wordSeparators': {
A
Alex Dima 已提交
282
			'type': 'string',
283
			'default': EDITOR_DEFAULTS.wordSeparators,
M
Matt Bierner 已提交
284
			'description': nls.localize('wordSeparators', "Characters that will be used as word separators when doing word related navigations or operations.")
A
Alex Dima 已提交
285
		},
J
Johannes Rieken 已提交
286
		'editor.tabSize': {
287
			'type': 'number',
288
			'default': EDITOR_MODEL_DEFAULTS.tabSize,
E
Erich Gamma 已提交
289
			'minimum': 1,
290
			'markdownDescription': nls.localize('tabSize', "The number of spaces a tab is equal to. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.")
E
Erich Gamma 已提交
291
		},
292 293 294 295 296 297 298 299 300 301 302 303 304 305
		// 'editor.indentSize': {
		// 	'anyOf': [
		// 		{
		// 			'type': 'string',
		// 			'enum': ['tabSize']
		// 		},
		// 		{
		// 			'type': 'number',
		// 			'minimum': 1
		// 		}
		// 	],
		// 	'default': 'tabSize',
		// 	'markdownDescription': nls.localize('indentSize', "The number of spaces used for indentation or 'tabSize' to use the value from `#editor.tabSize#`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.")
		// },
J
Johannes Rieken 已提交
306
		'editor.insertSpaces': {
307
			'type': 'boolean',
308
			'default': EDITOR_MODEL_DEFAULTS.insertSpaces,
309
			'markdownDescription': nls.localize('insertSpaces', "Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.")
E
Erich Gamma 已提交
310
		},
J
Johannes Rieken 已提交
311
		'editor.detectIndentation': {
312
			'type': 'boolean',
313
			'default': EDITOR_MODEL_DEFAULTS.detectIndentation,
314
			'markdownDescription': nls.localize('detectIndentation', "Controls whether `#editor.tabSize#` and `#editor.insertSpaces#` will be automatically detected when a file is opened based on the file contents.")
315
		},
J
Johannes Rieken 已提交
316
		'editor.roundedSelection': {
E
Erich Gamma 已提交
317
			'type': 'boolean',
A
Alex Dima 已提交
318
			'default': EDITOR_DEFAULTS.viewInfo.roundedSelection,
319
			'description': nls.localize('roundedSelection', "Controls whether selections should have rounded corners.")
E
Erich Gamma 已提交
320
		},
J
Johannes Rieken 已提交
321
		'editor.scrollBeyondLastLine': {
E
Erich Gamma 已提交
322
			'type': 'boolean',
A
Alex Dima 已提交
323
			'default': EDITOR_DEFAULTS.viewInfo.scrollBeyondLastLine,
S
SteVen Batten 已提交
324
			'description': nls.localize('scrollBeyondLastLine', "Controls whether the editor will scroll beyond the last line.")
E
Erich Gamma 已提交
325
		},
326 327 328
		'editor.scrollBeyondLastColumn': {
			'type': 'number',
			'default': EDITOR_DEFAULTS.viewInfo.scrollBeyondLastColumn,
S
SteVen Batten 已提交
329
			'description': nls.localize('scrollBeyondLastColumn', "Controls the number of extra characters beyond which the editor will scroll horizontally.")
330
		},
331 332 333
		'editor.smoothScrolling': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.viewInfo.smoothScrolling,
334
			'description': nls.localize('smoothScrolling', "Controls whether the editor will scroll using an animation.")
335
		},
336 337
		'editor.minimap.enabled': {
			'type': 'boolean',
A
Alex Dima 已提交
338
			'default': EDITOR_DEFAULTS.viewInfo.minimap.enabled,
S
SteVen Batten 已提交
339
			'description': nls.localize('minimap.enabled', "Controls whether the minimap is shown.")
340
		},
341 342 343 344
		'editor.minimap.side': {
			'type': 'string',
			'enum': ['left', 'right'],
			'default': EDITOR_DEFAULTS.viewInfo.minimap.side,
A
Alex Dima 已提交
345
			'description': nls.localize('minimap.side', "Controls the side where to render the minimap.")
346
		},
347 348 349 350
		'editor.minimap.showSlider': {
			'type': 'string',
			'enum': ['always', 'mouseover'],
			'default': EDITOR_DEFAULTS.viewInfo.minimap.showSlider,
A
Alex Dima 已提交
351
			'description': nls.localize('minimap.showSlider', "Controls whether the minimap slider is automatically hidden.")
352
		},
353
		'editor.minimap.renderCharacters': {
354
			'type': 'boolean',
A
Alex Dima 已提交
355
			'default': EDITOR_DEFAULTS.viewInfo.minimap.renderCharacters,
S
SteVen Batten 已提交
356
			'description': nls.localize('minimap.renderCharacters', "Render the actual characters on a line as opposed to color blocks.")
357
		},
A
Alex Dima 已提交
358 359
		'editor.minimap.maxColumn': {
			'type': 'number',
A
Alex Dima 已提交
360
			'default': EDITOR_DEFAULTS.viewInfo.minimap.maxColumn,
S
SteVen Batten 已提交
361
			'description': nls.localize('minimap.maxColumn', "Limit the width of the minimap to render at most a certain number of columns.")
A
Alex Dima 已提交
362
		},
A
Alex Dima 已提交
363 364 365
		'editor.hover.enabled': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.hover.enabled,
366
			'description': nls.localize('hover.enabled', "Controls whether the hover is shown.")
A
Alex Dima 已提交
367
		},
368 369 370
		'editor.hover.delay': {
			'type': 'number',
			'default': EDITOR_DEFAULTS.contribInfo.hover.delay,
371
			'description': nls.localize('hover.delay', "Controls the delay in milliseconds after which the hover is shown.")
372
		},
373 374 375
		'editor.hover.sticky': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.hover.sticky,
376
			'description': nls.localize('hover.sticky', "Controls whether the hover should remain visible when mouse is moved over it.")
377
		},
378 379 380
		'editor.find.seedSearchStringFromSelection': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.find.seedSearchStringFromSelection,
381
			'description': nls.localize('find.seedSearchStringFromSelection', "Controls whether the search string in the Find Widget is seeded from the editor selection.")
382
		},
R
rebornix 已提交
383 384 385
		'editor.find.autoFindInSelection': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.find.autoFindInSelection,
386
			'description': nls.localize('find.autoFindInSelection', "Controls whether the find operation is carried out on selected text or the entire file in the editor.")
R
rebornix 已提交
387
		},
388 389 390
		'editor.find.globalFindClipboard': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.find.globalFindClipboard,
391
			'description': nls.localize('find.globalFindClipboard', "Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),
392
			'included': platform.isMacintosh
393
		},
394 395 396
		'editor.find.addExtraSpaceOnTop': {
			'type': 'boolean',
			'default': true,
P
Peng Lyu 已提交
397
			'description': nls.localize('find.addExtraSpaceOnTop', "Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.")
398
		},
J
Johannes Rieken 已提交
399
		'editor.wordWrap': {
400
			'type': 'string',
A
Alex Dima 已提交
401
			'enum': ['off', 'on', 'wordWrapColumn', 'bounded'],
402
			'markdownEnumDescriptions': [
403 404
				nls.localize('wordWrap.off', "Lines will never wrap."),
				nls.localize('wordWrap.on', "Lines will wrap at the viewport width."),
A
Alex Dima 已提交
405 406 407 408 409
				nls.localize({
					key: 'wordWrap.wordWrapColumn',
					comment: [
						'- `editor.wordWrapColumn` refers to a different setting and should not be localized.'
					]
410
				}, "Lines will wrap at `#editor.wordWrapColumn#`."),
A
Alex Dima 已提交
411 412 413 414
				nls.localize({
					key: 'wordWrap.bounded',
					comment: [
						'- viewport means the edge of the visible window size.',
A
Alex Dima 已提交
415
						'- `editor.wordWrapColumn` refers to a different setting and should not be localized.'
A
Alex Dima 已提交
416
					]
417
				}, "Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`."),
418
			],
419
			'default': EDITOR_DEFAULTS.wordWrap,
A
Alex Dima 已提交
420 421 422 423 424 425
			'description': nls.localize({
				key: 'wordWrap',
				comment: [
					'- \'off\', \'on\', \'wordWrapColumn\' and \'bounded\' refer to values the setting can take and should not be localized.',
					'- `editor.wordWrapColumn` refers to a different setting and should not be localized.'
				]
426
			}, "Controls how lines should wrap.")
427 428 429
		},
		'editor.wordWrapColumn': {
			'type': 'integer',
430
			'default': EDITOR_DEFAULTS.wordWrapColumn,
431
			'minimum': 1,
432
			'markdownDescription': nls.localize({
A
Alex Dima 已提交
433 434 435 436 437
				key: 'wordWrapColumn',
				comment: [
					'- `editor.wordWrap` refers to a different setting and should not be localized.',
					'- \'wordWrapColumn\' and \'bounded\' refer to values the different setting can take and should not be localized.'
				]
438
			}, "Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.")
439
		},
J
Johannes Rieken 已提交
440
		'editor.wrappingIndent': {
E
Erich Gamma 已提交
441
			'type': 'string',
442
			'enum': ['none', 'same', 'indent', 'deepIndent'],
M
Matt Bierner 已提交
443 444 445 446 447 448
			enumDescriptions: [
				nls.localize('wrappingIndent.none', "No indentation. Wrapped lines begin at column 1."),
				nls.localize('wrappingIndent.same', "Wrapped lines get the same indentation as the parent."),
				nls.localize('wrappingIndent.indent', "Wrapped lines get +1 indentation toward the parent."),
				nls.localize('wrappingIndent.deepIndent', "Wrapped lines get +2 indentation toward the parent."),
			],
449
			'default': 'same',
M
Matt Bierner 已提交
450
			'description': nls.localize('wrappingIndent', "Controls the indentation of wrapped lines."),
E
Erich Gamma 已提交
451
		},
J
Johannes Rieken 已提交
452
		'editor.mouseWheelScrollSensitivity': {
E
Erich Gamma 已提交
453
			'type': 'number',
A
Alex Dima 已提交
454
			'default': EDITOR_DEFAULTS.viewInfo.scrollbar.mouseWheelScrollSensitivity,
455
			'markdownDescription': nls.localize('mouseWheelScrollSensitivity', "A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")
E
Erich Gamma 已提交
456
		},
T
Tiago Ribeiro 已提交
457 458 459
		'editor.fastScrollSensitivity': {
			'type': 'number',
			'default': EDITOR_DEFAULTS.viewInfo.scrollbar.fastScrollSensitivity,
R
Rob Lourens 已提交
460
			'markdownDescription': nls.localize('fastScrollSensitivity', "Scrolling speed mulitiplier when pressing `Alt`.")
T
Tiago Ribeiro 已提交
461
		},
462
		'editor.multiCursorModifier': {
463
			'type': 'string',
464
			'enum': ['ctrlCmd', 'alt'],
465
			'markdownEnumDescriptions': [
466 467
				nls.localize('multiCursorModifier.ctrlCmd', "Maps to `Control` on Windows and Linux and to `Command` on macOS."),
				nls.localize('multiCursorModifier.alt', "Maps to `Alt` on Windows and Linux and to `Option` on macOS.")
468
			],
469
			'default': 'alt',
470
			'markdownDescription': nls.localize({
471 472 473 474 475
				key: 'multiCursorModifier',
				comment: [
					'- `ctrlCmd` refers to a value the setting can take and should not be localized.',
					'- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized.'
				]
476
			}, "The modifier to be used to add multiple cursors with the mouse. The Go To Definition and Open Link mouse gestures will adapt such that they do not conflict with the multicursor modifier. [Read more](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).")
477
		},
A
Alex Dima 已提交
478
		'editor.multiCursorMergeOverlapping': {
479
			'type': 'boolean',
A
Alex Dima 已提交
480 481
			'default': EDITOR_DEFAULTS.multiCursorMergeOverlapping,
			'description': nls.localize('multiCursorMergeOverlapping', "Merge multiple cursors when they are overlapping.")
482
		},
J
Johannes Rieken 已提交
483
		'editor.quickSuggestions': {
484
			'anyOf': [
485 486 487
				{
					type: 'boolean',
				},
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508
				{
					type: 'object',
					properties: {
						strings: {
							type: 'boolean',
							default: false,
							description: nls.localize('quickSuggestions.strings', "Enable quick suggestions inside strings.")
						},
						comments: {
							type: 'boolean',
							default: false,
							description: nls.localize('quickSuggestions.comments', "Enable quick suggestions inside comments.")
						},
						other: {
							type: 'boolean',
							default: true,
							description: nls.localize('quickSuggestions.other', "Enable quick suggestions outside of strings and comments.")
						},
					}
				}
			],
A
Alex Dima 已提交
509
			'default': EDITOR_DEFAULTS.contribInfo.quickSuggestions,
S
SteVen Batten 已提交
510
			'description': nls.localize('quickSuggestions', "Controls whether suggestions should automatically show up while typing.")
E
Erich Gamma 已提交
511
		},
J
Johannes Rieken 已提交
512
		'editor.quickSuggestionsDelay': {
E
Erich Gamma 已提交
513
			'type': 'integer',
A
Alex Dima 已提交
514
			'default': EDITOR_DEFAULTS.contribInfo.quickSuggestionsDelay,
E
Erich Gamma 已提交
515
			'minimum': 0,
S
SteVen Batten 已提交
516
			'description': nls.localize('quickSuggestionsDelay', "Controls the delay in milliseconds after which quick suggestions will show up.")
E
Erich Gamma 已提交
517
		},
518
		'editor.parameterHints.enabled': {
J
Joao Moreno 已提交
519
			'type': 'boolean',
520 521 522 523 524 525 526
			'default': EDITOR_DEFAULTS.contribInfo.parameterHints.enabled,
			'description': nls.localize('parameterHints.enabled', "Enables a pop-up that shows parameter documentation and type information as you type.")
		},
		'editor.parameterHints.cycle': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.parameterHints.cycle,
			'description': nls.localize('parameterHints.cycle', "Controls whether the parameter hints menu cycles or closes when reaching the end of the list.")
J
Joao Moreno 已提交
527
		},
J
Johannes Rieken 已提交
528
		'editor.autoClosingBrackets': {
J
Jackson Kearl 已提交
529 530
			type: 'string',
			enum: ['always', 'languageDefined', 'beforeWhitespace', 'never'],
531
			enumDescriptions: [
532 533 534 535
				'',
				nls.localize('editor.autoClosingBrackets.languageDefined', "Use language configurations to determine when to autoclose brackets."),
				nls.localize('editor.autoClosingBrackets.beforeWhitespace', "Autoclose brackets only when the cursor is to the left of whitespace."),
				'',
536 537

			],
538
			'default': EDITOR_DEFAULTS.autoClosingBrackets,
539
			'description': nls.localize('autoClosingBrackets', "Controls whether the editor should automatically close brackets after the user adds an opening bracket.")
E
Erich Gamma 已提交
540
		},
J
Jackson Kearl 已提交
541
		'editor.autoClosingQuotes': {
J
Jackson Kearl 已提交
542 543
			type: 'string',
			enum: ['always', 'languageDefined', 'beforeWhitespace', 'never'],
544
			enumDescriptions: [
545 546 547 548
				'',
				nls.localize('editor.autoClosingQuotes.languageDefined', "Use language configurations to determine when to autoclose quotes."),
				nls.localize('editor.autoClosingQuotes.beforeWhitespace', "Autoclose quotes only when the cursor is to the left of whitespace."),
				'',
549
			],
J
Jackson Kearl 已提交
550
			'default': EDITOR_DEFAULTS.autoClosingQuotes,
A
Aldo Donetti 已提交
551
			'description': nls.localize('autoClosingQuotes', "Controls whether the editor should automatically close quotes after the user adds an opening quote.")
J
Jackson Kearl 已提交
552
		},
553
		'editor.autoSurround': {
J
Jackson Kearl 已提交
554
			type: 'string',
555
			enum: ['languageDefined', 'brackets', 'quotes', 'never'],
556
			enumDescriptions: [
557
				nls.localize('editor.autoSurround.languageDefined', "Use language configurations to determine when to automatically surround selections."),
558 559
				nls.localize('editor.autoSurround.brackets', "Surround with brackets but not quotes."),
				nls.localize('editor.autoSurround.quotes', "Surround with quotes but not brackets."),
560
				''
561
			],
562 563
			'default': EDITOR_DEFAULTS.autoSurround,
			'description': nls.localize('autoSurround', "Controls whether the editor should automatically surround selections.")
E
Erich Gamma 已提交
564
		},
J
Johannes Rieken 已提交
565
		'editor.formatOnType': {
E
Erich Gamma 已提交
566
			'type': 'boolean',
A
Alex Dima 已提交
567
			'default': EDITOR_DEFAULTS.contribInfo.formatOnType,
568
			'description': nls.localize('formatOnType', "Controls whether the editor should automatically format the line after typing.")
E
Erich Gamma 已提交
569
		},
570 571
		'editor.formatOnPaste': {
			'type': 'boolean',
A
Alex Dima 已提交
572
			'default': EDITOR_DEFAULTS.contribInfo.formatOnPaste,
573
			'description': nls.localize('formatOnPaste', "Controls whether the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.")
574
		},
575 576 577
		'editor.autoIndent': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.autoIndent,
578
			'description': nls.localize('autoIndent', "Controls whether the editor should automatically adjust the indentation when users type, paste or move lines. Extensions with indentation rules of the language must be available.")
579
		},
J
Johannes Rieken 已提交
580
		'editor.suggestOnTriggerCharacters': {
E
Erich Gamma 已提交
581
			'type': 'boolean',
A
Alex Dima 已提交
582
			'default': EDITOR_DEFAULTS.contribInfo.suggestOnTriggerCharacters,
583
			'description': nls.localize('suggestOnTriggerCharacters', "Controls whether suggestions should automatically show up when typing trigger characters.")
E
Erich Gamma 已提交
584
		},
J
Johannes Rieken 已提交
585
		'editor.acceptSuggestionOnEnter': {
586 587
			'type': 'string',
			'enum': ['on', 'smart', 'off'],
A
Alex Dima 已提交
588
			'default': EDITOR_DEFAULTS.contribInfo.acceptSuggestionOnEnter,
589
			'markdownEnumDescriptions': [
590 591 592 593
				'',
				nls.localize('acceptSuggestionOnEnterSmart', "Only accept a suggestion with `Enter` when it makes a textual change."),
				''
			],
594
			'markdownDescription': nls.localize('acceptSuggestionOnEnter', "Controls whether suggestions should be accepted on `Enter`, in addition to `Tab`. Helps to avoid ambiguity between inserting new lines or accepting suggestions.")
595 596 597
		},
		'editor.acceptSuggestionOnCommitCharacter': {
			'type': 'boolean',
A
Alex Dima 已提交
598
			'default': EDITOR_DEFAULTS.contribInfo.acceptSuggestionOnCommitCharacter,
599
			'markdownDescription': nls.localize('acceptSuggestionOnCommitCharacter', "Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.")
600
		},
601
		'editor.snippetSuggestions': {
602
			'type': 'string',
603
			'enum': ['top', 'bottom', 'inline', 'none'],
J
Johannes Rieken 已提交
604 605 606 607 608 609
			'enumDescriptions': [
				nls.localize('snippetSuggestions.top', "Show snippet suggestions on top of other suggestions."),
				nls.localize('snippetSuggestions.bottom', "Show snippet suggestions below other suggestions."),
				nls.localize('snippetSuggestions.inline', "Show snippets suggestions with other suggestions."),
				nls.localize('snippetSuggestions.none', "Do not show snippet suggestions."),
			],
610
			'default': EDITOR_DEFAULTS.contribInfo.suggest.snippets,
611
			'description': nls.localize('snippetSuggestions', "Controls whether snippets are shown with other suggestions and how they are sorted.")
612
		},
613 614
		'editor.emptySelectionClipboard': {
			'type': 'boolean',
615
			'default': EDITOR_DEFAULTS.emptySelectionClipboard,
616 617
			'description': nls.localize('emptySelectionClipboard', "Controls whether copying without a selection copies the current line.")
		},
618
		'editor.copyWithSyntaxHighlighting': {
619
			'type': 'boolean',
620
			'default': EDITOR_DEFAULTS.copyWithSyntaxHighlighting,
621
			'description': nls.localize('copyWithSyntaxHighlighting', "Controls whether syntax highlighting should be copied into the clipboard.")
622
		},
623
		'editor.wordBasedSuggestions': {
624
			'type': 'boolean',
A
Alex Dima 已提交
625
			'default': EDITOR_DEFAULTS.contribInfo.wordBasedSuggestions,
J
Johannes Rieken 已提交
626
			'description': nls.localize('wordBasedSuggestions', "Controls whether completions should be computed based on words in the document.")
627
		},
J
Johannes Rieken 已提交
628
		'editor.suggestSelection': {
629
			'type': 'string',
J
Johannes Rieken 已提交
630
			'enum': ['first', 'recentlyUsed', 'recentlyUsedByPrefix'],
631
			'markdownEnumDescriptions': [
J
Johannes Rieken 已提交
632 633 634
				nls.localize('suggestSelection.first', "Always select the first suggestion."),
				nls.localize('suggestSelection.recentlyUsed', "Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently."),
				nls.localize('suggestSelection.recentlyUsedByPrefix', "Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`."),
J
Johannes Rieken 已提交
635
			],
J
Johannes Rieken 已提交
636 637
			'default': 'recentlyUsed',
			'description': nls.localize('suggestSelection', "Controls how suggestions are pre-selected when showing the suggest list.")
638
		},
J
Johannes Rieken 已提交
639
		'editor.suggestFontSize': {
J
Joao Moreno 已提交
640 641 642
			'type': 'integer',
			'default': 0,
			'minimum': 0,
643
			'markdownDescription': nls.localize('suggestFontSize', "Font size for the suggest widget. When set to `0`, the value of `#editor.fontSize#` is used.")
J
Joao Moreno 已提交
644
		},
J
Johannes Rieken 已提交
645
		'editor.suggestLineHeight': {
J
Joao Moreno 已提交
646 647 648
			'type': 'integer',
			'default': 0,
			'minimum': 0,
649
			'markdownDescription': nls.localize('suggestLineHeight', "Line height for the suggest widget. When set to `0`, the value of `#editor.lineHeight#` is used.")
J
Joao Moreno 已提交
650
		},
651
		'editor.tabCompletion': {
652 653 654
			type: 'string',
			default: 'off',
			enum: ['on', 'off', 'onlySnippets'],
655
			enumDescriptions: [
656 657 658 659 660
				nls.localize('tabCompletion.on', "Tab complete will insert the best matching suggestion when pressing tab."),
				nls.localize('tabCompletion.off', "Disable tab completions."),
				nls.localize('tabCompletion.onlySnippets', "Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled."),
			],
			description: nls.localize('tabCompletion', "Enables tab completions.")
J
Joao Moreno 已提交
661
		},
662 663 664 665 666
		'editor.suggest.filterGraceful': {
			type: 'boolean',
			default: true,
			description: nls.localize('suggest.filterGraceful', "Controls whether filtering and sorting suggestions accounts for small typos.")
		},
J
Johannes Rieken 已提交
667 668 669 670 671
		'editor.suggest.localityBonus': {
			type: 'boolean',
			default: false,
			description: nls.localize('suggest.localityBonus', "Controls whether sorting favours words that appear close to the cursor.")
		},
672 673 674 675 676
		'editor.suggest.shareSuggestSelections': {
			type: 'boolean',
			default: false,
			markdownDescription: nls.localize('suggest.shareSuggestSelections', "Controls whether remembered suggestion selections are shared between multiple workspaces and windows (needs `#editor.suggestSelection#`).")
		},
677 678 679 680 681
		'editor.suggest.snippetsPreventQuickSuggestions': {
			type: 'boolean',
			default: true,
			description: nls.localize('suggest.snippetsPreventQuickSuggestions', "Control whether an active snippet prevents quick suggestions.")
		},
682 683 684 685 686
		'editor.suggest.showIcons': {
			type: 'boolean',
			default: EDITOR_DEFAULTS.contribInfo.suggest.showIcons,
			description: nls.localize('suggest.showIcons', "Controls whether to show or hide icons in suggestions.")
		},
687
		'editor.suggest.maxVisibileSuggestions': {
688
			type: 'number',
689
			default: EDITOR_DEFAULTS.contribInfo.suggest.maxVisibileSuggestions,
690 691
			minimum: 1,
			maximum: 12,
692
			description: nls.localize('suggest.maxVisibileSuggestions', "Controls how many suggestions IntelliSense will show before showing a scrollbar.")
693
		},
694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830
		'editor.suggest.filteredTypes': {
			type: 'object',
			default: { keyword: true },
			markdownDescription: nls.localize('suggest.filtered', "Controls whether some suggestion types should be filtered from IntelliSense. A list of suggestion types can be found here: https://code.visualstudio.com/docs/editor/intellisense#_types-of-completions."),
			properties: {
				method: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.method', "When set to `false` IntelliSense never shows `method` suggestions.")
				},
				function: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.function', "When set to `false` IntelliSense never shows `function` suggestions.")
				},
				constructor: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.constructor', "When set to `false` IntelliSense never shows `constructor` suggestions.")
				},
				field: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.field', "When set to `false` IntelliSense never shows `field` suggestions.")
				},
				variable: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.variable', "When set to `false` IntelliSense never shows `variable` suggestions.")
				},
				class: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.class', "When set to `false` IntelliSense never shows `class` suggestions.")
				},
				struct: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.struct', "When set to `false` IntelliSense never shows `struct` suggestions.")
				},
				interface: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.interface', "When set to `false` IntelliSense never shows `interface` suggestions.")
				},
				module: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.module', "When set to `false` IntelliSense never shows `module` suggestions.")
				},
				property: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.property', "When set to `false` IntelliSense never shows `property` suggestions.")
				},
				event: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.event', "When set to `false` IntelliSense never shows `event` suggestions.")
				},
				operator: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.operator', "When set to `false` IntelliSense never shows `operator` suggestions.")
				},
				unit: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.unit', "When set to `false` IntelliSense never shows `unit` suggestions.")
				},
				value: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.value', "When set to `false` IntelliSense never shows `value` suggestions.")
				},
				constant: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.constant', "When set to `false` IntelliSense never shows `constant` suggestions.")
				},
				enum: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.enum', "When set to `false` IntelliSense never shows `enum` suggestions.")
				},
				enumMember: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.enumMember', "When set to `false` IntelliSense never shows `enumMember` suggestions.")
				},
				keyword: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.keyword', "When set to `false` IntelliSense never shows `keyword` suggestions.")
				},
				text: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.text', "When set to `false` IntelliSense never shows `text` suggestions.")
				},
				color: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.color', "When set to `false` IntelliSense never shows `color` suggestions.")
				},
				file: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.file', "When set to `false` IntelliSense never shows `file` suggestions.")
				},
				reference: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.reference', "When set to `false` IntelliSense never shows `reference` suggestions.")
				},
				customcolor: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.customcolor', "When set to `false` IntelliSense never shows `customcolor` suggestions.")
				},
				folder: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.folder', "When set to `false` IntelliSense never shows `folder` suggestions.")
				},
				typeParameter: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.typeParameter', "When set to `false` IntelliSense never shows `typeParameter` suggestions.")
				},
				snippet: {
					type: 'boolean',
					default: true,
					markdownDescription: nls.localize('suggest.filtered.snippet', "When set to `false` IntelliSense never shows `snippet` suggestions.")
				},
			}
		},
J
Johannes Rieken 已提交
831
		'editor.selectionHighlight': {
E
Erich Gamma 已提交
832
			'type': 'boolean',
A
Alex Dima 已提交
833
			'default': EDITOR_DEFAULTS.contribInfo.selectionHighlight,
R
Rob Lourens 已提交
834
			'description': nls.localize('selectionHighlight', "Controls whether the editor should highlight matches similar to the selection.")
E
Erich Gamma 已提交
835
		},
836 837
		'editor.occurrencesHighlight': {
			'type': 'boolean',
A
Alex Dima 已提交
838
			'default': EDITOR_DEFAULTS.contribInfo.occurrencesHighlight,
839
			'description': nls.localize('occurrencesHighlight', "Controls whether the editor should highlight semantic symbol occurrences.")
840
		},
J
Johannes Rieken 已提交
841
		'editor.overviewRulerLanes': {
E
Erich Gamma 已提交
842 843
			'type': 'integer',
			'default': 3,
844
			'description': nls.localize('overviewRulerLanes', "Controls the number of decorations that can show up at the same position in the overview ruler.")
E
Erich Gamma 已提交
845
		},
846
		'editor.overviewRulerBorder': {
847
			'type': 'boolean',
A
Alex Dima 已提交
848
			'default': EDITOR_DEFAULTS.viewInfo.overviewRulerBorder,
S
SteVen Batten 已提交
849
			'description': nls.localize('overviewRulerBorder', "Controls whether a border should be drawn around the overview ruler.")
850
		},
J
Johannes Rieken 已提交
851
		'editor.cursorBlinking': {
852
			'type': 'string',
853
			'enum': ['blink', 'smooth', 'phase', 'expand', 'solid'],
854
			'default': editorOptions.blinkingStyleToString(EDITOR_DEFAULTS.viewInfo.cursorBlinking),
A
Alex Dima 已提交
855
			'description': nls.localize('cursorBlinking', "Control the cursor animation style.")
856
		},
857 858
		'editor.mouseWheelZoom': {
			'type': 'boolean',
A
Alex Dima 已提交
859
			'default': EDITOR_DEFAULTS.viewInfo.mouseWheelZoom,
860
			'markdownDescription': nls.localize('mouseWheelZoom', "Zoom the font of the editor when using mouse wheel and holding `Ctrl`.")
861
		},
862 863 864 865 866
		'editor.cursorSmoothCaretAnimation': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.viewInfo.cursorSmoothCaretAnimation,
			'description': nls.localize('cursorSmoothCaretAnimation', "Controls whether the smooth caret animation should be enabled.")
		},
J
Johannes Rieken 已提交
867
		'editor.cursorStyle': {
M
markrendle 已提交
868
			'type': 'string',
869
			'enum': ['block', 'block-outline', 'line', 'line-thin', 'underline', 'underline-thin'],
870
			'default': editorOptions.cursorStyleToString(EDITOR_DEFAULTS.viewInfo.cursorStyle),
871
			'description': nls.localize('cursorStyle', "Controls the cursor style.")
M
markrendle 已提交
872
		},
873
		'editor.cursorWidth': {
874
			'type': 'integer',
875
			'default': EDITOR_DEFAULTS.viewInfo.cursorWidth,
876
			'markdownDescription': nls.localize('cursorWidth', "Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.")
877
		},
J
Johannes Rieken 已提交
878
		'editor.fontLigatures': {
879
			'type': 'boolean',
A
Alex Dima 已提交
880
			'default': EDITOR_DEFAULTS.viewInfo.fontLigatures,
881
			'description': nls.localize('fontLigatures', "Enables/Disables font ligatures.")
882
		},
J
Johannes Rieken 已提交
883
		'editor.hideCursorInOverviewRuler': {
E
Erich Gamma 已提交
884
			'type': 'boolean',
A
Alex Dima 已提交
885
			'default': EDITOR_DEFAULTS.viewInfo.hideCursorInOverviewRuler,
886
			'description': nls.localize('hideCursorInOverviewRuler', "Controls whether the cursor should be hidden in the overview ruler.")
E
Erich Gamma 已提交
887 888
		},
		'editor.renderWhitespace': {
889 890
			'type': 'string',
			'enum': ['none', 'boundary', 'all'],
891 892 893 894 895
			'enumDescriptions': [
				'',
				nls.localize('renderWhiteSpace.boundary', "Render whitespace characters except for single spaces between words."),
				''
			],
A
Alex Dima 已提交
896
			default: EDITOR_DEFAULTS.viewInfo.renderWhitespace,
897
			description: nls.localize('renderWhitespace', "Controls how the editor should render whitespace characters.")
E
Erich Gamma 已提交
898
		},
899 900
		'editor.renderControlCharacters': {
			'type': 'boolean',
A
Alex Dima 已提交
901
			default: EDITOR_DEFAULTS.viewInfo.renderControlCharacters,
902
			description: nls.localize('renderControlCharacters', "Controls whether the editor should render control characters.")
903
		},
904 905
		'editor.renderIndentGuides': {
			'type': 'boolean',
A
Alex Dima 已提交
906
			default: EDITOR_DEFAULTS.viewInfo.renderIndentGuides,
907
			description: nls.localize('renderIndentGuides', "Controls whether the editor should render indent guides.")
908
		},
909 910 911
		'editor.highlightActiveIndentGuide': {
			'type': 'boolean',
			default: EDITOR_DEFAULTS.viewInfo.highlightActiveIndentGuide,
912
			description: nls.localize('highlightActiveIndentGuide', "Controls whether the editor should highlight the active indent guide.")
913
		},
914
		'editor.renderLineHighlight': {
915 916
			'type': 'string',
			'enum': ['none', 'gutter', 'line', 'all'],
S
SteVen Batten 已提交
917 918 919 920 921 922
			'enumDescriptions': [
				'',
				'',
				'',
				nls.localize('renderLineHighlight.all', "Highlights both the gutter and the current line."),
			],
A
Alex Dima 已提交
923
			default: EDITOR_DEFAULTS.viewInfo.renderLineHighlight,
S
SteVen Batten 已提交
924
			description: nls.localize('renderLineHighlight', "Controls how the editor should render the current line highlight.")
925
		},
J
Johannes Rieken 已提交
926
		'editor.codeLens': {
E
Erich Gamma 已提交
927
			'type': 'boolean',
A
Alex Dima 已提交
928
			'default': EDITOR_DEFAULTS.contribInfo.codeLens,
R
Rob Lourens 已提交
929
			'description': nls.localize('codeLens', "Controls whether the editor shows CodeLens.")
E
Erich Gamma 已提交
930
		},
J
Johannes Rieken 已提交
931
		'editor.folding': {
M
Martin Aeschlimann 已提交
932
			'type': 'boolean',
A
Alex Dima 已提交
933
			'default': EDITOR_DEFAULTS.contribInfo.folding,
R
Rob Lourens 已提交
934
			'description': nls.localize('folding', "Controls whether the editor has code folding enabled.")
M
Martin Aeschlimann 已提交
935
		},
936 937 938 939
		'editor.foldingStrategy': {
			'type': 'string',
			'enum': ['auto', 'indentation'],
			'default': EDITOR_DEFAULTS.contribInfo.foldingStrategy,
940
			'markdownDescription': nls.localize('foldingStrategy', "Controls the strategy for computing folding ranges. `auto` uses a language specific folding strategy, if available. `indentation` uses the indentation based folding strategy.")
941
		},
942 943 944 945 946
		'editor.showFoldingControls': {
			'type': 'string',
			'enum': ['always', 'mouseover'],
			'default': EDITOR_DEFAULTS.contribInfo.showFoldingControls,
			'description': nls.localize('showFoldingControls', "Controls whether the fold controls on the gutter are automatically hidden.")
947
		},
948
		'editor.matchBrackets': {
949
			'type': 'boolean',
A
Alex Dima 已提交
950
			'default': EDITOR_DEFAULTS.contribInfo.matchBrackets,
951
			'description': nls.localize('matchBrackets', "Highlight matching brackets when one of them is selected.")
952
		},
I
isidor 已提交
953 954
		'editor.glyphMargin': {
			'type': 'boolean',
A
Alex Dima 已提交
955
			'default': EDITOR_DEFAULTS.viewInfo.glyphMargin,
I
isidor 已提交
956 957
			'description': nls.localize('glyphMargin', "Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.")
		},
J
Johannes Rieken 已提交
958
		'editor.useTabStops': {
959
			'type': 'boolean',
960
			'default': EDITOR_DEFAULTS.useTabStops,
M
Matt Bierner 已提交
961
			'description': nls.localize('useTabStops', "Inserting and deleting whitespace follows tab stops.")
962
		},
J
Johannes Rieken 已提交
963
		'editor.trimAutoWhitespace': {
964
			'type': 'boolean',
965
			'default': EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,
M
Matt Bierner 已提交
966
			'description': nls.localize('trimAutoWhitespace', "Remove trailing auto inserted whitespace.")
967
		},
J
Johannes Rieken 已提交
968
		'editor.stablePeek': {
969
			'type': 'boolean',
970
			'default': false,
971
			'markdownDescription': nls.localize('stablePeek', "Keep peek editors open even when double clicking their content or when hitting `Escape`.")
972
		},
973
		'editor.dragAndDrop': {
974
			'type': 'boolean',
975
			'default': EDITOR_DEFAULTS.dragAndDrop,
976
			'description': nls.localize('dragAndDrop', "Controls whether the editor should allow moving selections via drag and drop.")
977
		},
978 979 980 981 982 983 984 985 986 987 988
		'editor.accessibilitySupport': {
			'type': 'string',
			'enum': ['auto', 'on', 'off'],
			'enumDescriptions': [
				nls.localize('accessibilitySupport.auto', "The editor will use platform APIs to detect when a Screen Reader is attached."),
				nls.localize('accessibilitySupport.on', "The editor will be permanently optimized for usage with a Screen Reader."),
				nls.localize('accessibilitySupport.off', "The editor will never be optimized for usage with a Screen Reader."),
			],
			'default': EDITOR_DEFAULTS.accessibilitySupport,
			'description': nls.localize('accessibilitySupport', "Controls whether the editor should run in a mode where it is optimized for screen readers.")
		},
989 990 991 992 993
		'editor.showUnused': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.showUnused,
			'description': nls.localize('showUnused', "Controls fading out of unused code.")
		},
994
		'editor.links': {
995
			'type': 'boolean',
996
			'default': EDITOR_DEFAULTS.contribInfo.links,
S
SteVen Batten 已提交
997
			'description': nls.localize('links', "Controls whether the editor should detect links and make them clickable.")
998
		},
R
rebornix 已提交
999
		'editor.colorDecorators': {
1000
			'type': 'boolean',
R
rebornix 已提交
1001
			'default': EDITOR_DEFAULTS.contribInfo.colorDecorators,
1002
			'description': nls.localize('colorDecorators', "Controls whether the editor should render the inline color decorators and color picker.")
1003
		},
1004 1005 1006
		'editor.lightbulb.enabled': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.lightbulbEnabled,
S
SteVen Batten 已提交
1007
			'description': nls.localize('codeActions', "Enables the code action lightbulb in the editor.")
1008
		},
1009 1010 1011
		'editor.maxTokenizationLineLength': {
			'type': 'integer',
			'default': 20_000,
A
Alex Dima 已提交
1012
			'description': nls.localize('maxTokenizationLineLength', "Lines above this length will not be tokenized for performance reasons")
1013
		},
1014 1015 1016 1017 1018
		'editor.codeActionsOnSave': {
			'type': 'object',
			'properties': {
				'source.organizeImports': {
					'type': 'boolean',
1019
					'description': nls.localize('codeActionsOnSave.organizeImports', "Controls whether organize imports action should be run on file save.")
1020
				},
1021
				'source.fixAll': {
1022
					'type': 'boolean',
1023
					'description': nls.localize('codeActionsOnSave.fixAll', "Controls whether auto fix action should be run on file save.")
1024 1025 1026 1027 1028 1029
				}
			},
			'additionalProperties': {
				'type': 'boolean'
			},
			'default': EDITOR_DEFAULTS.contribInfo.codeActionsOnSave,
M
Matt Bierner 已提交
1030
			'description': nls.localize('codeActionsOnSave', "Code action kinds to be run on save.")
1031 1032 1033 1034
		},
		'editor.codeActionsOnSaveTimeout': {
			'type': 'number',
			'default': EDITOR_DEFAULTS.contribInfo.codeActionsOnSaveTimeout,
1035
			'description': nls.localize('codeActionsOnSaveTimeout', "Timeout in milliseconds after which the code actions that are run on save are cancelled.")
1036
		},
1037 1038 1039
		'editor.selectionClipboard': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.selectionClipboard,
S
SteVen Batten 已提交
1040
			'description': nls.localize('selectionClipboard', "Controls whether the Linux primary clipboard should be supported."),
1041
			'included': platform.isLinux
1042
		},
J
Johannes Rieken 已提交
1043
		'diffEditor.renderSideBySide': {
E
Erich Gamma 已提交
1044 1045
			'type': 'boolean',
			'default': true,
1046
			'description': nls.localize('sideBySide', "Controls whether the diff editor shows the diff side by side or inline.")
E
Erich Gamma 已提交
1047
		},
J
Johannes Rieken 已提交
1048
		'diffEditor.ignoreTrimWhitespace': {
E
Erich Gamma 已提交
1049 1050
			'type': 'boolean',
			'default': true,
1051
			'description': nls.localize('ignoreTrimWhitespace', "Controls whether the diff editor shows changes in leading or trailing whitespace as diffs.")
1052
		},
1053 1054 1055 1056
		'editor.largeFileOptimizations': {
			'type': 'boolean',
			'default': EDITOR_MODEL_DEFAULTS.largeFileOptimizations,
			'description': nls.localize('largeFileOptimizations', "Special handling for large files to disable certain memory intensive features.")
1057
		},
1058 1059 1060
		'diffEditor.renderIndicators': {
			'type': 'boolean',
			'default': true,
1061
			'description': nls.localize('renderIndicators', "Controls whether the diff editor shows +/- indicators for added/removed changes.")
E
Erich Gamma 已提交
1062 1063
		}
	}
A
Alex Dima 已提交
1064 1065
};

A
Alex Dima 已提交
1066
let cachedEditorConfigurationKeys: { [key: string]: boolean; } | null = null;
1067 1068
function getEditorConfigurationKeys(): { [key: string]: boolean; } {
	if (cachedEditorConfigurationKeys === null) {
A
Alex Dima 已提交
1069 1070 1071
		cachedEditorConfigurationKeys = <{ [key: string]: boolean; }>Object.create(null);
		Object.keys(editorConfiguration.properties!).forEach((prop) => {
			cachedEditorConfigurationKeys![prop] = true;
1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085
		});
	}
	return cachedEditorConfigurationKeys;
}

export function isEditorConfigurationKey(key: string): boolean {
	const editorConfigurationKeys = getEditorConfigurationKeys();
	return (editorConfigurationKeys[`editor.${key}`] || false);
}
export function isDiffEditorConfigurationKey(key: string): boolean {
	const editorConfigurationKeys = getEditorConfigurationKeys();
	return (editorConfigurationKeys[`diffEditor.${key}`] || false);
}

1086
configurationRegistry.registerConfiguration(editorConfiguration);