commonEditorConfig.ts 22.8 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);
	}
};

54 55
export interface IElementSizeObserver {
	startObserving(): void;
J
Johannes Rieken 已提交
56
	observe(dimension?: editorCommon.IDimension): void;
57 58 59 60 61
	dispose(): void;
	getWidth(): number;
	getHeight(): number;
}

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

64 65 66
	protected _rawOptions: editorOptions.IEditorOptions;
	protected _validatedOptions: editorOptions.IValidatedEditorOptions;

67
	public editor: editorOptions.InternalEditorOptions;
E
Erich Gamma 已提交
68

69
	protected _elementSizeObserver: IElementSizeObserver;
J
Johannes Rieken 已提交
70
	private _isDominatedByLongLines: boolean;
71
	private _lineNumbersDigitCount: number;
E
Erich Gamma 已提交
72

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

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

79 80
		this._rawOptions = options || {};
		this._validatedOptions = editorOptions.EditorOptionsValidator.validate(this._rawOptions, EDITOR_DEFAULTS);
81

82
		this._elementSizeObserver = elementSizeObserver;
E
Erich Gamma 已提交
83
		this._isDominatedByLongLines = false;
84
		this._lineNumbersDigitCount = 1;
E
Erich Gamma 已提交
85
		this.editor = this._computeInternalOptions();
86
		this._register(EditorZoom.onDidChangeZoomLevel(_ => this._recomputeOptions()));
87
		this._register(TabFocus.onDidChangeTabFocus(_ => this._recomputeOptions()));
E
Erich Gamma 已提交
88 89 90 91 92 93 94
	}

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

	protected _recomputeOptions(): void {
95 96
		this._setOptions(this._computeInternalOptions());
	}
97

98
	private _setOptions(newOptions: editorOptions.InternalEditorOptions): void {
99 100
		if (this.editor && this.editor.equals(newOptions)) {
			return;
E
Erich Gamma 已提交
101 102
		}

103 104 105
		let changeEvent = this.editor.createChangeEvent(newOptions);
		this.editor = newOptions;
		this._onDidChange.fire(changeEvent);
E
Erich Gamma 已提交
106 107
	}

108
	public getRawOptions(): editorOptions.IEditorOptions {
109
		return this._rawOptions;
E
Erich Gamma 已提交
110 111
	}

112
	private _computeInternalOptions(): editorOptions.InternalEditorOptions {
113 114
		const opts = this._validatedOptions;
		const bareFontInfo = BareFontInfo.createFromRawSettings(this._rawOptions, this.getZoomLevel());
115 116 117 118
		const env = new editorOptions.EnvironmentalOptions({
			outerWidth: this.getOuterWidth(),
			outerHeight: this.getOuterHeight(),
			fontInfo: this.readConfiguration(bareFontInfo),
119
			editorClassName: this._getEditorClassName(opts.theme, opts.fontLigatures, opts.mouseStyle),
120 121 122 123 124 125 126
			isDominatedByLongLines: this._isDominatedByLongLines,
			lineNumbersDigitCount: this._lineNumbersDigitCount,
			canUseTranslate3d: this._getCanUseTranslate3d(),
			pixelRatio: this._getPixelRatio(),
			tabFocusMode: TabFocus.getTabFocusMode()
		});
		return editorOptions.InternalEditorOptionsFactory.createInternalEditorOptions(env, opts);
E
Erich Gamma 已提交
127 128
	}

129
	public updateOptions(newOptions: editorOptions.IEditorOptions): void {
130
		this._rawOptions = objects.mixin(this._rawOptions, newOptions || {});
131
		this._validatedOptions = editorOptions.EditorOptionsValidator.validate(this._rawOptions, EDITOR_DEFAULTS);
E
Erich Gamma 已提交
132 133 134
		this._recomputeOptions();
	}

J
Johannes Rieken 已提交
135
	public setIsDominatedByLongLines(isDominatedByLongLines: boolean): void {
E
Erich Gamma 已提交
136 137 138 139
		this._isDominatedByLongLines = isDominatedByLongLines;
		this._recomputeOptions();
	}

J
Johannes Rieken 已提交
140
	public setMaxLineNumber(maxLineNumber: number): void {
141
		let digitCount = CommonEditorConfiguration._digitCount(maxLineNumber);
142
		if (this._lineNumbersDigitCount === digitCount) {
A
Alex Dima 已提交
143 144
			return;
		}
145
		this._lineNumbersDigitCount = digitCount;
E
Erich Gamma 已提交
146 147 148
		this._recomputeOptions();
	}

149
	private static _digitCount(n: number): number {
150 151 152 153 154 155 156 157
		var r = 0;
		while (n) {
			n = Math.floor(n / 10);
			r++;
		}
		return r ? r : 1;
	}

R
rebornix 已提交
158
	protected abstract _getEditorClassName(theme: string, fontLigatures: boolean, mouseDrag: 'text' | 'default' | 'copy'): string;
E
Erich Gamma 已提交
159

160
	protected abstract getOuterWidth(): number;
E
Erich Gamma 已提交
161

162
	protected abstract getOuterHeight(): number;
E
Erich Gamma 已提交
163

164 165
	protected abstract _getCanUseTranslate3d(): boolean;

166 167
	protected abstract _getPixelRatio(): number;

168
	protected abstract readConfiguration(styling: BareFontInfo): FontInfo;
169 170

	protected abstract getZoomLevel(): number;
E
Erich Gamma 已提交
171 172
}

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

if (platform.isLinux) {
	editorConfiguration['properties']['editor.selectionClipboard'] = {
		'type': 'boolean',
549
		'default': EDITOR_DEFAULTS.selectionClipboard,
A
Alex Dima 已提交
550 551 552 553
		'description': nls.localize('selectionClipboard', "Controls if the Linux primary clipboard should be supported.")
	};
}

554
configurationRegistry.registerConfiguration(editorConfiguration);