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

A
Alex Dima 已提交
7
import * as nls from 'vs/nls';
J
Johannes Rieken 已提交
8 9
import Event, { Emitter } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
A
Alex Dima 已提交
10
import * as objects from 'vs/base/common/objects';
A
Alex Dima 已提交
11
import * as platform from 'vs/base/common/platform';
J
Johannes Rieken 已提交
12 13
import { Extensions, IConfigurationRegistry, IConfigurationNode } from 'vs/platform/configuration/common/configurationRegistry';
import { Registry } from 'vs/platform/platform';
A
Alex Dima 已提交
14
import * as editorCommon from 'vs/editor/common/editorCommon';
15
import { FontInfo, BareFontInfo } from 'vs/editor/common/config/fontInfo';
A
Alex Dima 已提交
16
import { EditorZoom } from 'vs/editor/common/config/editorZoom';
17
import * as editorOptions from 'vs/editor/common/config/editorOptions';
18 19 20
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 已提交
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 34 35 36 37
}

export const TabFocus: ITabFocus = new class {
	private _tabFocus: boolean = false;

	private _onDidChangeTabFocus: Emitter<boolean> = new Emitter<boolean>();
J
Johannes Rieken 已提交
38
	public 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: platform.AccessibilitySupport;
62 63
}

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

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

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

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

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 || {});

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

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

	public dispose(): void {
		super.dispose();
	}

	protected _recomputeOptions(): void {
A
Alex Dima 已提交
98 99
		const oldOptions = this.editor;
		const newOptions = this._computeInternalOptions();
100

A
Alex Dima 已提交
101
		if (oldOptions && oldOptions.equals(newOptions)) {
102
			return;
E
Erich Gamma 已提交
103 104
		}

105
		this.editor = newOptions;
E
Erich Gamma 已提交
106

A
Alex Dima 已提交
107 108
		if (oldOptions) {
			this._onDidChange.fire(oldOptions.createChangeEvent(newOptions));
109
		}
E
Erich Gamma 已提交
110
	}
111

112
	public getRawOptions(): editorOptions.IEditorOptions {
113
		return this._rawOptions;
E
Erich Gamma 已提交
114
	}
115

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

135
	public updateOptions(newOptions: editorOptions.IEditorOptions): void {
136
		this._rawOptions = objects.mixin(this._rawOptions, newOptions || {});
137
		this._validatedOptions = editorOptions.EditorOptionsValidator.validate(this._rawOptions, EDITOR_DEFAULTS);
E
Erich Gamma 已提交
138 139 140
		this._recomputeOptions();
	}

J
Johannes Rieken 已提交
141
	public setIsDominatedByLongLines(isDominatedByLongLines: boolean): void {
E
Erich Gamma 已提交
142 143 144 145
		this._isDominatedByLongLines = isDominatedByLongLines;
		this._recomputeOptions();
	}

J
Johannes Rieken 已提交
146
	public setMaxLineNumber(maxLineNumber: number): void {
147
		let digitCount = CommonEditorConfiguration._digitCount(maxLineNumber);
148
		if (this._lineNumbersDigitCount === digitCount) {
A
Alex Dima 已提交
149 150
			return;
		}
151
		this._lineNumbersDigitCount = digitCount;
E
Erich Gamma 已提交
152 153 154
		this._recomputeOptions();
	}

155
	private static _digitCount(n: number): number {
156 157 158 159 160 161 162
		var r = 0;
		while (n) {
			n = Math.floor(n / 10);
			r++;
		}
		return r ? r : 1;
	}
A
Alex Dima 已提交
163
	protected abstract _getEnvConfiguration(): IEnvConfiguration;
164

165
	protected abstract readConfiguration(styling: BareFontInfo): FontInfo;
166

E
Erich Gamma 已提交
167 168
}

169 170
const configurationRegistry = <IConfigurationRegistry>Registry.as(Extensions.Configuration);
const editorConfiguration: IConfigurationNode = {
E
Erich Gamma 已提交
171 172 173
	'id': 'editor',
	'order': 5,
	'type': 'object',
174
	'title': nls.localize('editorConfigurationTitle', "Editor"),
175
	'overridable': true,
J
Johannes Rieken 已提交
176 177
	'properties': {
		'editor.fontFamily': {
E
Erich Gamma 已提交
178
			'type': 'string',
179
			'default': EDITOR_FONT_DEFAULTS.fontFamily,
E
Erich Gamma 已提交
180 181
			'description': nls.localize('fontFamily', "Controls the font family.")
		},
J
Johannes Rieken 已提交
182
		'editor.fontWeight': {
183
			'type': 'string',
184
			'enum': ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
185
			'default': EDITOR_FONT_DEFAULTS.fontWeight,
186 187
			'description': nls.localize('fontWeight', "Controls the font weight.")
		},
J
Johannes Rieken 已提交
188
		'editor.fontSize': {
E
Erich Gamma 已提交
189
			'type': 'number',
190
			'default': EDITOR_FONT_DEFAULTS.fontSize,
191
			'description': nls.localize('fontSize', "Controls the font size in pixels.")
E
Erich Gamma 已提交
192
		},
J
Johannes Rieken 已提交
193
		'editor.lineHeight': {
E
Erich Gamma 已提交
194
			'type': 'number',
195
			'default': EDITOR_FONT_DEFAULTS.lineHeight,
196
			'description': nls.localize('lineHeight', "Controls the line height. Use 0 to compute the lineHeight from the fontSize.")
E
Erich Gamma 已提交
197
		},
198 199
		'editor.letterSpacing': {
			'type': 'number',
200
			'default': EDITOR_FONT_DEFAULTS.letterSpacing,
201 202
			'description': nls.localize('letterSpacing', "Controls the letter spacing in pixels.")
		},
J
Johannes Rieken 已提交
203
		'editor.lineNumbers': {
204 205
			'type': 'string',
			'enum': ['off', 'on', 'relative'],
206
			'default': 'on',
207
			'description': nls.localize('lineNumbers', "Controls the display of line numbers. Possible values are 'on', 'off', and 'relative'. 'relative' shows the line count from the current cursor position.")
E
Erich Gamma 已提交
208
		},
J
Johannes Rieken 已提交
209
		'editor.rulers': {
210 211 212 213
			'type': 'array',
			'items': {
				'type': 'number'
			},
A
Alex Dima 已提交
214
			'default': EDITOR_DEFAULTS.viewInfo.rulers,
215 216
			'description': nls.localize('rulers', "Columns at which to show vertical rulers")
		},
J
Johannes Rieken 已提交
217
		'editor.wordSeparators': {
A
Alex Dima 已提交
218
			'type': 'string',
219
			'default': EDITOR_DEFAULTS.wordSeparators,
A
Alex Dima 已提交
220 221
			'description': nls.localize('wordSeparators', "Characters that will be used as word separators when doing word related navigations or operations")
		},
J
Johannes Rieken 已提交
222
		'editor.tabSize': {
223
			'type': 'number',
224
			'default': EDITOR_MODEL_DEFAULTS.tabSize,
E
Erich Gamma 已提交
225
			'minimum': 1,
226
			'description': nls.localize('tabSize', "The number of spaces a tab is equal to. This setting is overriden based on the file contents when `editor.detectIndentation` is on."),
227
			'errorMessage': nls.localize('tabSize.errorMessage', "Expected 'number'. Note that the value \"auto\" has been replaced by the `editor.detectIndentation` setting.")
E
Erich Gamma 已提交
228
		},
J
Johannes Rieken 已提交
229
		'editor.insertSpaces': {
230
			'type': 'boolean',
231
			'default': EDITOR_MODEL_DEFAULTS.insertSpaces,
232
			'description': nls.localize('insertSpaces', "Insert spaces when pressing Tab. This setting is overriden based on the file contents when `editor.detectIndentation` is on."),
233
			'errorMessage': nls.localize('insertSpaces.errorMessage', "Expected 'boolean'. Note that the value \"auto\" has been replaced by the `editor.detectIndentation` setting.")
E
Erich Gamma 已提交
234
		},
J
Johannes Rieken 已提交
235
		'editor.detectIndentation': {
236
			'type': 'boolean',
237
			'default': EDITOR_MODEL_DEFAULTS.detectIndentation,
A
Alex Dima 已提交
238
			'description': nls.localize('detectIndentation', "When opening a file, `editor.tabSize` and `editor.insertSpaces` will be detected based on the file contents.")
239
		},
J
Johannes Rieken 已提交
240
		'editor.roundedSelection': {
E
Erich Gamma 已提交
241
			'type': 'boolean',
A
Alex Dima 已提交
242
			'default': EDITOR_DEFAULTS.viewInfo.roundedSelection,
E
Erich Gamma 已提交
243 244
			'description': nls.localize('roundedSelection', "Controls if selections have rounded corners")
		},
J
Johannes Rieken 已提交
245
		'editor.scrollBeyondLastLine': {
E
Erich Gamma 已提交
246
			'type': 'boolean',
A
Alex Dima 已提交
247
			'default': EDITOR_DEFAULTS.viewInfo.scrollBeyondLastLine,
E
Erich Gamma 已提交
248 249
			'description': nls.localize('scrollBeyondLastLine', "Controls if the editor will scroll beyond the last line")
		},
250 251
		'editor.minimap.enabled': {
			'type': 'boolean',
A
Alex Dima 已提交
252
			'default': EDITOR_DEFAULTS.viewInfo.minimap.enabled,
253 254
			'description': nls.localize('minimap.enabled', "Controls if the minimap is shown")
		},
255 256 257 258 259 260
		'editor.minimap.showSlider': {
			'type': 'string',
			'enum': ['always', 'mouseover'],
			'default': EDITOR_DEFAULTS.viewInfo.minimap.showSlider,
			'description': nls.localize('minimap.showSlider', "Controls whether the minimap slider is automatically hidden.")
		},
261
		'editor.minimap.renderCharacters': {
262
			'type': 'boolean',
A
Alex Dima 已提交
263
			'default': EDITOR_DEFAULTS.viewInfo.minimap.renderCharacters,
264
			'description': nls.localize('minimap.renderCharacters', "Render the actual characters on a line (as opposed to color blocks)")
265
		},
A
Alex Dima 已提交
266 267
		'editor.minimap.maxColumn': {
			'type': 'number',
A
Alex Dima 已提交
268
			'default': EDITOR_DEFAULTS.viewInfo.minimap.maxColumn,
A
Alex Dima 已提交
269 270
			'description': nls.localize('minimap.maxColumn', "Limit the width of the minimap to render at most a certain number of columns")
		},
271 272 273
		'editor.find.seedSearchStringFromSelection': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.find.seedSearchStringFromSelection,
274
			'description': nls.localize('find.seedSearchStringFromSelection', "Controls if we seed the search string in Find Widget from editor selection")
275
		},
R
rebornix 已提交
276 277 278 279 280
		'editor.find.autoFindInSelection': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.contribInfo.find.autoFindInSelection,
			'description': nls.localize('find.autoFindInSelection', "Controls if Find in Selection flag is turned on when multiple characters or lines of text are selected in the editor")
		},
J
Johannes Rieken 已提交
281
		'editor.wordWrap': {
282
			'type': 'string',
A
Alex Dima 已提交
283
			'enum': ['off', 'on', 'wordWrapColumn', 'bounded'],
284 285 286
			'enumDescriptions': [
				nls.localize('wordWrap.off', "Lines will never wrap."),
				nls.localize('wordWrap.on', "Lines will wrap at the viewport width."),
A
Alex Dima 已提交
287 288 289 290 291 292
				nls.localize({
					key: 'wordWrap.wordWrapColumn',
					comment: [
						'- `editor.wordWrapColumn` refers to a different setting and should not be localized.'
					]
				}, "Lines will wrap at `editor.wordWrapColumn`."),
A
Alex Dima 已提交
293 294 295 296
				nls.localize({
					key: 'wordWrap.bounded',
					comment: [
						'- viewport means the edge of the visible window size.',
A
Alex Dima 已提交
297
						'- `editor.wordWrapColumn` refers to a different setting and should not be localized.'
A
Alex Dima 已提交
298 299
					]
				}, "Lines will wrap at the minimum of viewport and `editor.wordWrapColumn`."),
300
			],
301
			'default': EDITOR_DEFAULTS.wordWrap,
A
Alex Dima 已提交
302 303 304 305 306 307 308
			'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.'
				]
			}, "Controls how lines should wrap. Can be:\n - 'off' (disable wrapping),\n - 'on' (viewport wrapping),\n - 'wordWrapColumn' (wrap at `editor.wordWrapColumn`) or\n - 'bounded' (wrap at minimum of viewport and `editor.wordWrapColumn`).")
309 310 311
		},
		'editor.wordWrapColumn': {
			'type': 'integer',
312
			'default': EDITOR_DEFAULTS.wordWrapColumn,
313
			'minimum': 1,
A
Alex Dima 已提交
314 315 316 317 318 319 320
			'description': nls.localize({
				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.'
				]
			}, "Controls the wrapping column of the editor when `editor.wordWrap` is 'wordWrapColumn' or 'bounded'.")
321
		},
J
Johannes Rieken 已提交
322
		'editor.wrappingIndent': {
E
Erich Gamma 已提交
323 324
			'type': 'string',
			'enum': ['none', 'same', 'indent'],
325
			'default': 'same',
E
Erich Gamma 已提交
326 327
			'description': nls.localize('wrappingIndent', "Controls the indentation of wrapped lines. Can be one of 'none', 'same' or 'indent'.")
		},
J
Johannes Rieken 已提交
328
		'editor.mouseWheelScrollSensitivity': {
E
Erich Gamma 已提交
329
			'type': 'number',
A
Alex Dima 已提交
330
			'default': EDITOR_DEFAULTS.viewInfo.scrollbar.mouseWheelScrollSensitivity,
E
Erich Gamma 已提交
331 332
			'description': nls.localize('mouseWheelScrollSensitivity', "A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events")
		},
333
		'editor.multiCursorModifier': {
334
			'type': 'string',
335 336 337 338 339
			'enum': ['ctrlCmd', 'alt'],
			'enumDescriptions': [
				nls.localize('multiCursorModifier.ctrlCmd', "Maps to `Control` on Windows and Linux and to `Command` on OSX."),
				nls.localize('multiCursorModifier.alt', "Maps to `Alt` on Windows and Linux and to `Option` on OSX.")
			],
340
			'default': 'alt',
341 342 343 344 345 346 347
			'description': nls.localize({
				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.'
				]
			}, "The modifier to be used to add multiple cursors with the mouse. `ctrlCmd` maps to `Control` on Windows and Linux and to `Command` on OSX. The Go To Definition and Open Link mouse gestures will adapt such that they do not conflict with the multicursor modifier.")
348
		},
J
Johannes Rieken 已提交
349
		'editor.quickSuggestions': {
350
			'anyOf': [
351 352 353
				{
					type: 'boolean',
				},
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
				{
					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 已提交
375
			'default': EDITOR_DEFAULTS.contribInfo.quickSuggestions,
376
			'description': nls.localize('quickSuggestions', "Controls if suggestions should automatically show up while typing")
E
Erich Gamma 已提交
377
		},
J
Johannes Rieken 已提交
378
		'editor.quickSuggestionsDelay': {
E
Erich Gamma 已提交
379
			'type': 'integer',
A
Alex Dima 已提交
380
			'default': EDITOR_DEFAULTS.contribInfo.quickSuggestionsDelay,
E
Erich Gamma 已提交
381 382 383
			'minimum': 0,
			'description': nls.localize('quickSuggestionsDelay', "Controls the delay in ms after which quick suggestions will show up")
		},
J
Johannes Rieken 已提交
384
		'editor.parameterHints': {
J
Joao Moreno 已提交
385
			'type': 'boolean',
A
Alex Dima 已提交
386
			'default': EDITOR_DEFAULTS.contribInfo.parameterHints,
387
			'description': nls.localize('parameterHints', "Enables pop-up that shows parameter documentation and type information as you type")
J
Joao Moreno 已提交
388
		},
J
Johannes Rieken 已提交
389
		'editor.autoClosingBrackets': {
E
Erich Gamma 已提交
390
			'type': 'boolean',
391
			'default': EDITOR_DEFAULTS.autoClosingBrackets,
E
Erich Gamma 已提交
392 393
			'description': nls.localize('autoClosingBrackets', "Controls if the editor should automatically close brackets after opening them")
		},
J
Johannes Rieken 已提交
394
		'editor.formatOnType': {
E
Erich Gamma 已提交
395
			'type': 'boolean',
A
Alex Dima 已提交
396
			'default': EDITOR_DEFAULTS.contribInfo.formatOnType,
E
Erich Gamma 已提交
397 398
			'description': nls.localize('formatOnType', "Controls if the editor should automatically format the line after typing")
		},
399 400
		'editor.formatOnPaste': {
			'type': 'boolean',
A
Alex Dima 已提交
401
			'default': EDITOR_DEFAULTS.contribInfo.formatOnPaste,
402
			'description': nls.localize('formatOnPaste', "Controls if 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.")
403
		},
404 405 406 407 408
		'editor.autoIndent': {
			'type': 'boolean',
			'default': EDITOR_DEFAULTS.autoIndent,
			'description': nls.localize('autoIndent', "Controls if the editor should automatically adjust the indenation when users type. Indentation Rules of the language must be available. ")
		},
J
Johannes Rieken 已提交
409
		'editor.suggestOnTriggerCharacters': {
E
Erich Gamma 已提交
410
			'type': 'boolean',
A
Alex Dima 已提交
411
			'default': EDITOR_DEFAULTS.contribInfo.suggestOnTriggerCharacters,
E
Erich Gamma 已提交
412 413
			'description': nls.localize('suggestOnTriggerCharacters', "Controls if suggestions should automatically show up when typing trigger characters")
		},
J
Johannes Rieken 已提交
414
		'editor.acceptSuggestionOnEnter': {
415 416
			'type': 'string',
			'enum': ['on', 'smart', 'off'],
A
Alex Dima 已提交
417
			'default': EDITOR_DEFAULTS.contribInfo.acceptSuggestionOnEnter,
418
			'description': nls.localize('acceptSuggestionOnEnter', "Controls if suggestions should be accepted on 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions. The value 'smart' means only accept a suggestion with Enter when it makes a textual change")
419 420 421
		},
		'editor.acceptSuggestionOnCommitCharacter': {
			'type': 'boolean',
A
Alex Dima 已提交
422
			'default': EDITOR_DEFAULTS.contribInfo.acceptSuggestionOnCommitCharacter,
423
			'description': nls.localize('acceptSuggestionOnCommitCharacter', "Controls if suggestions should be accepted on commit characters. For instance in JavaScript the semi-colon (';') can be a commit character that accepts a suggestion and types that character.")
424
		},
425
		'editor.snippetSuggestions': {
426
			'type': 'string',
427
			'enum': ['top', 'bottom', 'inline', 'none'],
A
Alex Dima 已提交
428
			'default': EDITOR_DEFAULTS.contribInfo.snippetSuggestions,
429
			'description': nls.localize('snippetSuggestions', "Controls whether snippets are shown with other suggestions and how they are sorted.")
430
		},
431 432
		'editor.emptySelectionClipboard': {
			'type': 'boolean',
433
			'default': EDITOR_DEFAULTS.emptySelectionClipboard,
434 435
			'description': nls.localize('emptySelectionClipboard', "Controls whether copying without a selection copies the current line.")
		},
436
		'editor.wordBasedSuggestions': {
437
			'type': 'boolean',
A
Alex Dima 已提交
438
			'default': EDITOR_DEFAULTS.contribInfo.wordBasedSuggestions,
J
Johannes Rieken 已提交
439
			'description': nls.localize('wordBasedSuggestions', "Controls whether completions should be computed based on words in the document.")
440
		},
J
Johannes Rieken 已提交
441
		'editor.suggestFontSize': {
J
Joao Moreno 已提交
442 443 444 445 446
			'type': 'integer',
			'default': 0,
			'minimum': 0,
			'description': nls.localize('suggestFontSize', "Font size for the suggest widget")
		},
J
Johannes Rieken 已提交
447
		'editor.suggestLineHeight': {
J
Joao Moreno 已提交
448 449 450 451 452
			'type': 'integer',
			'default': 0,
			'minimum': 0,
			'description': nls.localize('suggestLineHeight', "Line height for the suggest widget")
		},
J
Johannes Rieken 已提交
453
		'editor.selectionHighlight': {
E
Erich Gamma 已提交
454
			'type': 'boolean',
A
Alex Dima 已提交
455
			'default': EDITOR_DEFAULTS.contribInfo.selectionHighlight,
E
Erich Gamma 已提交
456 457
			'description': nls.localize('selectionHighlight', "Controls whether the editor should highlight similar matches to the selection")
		},
458 459
		'editor.occurrencesHighlight': {
			'type': 'boolean',
A
Alex Dima 已提交
460
			'default': EDITOR_DEFAULTS.contribInfo.occurrencesHighlight,
461 462
			'description': nls.localize('occurrencesHighlight', "Controls whether the editor should highlight semantic symbol occurrences")
		},
J
Johannes Rieken 已提交
463
		'editor.overviewRulerLanes': {
E
Erich Gamma 已提交
464 465 466 467
			'type': 'integer',
			'default': 3,
			'description': nls.localize('overviewRulerLanes', "Controls the number of decorations that can show up at the same position in the overview ruler")
		},
468
		'editor.overviewRulerBorder': {
469
			'type': 'boolean',
A
Alex Dima 已提交
470
			'default': EDITOR_DEFAULTS.viewInfo.overviewRulerBorder,
471
			'description': nls.localize('overviewRulerBorder', "Controls if a border should be drawn around the overview ruler.")
472
		},
J
Johannes Rieken 已提交
473
		'editor.cursorBlinking': {
474
			'type': 'string',
475
			'enum': ['blink', 'smooth', 'phase', 'expand', 'solid'],
476
			'default': editorOptions.blinkingStyleToString(EDITOR_DEFAULTS.viewInfo.cursorBlinking),
477
			'description': nls.localize('cursorBlinking', "Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'")
478
		},
479 480
		'editor.mouseWheelZoom': {
			'type': 'boolean',
A
Alex Dima 已提交
481
			'default': EDITOR_DEFAULTS.viewInfo.mouseWheelZoom,
482 483
			'description': nls.localize('mouseWheelZoom', "Zoom the font of the editor when using mouse wheel and holding Ctrl")
		},
J
Johannes Rieken 已提交
484
		'editor.cursorStyle': {
M
markrendle 已提交
485
			'type': 'string',
486
			'enum': ['block', 'block-outline', 'line', 'line-thin', 'underline', 'underline-thin'],
487
			'default': editorOptions.cursorStyleToString(EDITOR_DEFAULTS.viewInfo.cursorStyle),
488
			'description': nls.localize('cursorStyle', "Controls the cursor style, accepted values are 'block', 'block-outline', 'line', 'line-thin', 'underline' and 'underline-thin'")
M
markrendle 已提交
489
		},
J
Johannes Rieken 已提交
490
		'editor.fontLigatures': {
491
			'type': 'boolean',
A
Alex Dima 已提交
492
			'default': EDITOR_DEFAULTS.viewInfo.fontLigatures,
493 494
			'description': nls.localize('fontLigatures', "Enables font ligatures")
		},
J
Johannes Rieken 已提交
495
		'editor.hideCursorInOverviewRuler': {
E
Erich Gamma 已提交
496
			'type': 'boolean',
A
Alex Dima 已提交
497
			'default': EDITOR_DEFAULTS.viewInfo.hideCursorInOverviewRuler,
E
Erich Gamma 已提交
498 499 500
			'description': nls.localize('hideCursorInOverviewRuler', "Controls if the cursor should be hidden in the overview ruler.")
		},
		'editor.renderWhitespace': {
501 502
			'type': 'string',
			'enum': ['none', 'boundary', 'all'],
A
Alex Dima 已提交
503
			default: EDITOR_DEFAULTS.viewInfo.renderWhitespace,
504
			description: nls.localize('renderWhitespace', "Controls how the editor should render whitespace characters, possibilities are 'none', 'boundary', and 'all'. The 'boundary' option does not render single spaces between words.")
E
Erich Gamma 已提交
505
		},
506 507
		'editor.renderControlCharacters': {
			'type': 'boolean',
A
Alex Dima 已提交
508
			default: EDITOR_DEFAULTS.viewInfo.renderControlCharacters,
509 510
			description: nls.localize('renderControlCharacters', "Controls whether the editor should render control characters")
		},
511 512
		'editor.renderIndentGuides': {
			'type': 'boolean',
A
Alex Dima 已提交
513
			default: EDITOR_DEFAULTS.viewInfo.renderIndentGuides,
514 515
			description: nls.localize('renderIndentGuides', "Controls whether the editor should render indent guides")
		},
516
		'editor.renderLineHighlight': {
517 518
			'type': 'string',
			'enum': ['none', 'gutter', 'line', 'all'],
A
Alex Dima 已提交
519
			default: EDITOR_DEFAULTS.viewInfo.renderLineHighlight,
520
			description: nls.localize('renderLineHighlight', "Controls how the editor should render the current line highlight, possibilities are 'none', 'gutter', 'line', and 'all'.")
521
		},
J
Johannes Rieken 已提交
522
		'editor.codeLens': {
E
Erich Gamma 已提交
523
			'type': 'boolean',
A
Alex Dima 已提交
524
			'default': EDITOR_DEFAULTS.contribInfo.codeLens,
525
			'description': nls.localize('codeLens', "Controls if the editor shows code lenses")
E
Erich Gamma 已提交
526
		},
J
Johannes Rieken 已提交
527
		'editor.folding': {
M
Martin Aeschlimann 已提交
528
			'type': 'boolean',
A
Alex Dima 已提交
529
			'default': EDITOR_DEFAULTS.contribInfo.folding,
530
			'description': nls.localize('folding', "Controls whether the editor has code folding enabled")
M
Martin Aeschlimann 已提交
531
		},
532 533 534 535 536
		'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.")
537
		},
538
		'editor.matchBrackets': {
539
			'type': 'boolean',
A
Alex Dima 已提交
540
			'default': EDITOR_DEFAULTS.contribInfo.matchBrackets,
541
			'description': nls.localize('matchBrackets', "Highlight matching brackets when one of them is selected.")
542
		},
I
isidor 已提交
543 544
		'editor.glyphMargin': {
			'type': 'boolean',
A
Alex Dima 已提交
545
			'default': EDITOR_DEFAULTS.viewInfo.glyphMargin,
I
isidor 已提交
546 547
			'description': nls.localize('glyphMargin', "Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.")
		},
J
Johannes Rieken 已提交
548
		'editor.useTabStops': {
549
			'type': 'boolean',
550
			'default': EDITOR_DEFAULTS.useTabStops,
551 552
			'description': nls.localize('useTabStops', "Inserting and deleting whitespace follows tab stops")
		},
J
Johannes Rieken 已提交
553
		'editor.trimAutoWhitespace': {
554
			'type': 'boolean',
555
			'default': EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,
556 557
			'description': nls.localize('trimAutoWhitespace', "Remove trailing auto inserted whitespace")
		},
J
Johannes Rieken 已提交
558
		'editor.stablePeek': {
559
			'type': 'boolean',
560
			'default': false,
561
			'description': nls.localize('stablePeek', "Keep peek editors open even when double clicking their content or when hitting Escape.")
562
		},
563
		'editor.dragAndDrop': {
564
			'type': 'boolean',
565
			'default': EDITOR_DEFAULTS.dragAndDrop,
566
			'description': nls.localize('dragAndDrop', "Controls if the editor should allow to move selections via drag and drop.")
567
		},
568 569 570 571 572 573 574 575 576 577 578
		'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.")
		},
579
		'editor.links': {
580
			'type': 'boolean',
581 582
			'default': EDITOR_DEFAULTS.contribInfo.links,
			'description': nls.localize('links', "Controls whether the editor should detect links and make them clickable")
583
		},
J
Johannes Rieken 已提交
584
		'diffEditor.renderSideBySide': {
E
Erich Gamma 已提交
585 586 587 588
			'type': 'boolean',
			'default': true,
			'description': nls.localize('sideBySide', "Controls if the diff editor shows the diff side by side or inline")
		},
J
Johannes Rieken 已提交
589
		'diffEditor.ignoreTrimWhitespace': {
E
Erich Gamma 已提交
590 591 592
			'type': 'boolean',
			'default': true,
			'description': nls.localize('ignoreTrimWhitespace', "Controls if the diff editor shows changes in leading or trailing whitespace as diffs")
593 594 595 596 597
		},
		'diffEditor.renderIndicators': {
			'type': 'boolean',
			'default': true,
			'description': nls.localize('renderIndicators', "Controls if the diff editor shows +/- indicators for added/removed changes")
E
Erich Gamma 已提交
598 599
		}
	}
A
Alex Dima 已提交
600 601 602 603 604
};

if (platform.isLinux) {
	editorConfiguration['properties']['editor.selectionClipboard'] = {
		'type': 'boolean',
A
Alex Dima 已提交
605
		'default': EDITOR_DEFAULTS.contribInfo.selectionClipboard,
A
Alex Dima 已提交
606 607 608 609
		'description': nls.localize('selectionClipboard', "Controls if the Linux primary clipboard should be supported.")
	};
}

610
configurationRegistry.registerConfiguration(editorConfiguration);