commonEditorConfig.ts 39.3 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;
E
Erich Gamma 已提交
20

21 22 23 24 25 26 27
/**
 * 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 已提交
28
	onDidChangeTabFocus: Event<boolean>;
29
	getTabFocusMode(): boolean;
J
Johannes Rieken 已提交
30
	setTabFocusMode(tabFocusMode: boolean): void;
31 32
}

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

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

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

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

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

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

63 64
const hasOwnProperty = Object.hasOwnProperty;

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

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

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

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

79 80 81 82 83
		// 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 已提交
84
		this._rawOptions.hover = objects.mixin({}, this._rawOptions.hover || {});
85
		this._rawOptions.parameterHints = objects.mixin({}, this._rawOptions.parameterHints || {});
86

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

E
Erich Gamma 已提交
218 219
}

220
const configurationRegistry = Registry.as<IConfigurationRegistry>(Extensions.Configuration);
221
const editorConfiguration: IConfigurationNode = {
E
Erich Gamma 已提交
222 223 224
	'id': 'editor',
	'order': 5,
	'type': 'object',
225
	'title': nls.localize('editorConfigurationTitle', "Editor"),
226
	'overridable': true,
S
Sandeep Somavarapu 已提交
227
	'scope': ConfigurationScope.RESOURCE,
J
Johannes Rieken 已提交
228 229
	'properties': {
		'editor.fontFamily': {
E
Erich Gamma 已提交
230
			'type': 'string',
231
			'default': EDITOR_FONT_DEFAULTS.fontFamily,
E
Erich Gamma 已提交
232 233
			'description': nls.localize('fontFamily', "Controls the font family.")
		},
J
Johannes Rieken 已提交
234
		'editor.fontWeight': {
235
			'type': 'string',
236
			'enum': ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
237
			'default': EDITOR_FONT_DEFAULTS.fontWeight,
238 239
			'description': nls.localize('fontWeight', "Controls the font weight.")
		},
J
Johannes Rieken 已提交
240
		'editor.fontSize': {
E
Erich Gamma 已提交
241
			'type': 'number',
242
			'default': EDITOR_FONT_DEFAULTS.fontSize,
243
			'description': nls.localize('fontSize', "Controls the font size in pixels.")
E
Erich Gamma 已提交
244
		},
J
Johannes Rieken 已提交
245
		'editor.lineHeight': {
E
Erich Gamma 已提交
246
			'type': 'number',
247
			'default': EDITOR_FONT_DEFAULTS.lineHeight,
S
SteVen Batten 已提交
248
			'description': nls.localize('lineHeight', "Controls the line height. Use 0 to compute the line height from the font size.")
E
Erich Gamma 已提交
249
		},
250 251
		'editor.letterSpacing': {
			'type': 'number',
252
			'default': EDITOR_FONT_DEFAULTS.letterSpacing,
253 254
			'description': nls.localize('letterSpacing', "Controls the letter spacing in pixels.")
		},
J
Johannes Rieken 已提交
255
		'editor.lineNumbers': {
256
			'type': 'string',
257
			'enum': ['off', 'on', 'relative', 'interval'],
258 259 260
			'enumDescriptions': [
				nls.localize('lineNumbers.off', "Line numbers are not rendered."),
				nls.localize('lineNumbers.on', "Line numbers are rendered as absolute number."),
261 262
				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.")
263
			],
264
			'default': 'on',
A
Alex Dima 已提交
265
			'description': nls.localize('lineNumbers', "Controls the display of line numbers.")
E
Erich Gamma 已提交
266
		},
J
Johannes Rieken 已提交
267
		'editor.rulers': {
268 269 270 271
			'type': 'array',
			'items': {
				'type': 'number'
			},
A
Alex Dima 已提交
272
			'default': EDITOR_DEFAULTS.viewInfo.rulers,
S
SteVen Batten 已提交
273
			'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.")
274
		},
J
Johannes Rieken 已提交
275
		'editor.wordSeparators': {
A
Alex Dima 已提交
276
			'type': 'string',
277
			'default': EDITOR_DEFAULTS.wordSeparators,
M
Matt Bierner 已提交
278
			'description': nls.localize('wordSeparators', "Characters that will be used as word separators when doing word related navigations or operations.")
A
Alex Dima 已提交
279
		},
J
Johannes Rieken 已提交
280
		'editor.tabSize': {
281
			'type': 'number',
282
			'default': EDITOR_MODEL_DEFAULTS.tabSize,
E
Erich Gamma 已提交
283
			'minimum': 1,
284
			'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 已提交
285
		},
J
Johannes Rieken 已提交
286
		'editor.insertSpaces': {
287
			'type': 'boolean',
288
			'default': EDITOR_MODEL_DEFAULTS.insertSpaces,
289
			'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 已提交
290
		},
J
Johannes Rieken 已提交
291
		'editor.detectIndentation': {
292
			'type': 'boolean',
293
			'default': EDITOR_MODEL_DEFAULTS.detectIndentation,
294
			'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.")
295
		},
J
Johannes Rieken 已提交
296
		'editor.roundedSelection': {
E
Erich Gamma 已提交
297
			'type': 'boolean',
A
Alex Dima 已提交
298
			'default': EDITOR_DEFAULTS.viewInfo.roundedSelection,
299
			'description': nls.localize('roundedSelection', "Controls whether selections should have rounded corners.")
E
Erich Gamma 已提交
300
		},
J
Johannes Rieken 已提交
301
		'editor.scrollBeyondLastLine': {
E
Erich Gamma 已提交
302
			'type': 'boolean',
A
Alex Dima 已提交
303
			'default': EDITOR_DEFAULTS.viewInfo.scrollBeyondLastLine,
S
SteVen Batten 已提交
304
			'description': nls.localize('scrollBeyondLastLine', "Controls whether the editor will scroll beyond the last line.")
E
Erich Gamma 已提交
305
		},
306 307 308
		'editor.scrollBeyondLastColumn': {
			'type': 'number',
			'default': EDITOR_DEFAULTS.viewInfo.scrollBeyondLastColumn,
S
SteVen Batten 已提交
309
			'description': nls.localize('scrollBeyondLastColumn', "Controls the number of extra characters beyond which the editor will scroll horizontally.")
310
		},
311 312 313
		'editor.smoothScrolling': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.viewInfo.smoothScrolling,
314
			'description': nls.localize('smoothScrolling', "Controls whether the editor will scroll using an animation.")
315
		},
316 317
		'editor.minimap.enabled': {
			'type': 'boolean',
A
Alex Dima 已提交
318
			'default': EDITOR_DEFAULTS.viewInfo.minimap.enabled,
S
SteVen Batten 已提交
319
			'description': nls.localize('minimap.enabled', "Controls whether the minimap is shown.")
320
		},
321 322 323 324
		'editor.minimap.side': {
			'type': 'string',
			'enum': ['left', 'right'],
			'default': EDITOR_DEFAULTS.viewInfo.minimap.side,
A
Alex Dima 已提交
325
			'description': nls.localize('minimap.side', "Controls the side where to render the minimap.")
326
		},
327 328 329 330
		'editor.minimap.showSlider': {
			'type': 'string',
			'enum': ['always', 'mouseover'],
			'default': EDITOR_DEFAULTS.viewInfo.minimap.showSlider,
A
Alex Dima 已提交
331
			'description': nls.localize('minimap.showSlider', "Controls whether the minimap slider is automatically hidden.")
332
		},
333
		'editor.minimap.renderCharacters': {
334
			'type': 'boolean',
A
Alex Dima 已提交
335
			'default': EDITOR_DEFAULTS.viewInfo.minimap.renderCharacters,
S
SteVen Batten 已提交
336
			'description': nls.localize('minimap.renderCharacters', "Render the actual characters on a line as opposed to color blocks.")
337
		},
A
Alex Dima 已提交
338 339
		'editor.minimap.maxColumn': {
			'type': 'number',
A
Alex Dima 已提交
340
			'default': EDITOR_DEFAULTS.viewInfo.minimap.maxColumn,
S
SteVen Batten 已提交
341
			'description': nls.localize('minimap.maxColumn', "Limit the width of the minimap to render at most a certain number of columns.")
A
Alex Dima 已提交
342
		},
A
Alex Dima 已提交
343 344 345
		'editor.hover.enabled': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.hover.enabled,
346
			'description': nls.localize('hover.enabled', "Controls whether the hover is shown.")
A
Alex Dima 已提交
347
		},
348 349 350
		'editor.hover.delay': {
			'type': 'number',
			'default': EDITOR_DEFAULTS.contribInfo.hover.delay,
351
			'description': nls.localize('hover.delay', "Controls the delay in milliseconds after which the hover is shown.")
352
		},
353 354 355
		'editor.hover.sticky': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.hover.sticky,
356
			'description': nls.localize('hover.sticky', "Controls whether the hover should remain visible when mouse is moved over it.")
357
		},
358 359 360
		'editor.find.seedSearchStringFromSelection': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.find.seedSearchStringFromSelection,
361
			'description': nls.localize('find.seedSearchStringFromSelection', "Controls whether the search string in the Find Widget is seeded from the editor selection.")
362
		},
R
rebornix 已提交
363 364 365
		'editor.find.autoFindInSelection': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.find.autoFindInSelection,
366
			'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 已提交
367
		},
368 369 370
		'editor.find.globalFindClipboard': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.find.globalFindClipboard,
371
			'description': nls.localize('find.globalFindClipboard', "Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),
372
			'included': platform.isMacintosh
373
		},
J
Johannes Rieken 已提交
374
		'editor.wordWrap': {
375
			'type': 'string',
A
Alex Dima 已提交
376
			'enum': ['off', 'on', 'wordWrapColumn', 'bounded'],
377
			'markdownEnumDescriptions': [
378 379
				nls.localize('wordWrap.off', "Lines will never wrap."),
				nls.localize('wordWrap.on', "Lines will wrap at the viewport width."),
A
Alex Dima 已提交
380 381 382 383 384
				nls.localize({
					key: 'wordWrap.wordWrapColumn',
					comment: [
						'- `editor.wordWrapColumn` refers to a different setting and should not be localized.'
					]
385
				}, "Lines will wrap at `#editor.wordWrapColumn#`."),
A
Alex Dima 已提交
386 387 388 389
				nls.localize({
					key: 'wordWrap.bounded',
					comment: [
						'- viewport means the edge of the visible window size.',
A
Alex Dima 已提交
390
						'- `editor.wordWrapColumn` refers to a different setting and should not be localized.'
A
Alex Dima 已提交
391
					]
392
				}, "Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`."),
393
			],
394
			'default': EDITOR_DEFAULTS.wordWrap,
A
Alex Dima 已提交
395 396 397 398 399 400
			'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.'
				]
401
			}, "Controls how lines should wrap.")
402 403 404
		},
		'editor.wordWrapColumn': {
			'type': 'integer',
405
			'default': EDITOR_DEFAULTS.wordWrapColumn,
406
			'minimum': 1,
407
			'markdownDescription': nls.localize({
A
Alex Dima 已提交
408 409 410 411 412
				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.'
				]
413
			}, "Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.")
414
		},
J
Johannes Rieken 已提交
415
		'editor.wrappingIndent': {
E
Erich Gamma 已提交
416
			'type': 'string',
417
			'enum': ['none', 'same', 'indent', 'deepIndent'],
M
Matt Bierner 已提交
418 419 420 421 422 423
			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."),
			],
424
			'default': 'same',
M
Matt Bierner 已提交
425
			'description': nls.localize('wrappingIndent', "Controls the indentation of wrapped lines."),
E
Erich Gamma 已提交
426
		},
J
Johannes Rieken 已提交
427
		'editor.mouseWheelScrollSensitivity': {
E
Erich Gamma 已提交
428
			'type': 'number',
A
Alex Dima 已提交
429
			'default': EDITOR_DEFAULTS.viewInfo.scrollbar.mouseWheelScrollSensitivity,
430
			'markdownDescription': nls.localize('mouseWheelScrollSensitivity', "A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")
E
Erich Gamma 已提交
431
		},
T
Tiago Ribeiro 已提交
432 433 434
		'editor.fastScrollSensitivity': {
			'type': 'number',
			'default': EDITOR_DEFAULTS.viewInfo.scrollbar.fastScrollSensitivity,
435
			'markdownDescription': nls.localize('fastScrollSensitivity', "Scrolling speed mulitiplier when pressing `Alt`")
T
Tiago Ribeiro 已提交
436
		},
437
		'editor.multiCursorModifier': {
438
			'type': 'string',
439
			'enum': ['ctrlCmd', 'alt'],
440
			'markdownEnumDescriptions': [
441 442
				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.")
443
			],
444
			'default': 'alt',
445
			'markdownDescription': nls.localize({
446 447 448 449 450
				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.'
				]
451
			}, "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).")
452
		},
A
Alex Dima 已提交
453
		'editor.multiCursorMergeOverlapping': {
454
			'type': 'boolean',
A
Alex Dima 已提交
455 456
			'default': EDITOR_DEFAULTS.multiCursorMergeOverlapping,
			'description': nls.localize('multiCursorMergeOverlapping', "Merge multiple cursors when they are overlapping.")
457
		},
J
Johannes Rieken 已提交
458
		'editor.quickSuggestions': {
459
			'anyOf': [
460 461 462
				{
					type: 'boolean',
				},
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483
				{
					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 已提交
484
			'default': EDITOR_DEFAULTS.contribInfo.quickSuggestions,
S
SteVen Batten 已提交
485
			'description': nls.localize('quickSuggestions', "Controls whether suggestions should automatically show up while typing.")
E
Erich Gamma 已提交
486
		},
J
Johannes Rieken 已提交
487
		'editor.quickSuggestionsDelay': {
E
Erich Gamma 已提交
488
			'type': 'integer',
A
Alex Dima 已提交
489
			'default': EDITOR_DEFAULTS.contribInfo.quickSuggestionsDelay,
E
Erich Gamma 已提交
490
			'minimum': 0,
S
SteVen Batten 已提交
491
			'description': nls.localize('quickSuggestionsDelay', "Controls the delay in milliseconds after which quick suggestions will show up.")
E
Erich Gamma 已提交
492
		},
493
		'editor.parameterHints.enabled': {
J
Joao Moreno 已提交
494
			'type': 'boolean',
495 496 497 498 499 500 501
			'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 已提交
502
		},
J
Johannes Rieken 已提交
503
		'editor.autoClosingBrackets': {
J
Jackson Kearl 已提交
504 505
			type: 'string',
			enum: ['always', 'languageDefined', 'beforeWhitespace', 'never'],
506
			enumDescriptions: [
507 508 509 510
				'',
				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."),
				'',
511 512

			],
513
			'default': EDITOR_DEFAULTS.autoClosingBrackets,
514
			'description': nls.localize('autoClosingBrackets', "Controls whether the editor should automatically close brackets after the user adds an opening bracket.")
E
Erich Gamma 已提交
515
		},
J
Jackson Kearl 已提交
516
		'editor.autoClosingQuotes': {
J
Jackson Kearl 已提交
517 518
			type: 'string',
			enum: ['always', 'languageDefined', 'beforeWhitespace', 'never'],
519
			enumDescriptions: [
520 521 522 523
				'',
				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."),
				'',
524
			],
J
Jackson Kearl 已提交
525
			'default': EDITOR_DEFAULTS.autoClosingQuotes,
A
Aldo Donetti 已提交
526
			'description': nls.localize('autoClosingQuotes', "Controls whether the editor should automatically close quotes after the user adds an opening quote.")
J
Jackson Kearl 已提交
527
		},
528
		'editor.autoSurround': {
J
Jackson Kearl 已提交
529
			type: 'string',
530
			enum: ['languageDefined', 'brackets', 'quotes', 'never'],
531
			enumDescriptions: [
532
				nls.localize('editor.autoSurround.languageDefined', "Use language configurations to determine when to automatically surround selections."),
533 534
				nls.localize('editor.autoSurround.brackets', "Surround with brackets but not quotes."),
				nls.localize('editor.autoSurround.quotes', "Surround with quotes but not brackets."),
535
				''
536
			],
537 538
			'default': EDITOR_DEFAULTS.autoSurround,
			'description': nls.localize('autoSurround', "Controls whether the editor should automatically surround selections.")
E
Erich Gamma 已提交
539
		},
J
Johannes Rieken 已提交
540
		'editor.formatOnType': {
E
Erich Gamma 已提交
541
			'type': 'boolean',
A
Alex Dima 已提交
542
			'default': EDITOR_DEFAULTS.contribInfo.formatOnType,
543
			'description': nls.localize('formatOnType', "Controls whether the editor should automatically format the line after typing.")
E
Erich Gamma 已提交
544
		},
545 546
		'editor.formatOnPaste': {
			'type': 'boolean',
A
Alex Dima 已提交
547
			'default': EDITOR_DEFAULTS.contribInfo.formatOnPaste,
548
			'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.")
549
		},
550 551 552
		'editor.autoIndent': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.autoIndent,
553
			'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.")
554
		},
J
Johannes Rieken 已提交
555
		'editor.suggestOnTriggerCharacters': {
E
Erich Gamma 已提交
556
			'type': 'boolean',
A
Alex Dima 已提交
557
			'default': EDITOR_DEFAULTS.contribInfo.suggestOnTriggerCharacters,
558
			'description': nls.localize('suggestOnTriggerCharacters', "Controls whether suggestions should automatically show up when typing trigger characters.")
E
Erich Gamma 已提交
559
		},
J
Johannes Rieken 已提交
560
		'editor.acceptSuggestionOnEnter': {
561 562
			'type': 'string',
			'enum': ['on', 'smart', 'off'],
A
Alex Dima 已提交
563
			'default': EDITOR_DEFAULTS.contribInfo.acceptSuggestionOnEnter,
564
			'markdownEnumDescriptions': [
565 566 567 568
				'',
				nls.localize('acceptSuggestionOnEnterSmart', "Only accept a suggestion with `Enter` when it makes a textual change."),
				''
			],
569
			'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.")
570 571 572
		},
		'editor.acceptSuggestionOnCommitCharacter': {
			'type': 'boolean',
A
Alex Dima 已提交
573
			'default': EDITOR_DEFAULTS.contribInfo.acceptSuggestionOnCommitCharacter,
574
			'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.")
575
		},
576
		'editor.snippetSuggestions': {
577
			'type': 'string',
578
			'enum': ['top', 'bottom', 'inline', 'none'],
J
Johannes Rieken 已提交
579 580 581 582 583 584
			'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."),
			],
585
			'default': EDITOR_DEFAULTS.contribInfo.suggest.snippets,
586
			'description': nls.localize('snippetSuggestions', "Controls whether snippets are shown with other suggestions and how they are sorted.")
587
		},
588 589
		'editor.emptySelectionClipboard': {
			'type': 'boolean',
590
			'default': EDITOR_DEFAULTS.emptySelectionClipboard,
591 592
			'description': nls.localize('emptySelectionClipboard', "Controls whether copying without a selection copies the current line.")
		},
593
		'editor.copyWithSyntaxHighlighting': {
594
			'type': 'boolean',
595
			'default': EDITOR_DEFAULTS.copyWithSyntaxHighlighting,
596
			'description': nls.localize('copyWithSyntaxHighlighting', "Controls whether syntax highlighting should be copied into the clipboard.")
597
		},
598
		'editor.wordBasedSuggestions': {
599
			'type': 'boolean',
A
Alex Dima 已提交
600
			'default': EDITOR_DEFAULTS.contribInfo.wordBasedSuggestions,
J
Johannes Rieken 已提交
601
			'description': nls.localize('wordBasedSuggestions', "Controls whether completions should be computed based on words in the document.")
602
		},
J
Johannes Rieken 已提交
603
		'editor.suggestSelection': {
604
			'type': 'string',
J
Johannes Rieken 已提交
605
			'enum': ['first', 'recentlyUsed', 'recentlyUsedByPrefix'],
606
			'markdownEnumDescriptions': [
J
Johannes Rieken 已提交
607 608 609
				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 已提交
610
			],
J
Johannes Rieken 已提交
611 612
			'default': 'recentlyUsed',
			'description': nls.localize('suggestSelection', "Controls how suggestions are pre-selected when showing the suggest list.")
613
		},
J
Johannes Rieken 已提交
614
		'editor.suggestFontSize': {
J
Joao Moreno 已提交
615 616 617
			'type': 'integer',
			'default': 0,
			'minimum': 0,
618
			'markdownDescription': nls.localize('suggestFontSize', "Font size for the suggest widget. When set to `0`, the value of `#editor.fontSize#` is used.")
J
Joao Moreno 已提交
619
		},
J
Johannes Rieken 已提交
620
		'editor.suggestLineHeight': {
J
Joao Moreno 已提交
621 622 623
			'type': 'integer',
			'default': 0,
			'minimum': 0,
624
			'markdownDescription': nls.localize('suggestLineHeight', "Line height for the suggest widget. When set to `0`, the value of `#editor.lineHeight#` is used.")
J
Joao Moreno 已提交
625
		},
626
		'editor.tabCompletion': {
627 628 629
			type: 'string',
			default: 'off',
			enum: ['on', 'off', 'onlySnippets'],
630
			enumDescriptions: [
631 632 633 634 635
				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 已提交
636
		},
637 638 639 640 641
		'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 已提交
642 643 644 645 646
		'editor.suggest.localityBonus': {
			type: 'boolean',
			default: false,
			description: nls.localize('suggest.localityBonus', "Controls whether sorting favours words that appear close to the cursor.")
		},
647 648 649 650 651
		'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#`).")
		},
652 653 654 655 656
		'editor.suggest.snippetsPreventQuickSuggestions': {
			type: 'boolean',
			default: true,
			description: nls.localize('suggest.snippetsPreventQuickSuggestions', "Control whether an active snippet prevents quick suggestions.")
		},
J
Johannes Rieken 已提交
657
		'editor.selectionHighlight': {
E
Erich Gamma 已提交
658
			'type': 'boolean',
A
Alex Dima 已提交
659
			'default': EDITOR_DEFAULTS.contribInfo.selectionHighlight,
P
Pine Wu 已提交
660
			'description': nls.localize('selectionHighlight', "Controls whether the editor should highlight matches similar to the selection")
E
Erich Gamma 已提交
661
		},
662 663
		'editor.occurrencesHighlight': {
			'type': 'boolean',
A
Alex Dima 已提交
664
			'default': EDITOR_DEFAULTS.contribInfo.occurrencesHighlight,
665
			'description': nls.localize('occurrencesHighlight', "Controls whether the editor should highlight semantic symbol occurrences.")
666
		},
J
Johannes Rieken 已提交
667
		'editor.overviewRulerLanes': {
E
Erich Gamma 已提交
668 669
			'type': 'integer',
			'default': 3,
670
			'description': nls.localize('overviewRulerLanes', "Controls the number of decorations that can show up at the same position in the overview ruler.")
E
Erich Gamma 已提交
671
		},
672
		'editor.overviewRulerBorder': {
673
			'type': 'boolean',
A
Alex Dima 已提交
674
			'default': EDITOR_DEFAULTS.viewInfo.overviewRulerBorder,
S
SteVen Batten 已提交
675
			'description': nls.localize('overviewRulerBorder', "Controls whether a border should be drawn around the overview ruler.")
676
		},
J
Johannes Rieken 已提交
677
		'editor.cursorBlinking': {
678
			'type': 'string',
679
			'enum': ['blink', 'smooth', 'phase', 'expand', 'solid'],
680
			'default': editorOptions.blinkingStyleToString(EDITOR_DEFAULTS.viewInfo.cursorBlinking),
A
Alex Dima 已提交
681
			'description': nls.localize('cursorBlinking', "Control the cursor animation style.")
682
		},
683 684
		'editor.mouseWheelZoom': {
			'type': 'boolean',
A
Alex Dima 已提交
685
			'default': EDITOR_DEFAULTS.viewInfo.mouseWheelZoom,
686
			'markdownDescription': nls.localize('mouseWheelZoom', "Zoom the font of the editor when using mouse wheel and holding `Ctrl`.")
687
		},
688 689 690 691 692
		'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 已提交
693
		'editor.cursorStyle': {
M
markrendle 已提交
694
			'type': 'string',
695
			'enum': ['block', 'block-outline', 'line', 'line-thin', 'underline', 'underline-thin'],
696
			'default': editorOptions.cursorStyleToString(EDITOR_DEFAULTS.viewInfo.cursorStyle),
697
			'description': nls.localize('cursorStyle', "Controls the cursor style.")
M
markrendle 已提交
698
		},
699
		'editor.cursorWidth': {
700
			'type': 'integer',
701
			'default': EDITOR_DEFAULTS.viewInfo.cursorWidth,
702
			'markdownDescription': nls.localize('cursorWidth', "Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.")
703
		},
J
Johannes Rieken 已提交
704
		'editor.fontLigatures': {
705
			'type': 'boolean',
A
Alex Dima 已提交
706
			'default': EDITOR_DEFAULTS.viewInfo.fontLigatures,
707
			'description': nls.localize('fontLigatures', "Enables/Disables font ligatures.")
708
		},
J
Johannes Rieken 已提交
709
		'editor.hideCursorInOverviewRuler': {
E
Erich Gamma 已提交
710
			'type': 'boolean',
A
Alex Dima 已提交
711
			'default': EDITOR_DEFAULTS.viewInfo.hideCursorInOverviewRuler,
712
			'description': nls.localize('hideCursorInOverviewRuler', "Controls whether the cursor should be hidden in the overview ruler.")
E
Erich Gamma 已提交
713 714
		},
		'editor.renderWhitespace': {
715 716
			'type': 'string',
			'enum': ['none', 'boundary', 'all'],
717 718 719 720 721
			'enumDescriptions': [
				'',
				nls.localize('renderWhiteSpace.boundary', "Render whitespace characters except for single spaces between words."),
				''
			],
A
Alex Dima 已提交
722
			default: EDITOR_DEFAULTS.viewInfo.renderWhitespace,
723
			description: nls.localize('renderWhitespace', "Controls how the editor should render whitespace characters.")
E
Erich Gamma 已提交
724
		},
725 726
		'editor.renderControlCharacters': {
			'type': 'boolean',
A
Alex Dima 已提交
727
			default: EDITOR_DEFAULTS.viewInfo.renderControlCharacters,
728
			description: nls.localize('renderControlCharacters', "Controls whether the editor should render control characters.")
729
		},
730 731
		'editor.renderIndentGuides': {
			'type': 'boolean',
A
Alex Dima 已提交
732
			default: EDITOR_DEFAULTS.viewInfo.renderIndentGuides,
733
			description: nls.localize('renderIndentGuides', "Controls whether the editor should render indent guides.")
734
		},
735 736 737
		'editor.highlightActiveIndentGuide': {
			'type': 'boolean',
			default: EDITOR_DEFAULTS.viewInfo.highlightActiveIndentGuide,
738
			description: nls.localize('highlightActiveIndentGuide', "Controls whether the editor should highlight the active indent guide.")
739
		},
740
		'editor.renderLineHighlight': {
741 742
			'type': 'string',
			'enum': ['none', 'gutter', 'line', 'all'],
S
SteVen Batten 已提交
743 744 745 746 747 748
			'enumDescriptions': [
				'',
				'',
				'',
				nls.localize('renderLineHighlight.all', "Highlights both the gutter and the current line."),
			],
A
Alex Dima 已提交
749
			default: EDITOR_DEFAULTS.viewInfo.renderLineHighlight,
S
SteVen Batten 已提交
750
			description: nls.localize('renderLineHighlight', "Controls how the editor should render the current line highlight.")
751
		},
J
Johannes Rieken 已提交
752
		'editor.codeLens': {
E
Erich Gamma 已提交
753
			'type': 'boolean',
A
Alex Dima 已提交
754
			'default': EDITOR_DEFAULTS.contribInfo.codeLens,
755
			'description': nls.localize('codeLens', "Controls whether the editor shows CodeLens")
E
Erich Gamma 已提交
756
		},
J
Johannes Rieken 已提交
757
		'editor.folding': {
M
Martin Aeschlimann 已提交
758
			'type': 'boolean',
A
Alex Dima 已提交
759
			'default': EDITOR_DEFAULTS.contribInfo.folding,
760
			'description': nls.localize('folding', "Controls whether the editor has code folding enabled")
M
Martin Aeschlimann 已提交
761
		},
762 763 764 765
		'editor.foldingStrategy': {
			'type': 'string',
			'enum': ['auto', 'indentation'],
			'default': EDITOR_DEFAULTS.contribInfo.foldingStrategy,
766
			'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.")
767
		},
768 769 770 771 772
		'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.")
773
		},
774
		'editor.matchBrackets': {
775
			'type': 'boolean',
A
Alex Dima 已提交
776
			'default': EDITOR_DEFAULTS.contribInfo.matchBrackets,
777
			'description': nls.localize('matchBrackets', "Highlight matching brackets when one of them is selected.")
778
		},
I
isidor 已提交
779 780
		'editor.glyphMargin': {
			'type': 'boolean',
A
Alex Dima 已提交
781
			'default': EDITOR_DEFAULTS.viewInfo.glyphMargin,
I
isidor 已提交
782 783
			'description': nls.localize('glyphMargin', "Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.")
		},
J
Johannes Rieken 已提交
784
		'editor.useTabStops': {
785
			'type': 'boolean',
786
			'default': EDITOR_DEFAULTS.useTabStops,
M
Matt Bierner 已提交
787
			'description': nls.localize('useTabStops', "Inserting and deleting whitespace follows tab stops.")
788
		},
J
Johannes Rieken 已提交
789
		'editor.trimAutoWhitespace': {
790
			'type': 'boolean',
791
			'default': EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,
M
Matt Bierner 已提交
792
			'description': nls.localize('trimAutoWhitespace', "Remove trailing auto inserted whitespace.")
793
		},
J
Johannes Rieken 已提交
794
		'editor.stablePeek': {
795
			'type': 'boolean',
796
			'default': false,
797
			'markdownDescription': nls.localize('stablePeek', "Keep peek editors open even when double clicking their content or when hitting `Escape`.")
798
		},
799
		'editor.dragAndDrop': {
800
			'type': 'boolean',
801
			'default': EDITOR_DEFAULTS.dragAndDrop,
802
			'description': nls.localize('dragAndDrop', "Controls whether the editor should allow moving selections via drag and drop.")
803
		},
804 805 806 807 808 809 810 811 812 813 814
		'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.")
		},
815 816 817 818 819
		'editor.showUnused': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.showUnused,
			'description': nls.localize('showUnused', "Controls fading out of unused code.")
		},
820
		'editor.links': {
821
			'type': 'boolean',
822
			'default': EDITOR_DEFAULTS.contribInfo.links,
S
SteVen Batten 已提交
823
			'description': nls.localize('links', "Controls whether the editor should detect links and make them clickable.")
824
		},
R
rebornix 已提交
825
		'editor.colorDecorators': {
826
			'type': 'boolean',
R
rebornix 已提交
827
			'default': EDITOR_DEFAULTS.contribInfo.colorDecorators,
828
			'description': nls.localize('colorDecorators', "Controls whether the editor should render the inline color decorators and color picker.")
829
		},
830 831 832
		'editor.lightbulb.enabled': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.lightbulbEnabled,
S
SteVen Batten 已提交
833
			'description': nls.localize('codeActions', "Enables the code action lightbulb in the editor.")
834
		},
835 836 837 838 839
		'editor.codeActionsOnSave': {
			'type': 'object',
			'properties': {
				'source.organizeImports': {
					'type': 'boolean',
840
					'description': nls.localize('codeActionsOnSave.organizeImports', "Controls whether organize imports action should be run on file save.")
841 842 843 844 845 846
				}
			},
			'additionalProperties': {
				'type': 'boolean'
			},
			'default': EDITOR_DEFAULTS.contribInfo.codeActionsOnSave,
M
Matt Bierner 已提交
847
			'description': nls.localize('codeActionsOnSave', "Code action kinds to be run on save.")
848 849 850 851
		},
		'editor.codeActionsOnSaveTimeout': {
			'type': 'number',
			'default': EDITOR_DEFAULTS.contribInfo.codeActionsOnSaveTimeout,
852
			'description': nls.localize('codeActionsOnSaveTimeout', "Timeout in milliseconds after which the code actions that are run on save are cancelled.")
853
		},
854 855 856
		'editor.selectionClipboard': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.selectionClipboard,
S
SteVen Batten 已提交
857
			'description': nls.localize('selectionClipboard', "Controls whether the Linux primary clipboard should be supported."),
858
			'included': platform.isLinux
859
		},
J
Johannes Rieken 已提交
860
		'diffEditor.renderSideBySide': {
E
Erich Gamma 已提交
861 862
			'type': 'boolean',
			'default': true,
863
			'description': nls.localize('sideBySide', "Controls whether the diff editor shows the diff side by side or inline.")
E
Erich Gamma 已提交
864
		},
J
Johannes Rieken 已提交
865
		'diffEditor.ignoreTrimWhitespace': {
E
Erich Gamma 已提交
866 867
			'type': 'boolean',
			'default': true,
868
			'description': nls.localize('ignoreTrimWhitespace', "Controls whether the diff editor shows changes in leading or trailing whitespace as diffs.")
869
		},
870 871 872 873
		'editor.largeFileOptimizations': {
			'type': 'boolean',
			'default': EDITOR_MODEL_DEFAULTS.largeFileOptimizations,
			'description': nls.localize('largeFileOptimizations', "Special handling for large files to disable certain memory intensive features.")
874
		},
875 876 877
		'diffEditor.renderIndicators': {
			'type': 'boolean',
			'default': true,
878
			'description': nls.localize('renderIndicators', "Controls whether the diff editor shows +/- indicators for added/removed changes.")
E
Erich Gamma 已提交
879 880
		}
	}
A
Alex Dima 已提交
881 882
};

A
Alex Dima 已提交
883
let cachedEditorConfigurationKeys: { [key: string]: boolean; } | null = null;
884 885
function getEditorConfigurationKeys(): { [key: string]: boolean; } {
	if (cachedEditorConfigurationKeys === null) {
A
Alex Dima 已提交
886 887 888
		cachedEditorConfigurationKeys = <{ [key: string]: boolean; }>Object.create(null);
		Object.keys(editorConfiguration.properties!).forEach((prop) => {
			cachedEditorConfigurationKeys![prop] = true;
889 890 891 892 893 894 895 896 897 898 899 900 901 902
		});
	}
	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);
}

903
configurationRegistry.registerConfiguration(editorConfiguration);