commonEditorConfig.ts 23.6 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';
14
import { DefaultConfig, DEFAULT_INDENTATION, DEFAULT_TRIM_AUTO_WHITESPACE } from 'vs/editor/common/config/defaultConfig';
A
Alex Dima 已提交
15
import * as editorCommon from 'vs/editor/common/editorCommon';
16
import { FontInfo, BareFontInfo } from 'vs/editor/common/config/fontInfo';
A
Alex Dima 已提交
17
import { EditorZoom } from 'vs/editor/common/config/editorZoom';
18
import * as editorOptions from 'vs/editor/common/config/editorOptions';
E
Erich Gamma 已提交
19

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

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

	private _onDidChangeTabFocus: Emitter<boolean> = new Emitter<boolean>();
J
Johannes Rieken 已提交
36
	public onDidChangeTabFocus: Event<boolean> = this._onDidChangeTabFocus.event;
37 38 39 40 41

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

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

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

E
Erich Gamma 已提交
52 53
export class ConfigurationWithDefaults {

54
	private _editor: editorOptions.IEditorOptions;
E
Erich Gamma 已提交
55

56 57
	constructor(options: editorOptions.IEditorOptions) {
		this._editor = <editorOptions.IEditorOptions>objects.clone(DefaultConfig.editor);
E
Erich Gamma 已提交
58 59 60 61

		this._mergeOptionsIn(options);
	}

62
	public getEditorOptions(): editorOptions.IEditorOptions {
E
Erich Gamma 已提交
63 64 65
		return this._editor;
	}

66
	private _mergeOptionsIn(newOptions: editorOptions.IEditorOptions): void {
A
Alex Dima 已提交
67
		this._editor = objects.mixin(this._editor, newOptions || {});
E
Erich Gamma 已提交
68 69
	}

70
	public updateOptions(newOptions: editorOptions.IEditorOptions): void {
E
Erich Gamma 已提交
71 72 73 74 75
		// Apply new options
		this._mergeOptionsIn(newOptions);
	}
}

J
Johannes Rieken 已提交
76
function toBoolean(value: any): boolean {
E
Erich Gamma 已提交
77 78 79
	return value === 'false' ? false : Boolean(value);
}

80 81
export interface IElementSizeObserver {
	startObserving(): void;
J
Johannes Rieken 已提交
82
	observe(dimension?: editorCommon.IDimension): void;
83 84 85 86 87
	dispose(): void;
	getWidth(): number;
	getHeight(): number;
}

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

90
	public editor: editorOptions.InternalEditorOptions;
E
Erich Gamma 已提交
91

J
Johannes Rieken 已提交
92
	protected _configWithDefaults: ConfigurationWithDefaults;
93
	protected _elementSizeObserver: IElementSizeObserver;
J
Johannes Rieken 已提交
94
	private _isDominatedByLongLines: boolean;
95
	private _lineNumbersDigitCount: number;
E
Erich Gamma 已提交
96

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

100
	constructor(options: editorOptions.IEditorOptions, elementSizeObserver: IElementSizeObserver = null) {
A
Alex Dima 已提交
101
		super();
E
Erich Gamma 已提交
102
		this._configWithDefaults = new ConfigurationWithDefaults(options);
103
		this._elementSizeObserver = elementSizeObserver;
E
Erich Gamma 已提交
104
		this._isDominatedByLongLines = false;
105
		this._lineNumbersDigitCount = 1;
E
Erich Gamma 已提交
106
		this.editor = this._computeInternalOptions();
107
		this._register(EditorZoom.onDidChangeZoomLevel(_ => this._recomputeOptions()));
108
		this._register(TabFocus.onDidChangeTabFocus(_ => this._recomputeOptions()));
E
Erich Gamma 已提交
109 110 111 112 113 114 115
	}

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

	protected _recomputeOptions(): void {
116 117
		this._setOptions(this._computeInternalOptions());
	}
118

119
	private _setOptions(newOptions: editorOptions.InternalEditorOptions): void {
120 121
		if (this.editor && this.editor.equals(newOptions)) {
			return;
E
Erich Gamma 已提交
122 123
		}

124 125 126
		let changeEvent = this.editor.createChangeEvent(newOptions);
		this.editor = newOptions;
		this._onDidChange.fire(changeEvent);
E
Erich Gamma 已提交
127 128
	}

129
	public getRawOptions(): editorOptions.IEditorOptions {
E
Erich Gamma 已提交
130 131 132
		return this._configWithDefaults.getEditorOptions();
	}

133
	private _computeInternalOptions(): editorOptions.InternalEditorOptions {
E
Erich Gamma 已提交
134 135
		let opts = this._configWithDefaults.getEditorOptions();

R
rebornix 已提交
136
		let editorClassName = this._getEditorClassName(opts.theme, toBoolean(opts.fontLigatures), opts.mouseStyle);
E
Erich Gamma 已提交
137

138
		let bareFontInfo = BareFontInfo.createFromRawSettings(opts, this.getZoomLevel());
139

140 141 142 143 144 145 146 147 148 149 150 151 152
		const env = new editorOptions.EnvironmentalOptions({
			outerWidth: this.getOuterWidth(),
			outerHeight: this.getOuterHeight(),
			fontInfo: this.readConfiguration(bareFontInfo),
			editorClassName: editorClassName,
			isDominatedByLongLines: this._isDominatedByLongLines,
			lineNumbersDigitCount: this._lineNumbersDigitCount,
			canUseTranslate3d: this._getCanUseTranslate3d(),
			pixelRatio: this._getPixelRatio(),
			tabFocusMode: TabFocus.getTabFocusMode()
		});

		return editorOptions.InternalEditorOptionsFactory.createInternalEditorOptions(env, opts);
E
Erich Gamma 已提交
153 154
	}

155
	public updateOptions(newOptions: editorOptions.IEditorOptions): void {
E
Erich Gamma 已提交
156 157 158 159
		this._configWithDefaults.updateOptions(newOptions);
		this._recomputeOptions();
	}

J
Johannes Rieken 已提交
160
	public setIsDominatedByLongLines(isDominatedByLongLines: boolean): void {
E
Erich Gamma 已提交
161 162 163 164
		this._isDominatedByLongLines = isDominatedByLongLines;
		this._recomputeOptions();
	}

J
Johannes Rieken 已提交
165
	public setMaxLineNumber(maxLineNumber: number): void {
166
		let digitCount = CommonEditorConfiguration._digitCount(maxLineNumber);
167
		if (this._lineNumbersDigitCount === digitCount) {
A
Alex Dima 已提交
168 169
			return;
		}
170
		this._lineNumbersDigitCount = digitCount;
E
Erich Gamma 已提交
171 172 173
		this._recomputeOptions();
	}

174
	private static _digitCount(n: number): number {
175 176 177 178 179 180 181 182
		var r = 0;
		while (n) {
			n = Math.floor(n / 10);
			r++;
		}
		return r ? r : 1;
	}

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

185
	protected abstract getOuterWidth(): number;
E
Erich Gamma 已提交
186

187
	protected abstract getOuterHeight(): number;
E
Erich Gamma 已提交
188

189 190
	protected abstract _getCanUseTranslate3d(): boolean;

191 192
	protected abstract _getPixelRatio(): number;

193
	protected abstract readConfiguration(styling: BareFontInfo): FontInfo;
194 195

	protected abstract getZoomLevel(): number;
E
Erich Gamma 已提交
196 197
}

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

if (platform.isLinux) {
	editorConfiguration['properties']['editor.selectionClipboard'] = {
		'type': 'boolean',
		'default': DefaultConfig.editor.selectionClipboard,
		'description': nls.localize('selectionClipboard', "Controls if the Linux primary clipboard should be supported.")
	};
}

579
configurationRegistry.registerConfiguration(editorConfiguration);