commonEditorConfig.ts 37.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 8
import * as nls from 'vs/nls';
import Event, {Emitter} from 'vs/base/common/event';
A
Alex Dima 已提交
9 10 11 12
import {Disposable} from 'vs/base/common/lifecycle';
import * as objects from 'vs/base/common/objects';
import * as strings from 'vs/base/common/strings';
import {Extensions, IConfigurationRegistry} from 'vs/platform/configuration/common/configurationRegistry';
E
Erich Gamma 已提交
13 14 15
import {Registry} from 'vs/platform/platform';
import {DefaultConfig} from 'vs/editor/common/config/defaultConfig';
import {HandlerDispatcher} from 'vs/editor/common/controller/handlerDispatcher';
A
Alex Dima 已提交
16
import * as editorCommon from 'vs/editor/common/editorCommon';
E
Erich Gamma 已提交
17 18
import {EditorLayoutProvider} from 'vs/editor/common/viewLayout/editorLayoutProvider';

19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
/**
 * Experimental screen reader support toggle
 */
export class GlobalScreenReaderNVDA {

	private static _value = false;
	private static _onChange = new Emitter<boolean>();
	public static onChange: Event<boolean> = GlobalScreenReaderNVDA._onChange.event;

	public static getValue(): boolean {
		return this._value;
	}

	public static setValue(value:boolean): void {
		if (this._value === value) {
			return;
		}
		this._value = value;
		this._onChange.fire(this._value);
	}
}

E
Erich Gamma 已提交
41 42
export class ConfigurationWithDefaults {

A
Alex Dima 已提交
43
	private _editor:editorCommon.IEditorOptions;
E
Erich Gamma 已提交
44

A
Alex Dima 已提交
45 46
	constructor(options:editorCommon.IEditorOptions) {
		this._editor = <editorCommon.IEditorOptions>objects.clone(DefaultConfig.editor);
E
Erich Gamma 已提交
47 48 49 50

		this._mergeOptionsIn(options);
	}

A
Alex Dima 已提交
51
	public getEditorOptions(): editorCommon.IEditorOptions {
E
Erich Gamma 已提交
52 53 54
		return this._editor;
	}

A
Alex Dima 已提交
55 56
	private _mergeOptionsIn(newOptions:editorCommon.IEditorOptions): void {
		this._editor = objects.mixin(this._editor, newOptions || {});
E
Erich Gamma 已提交
57 58
	}

A
Alex Dima 已提交
59
	public updateOptions(newOptions:editorCommon.IEditorOptions): void {
E
Erich Gamma 已提交
60 61 62 63 64
		// Apply new options
		this._mergeOptionsIn(newOptions);
	}
}

A
Alex Dima 已提交
65
function cloneInternalEditorOptions(opts: editorCommon.IInternalEditorOptions): editorCommon.IInternalEditorOptions {
A
Alex Dima 已提交
66 67 68
	return {
		experimentalScreenReader: opts.experimentalScreenReader,
		rulers: opts.rulers.slice(0),
A
Alex Dima 已提交
69
		wordSeparators: opts.wordSeparators,
A
Alex Dima 已提交
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
		ariaLabel: opts.ariaLabel,
		lineNumbers: opts.lineNumbers,
		selectOnLineNumbers: opts.selectOnLineNumbers,
		glyphMargin: opts.glyphMargin,
		revealHorizontalRightPadding: opts.revealHorizontalRightPadding,
		roundedSelection: opts.roundedSelection,
		theme: opts.theme,
		readOnly: opts.readOnly,
		scrollbar: {
			arrowSize: opts.scrollbar.arrowSize,
			vertical: opts.scrollbar.vertical,
			horizontal: opts.scrollbar.horizontal,
			useShadows: opts.scrollbar.useShadows,
			verticalHasArrows: opts.scrollbar.verticalHasArrows,
			horizontalHasArrows: opts.scrollbar.horizontalHasArrows,
			handleMouseWheel: opts.scrollbar.handleMouseWheel,
			horizontalScrollbarSize: opts.scrollbar.horizontalScrollbarSize,
			horizontalSliderSize: opts.scrollbar.horizontalSliderSize,
			verticalScrollbarSize: opts.scrollbar.verticalScrollbarSize,
			verticalSliderSize: opts.scrollbar.verticalSliderSize,
			mouseWheelScrollSensitivity: opts.scrollbar.mouseWheelScrollSensitivity,
		},
		overviewRulerLanes: opts.overviewRulerLanes,
		cursorBlinking: opts.cursorBlinking,
		cursorStyle: opts.cursorStyle,
		fontLigatures: opts.fontLigatures,
		hideCursorInOverviewRuler: opts.hideCursorInOverviewRuler,
		scrollBeyondLastLine: opts.scrollBeyondLastLine,
		wrappingIndent: opts.wrappingIndent,
		wordWrapBreakBeforeCharacters: opts.wordWrapBreakBeforeCharacters,
		wordWrapBreakAfterCharacters: opts.wordWrapBreakAfterCharacters,
		wordWrapBreakObtrusiveCharacters: opts.wordWrapBreakObtrusiveCharacters,
		tabFocusMode: opts.tabFocusMode,
		stopLineTokenizationAfter: opts.stopLineTokenizationAfter,
		stopRenderingLineAfter: opts.stopRenderingLineAfter,
		longLineBoundary: opts.longLineBoundary,
		forcedTokenizationBoundary: opts.forcedTokenizationBoundary,
		hover: opts.hover,
		contextmenu: opts.contextmenu,
		quickSuggestions: opts.quickSuggestions,
		quickSuggestionsDelay: opts.quickSuggestionsDelay,
		iconsInSuggestions: opts.iconsInSuggestions,
		autoClosingBrackets: opts.autoClosingBrackets,
		formatOnType: opts.formatOnType,
		suggestOnTriggerCharacters: opts.suggestOnTriggerCharacters,
		selectionHighlight: opts.selectionHighlight,
		outlineMarkers: opts.outlineMarkers,
		referenceInfos: opts.referenceInfos,
118
		folding: opts.folding,
A
Alex Dima 已提交
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 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
		renderWhitespace: opts.renderWhitespace,
		layoutInfo: {
			width: opts.layoutInfo.width,
			height: opts.layoutInfo.height,
			glyphMarginLeft: opts.layoutInfo.glyphMarginLeft,
			glyphMarginWidth: opts.layoutInfo.glyphMarginWidth,
			glyphMarginHeight: opts.layoutInfo.glyphMarginHeight,
			lineNumbersLeft: opts.layoutInfo.lineNumbersLeft,
			lineNumbersWidth: opts.layoutInfo.lineNumbersWidth,
			lineNumbersHeight: opts.layoutInfo.lineNumbersHeight,
			decorationsLeft: opts.layoutInfo.decorationsLeft,
			decorationsWidth: opts.layoutInfo.decorationsWidth,
			decorationsHeight: opts.layoutInfo.decorationsHeight,
			contentLeft: opts.layoutInfo.contentLeft,
			contentWidth: opts.layoutInfo.contentWidth,
			contentHeight: opts.layoutInfo.contentHeight,
			verticalScrollbarWidth: opts.layoutInfo.verticalScrollbarWidth,
			horizontalScrollbarHeight: opts.layoutInfo.horizontalScrollbarHeight,
			overviewRuler:{
				width: opts.layoutInfo.overviewRuler.width,
				height: opts.layoutInfo.overviewRuler.height,
				top: opts.layoutInfo.overviewRuler.top,
				right: opts.layoutInfo.overviewRuler.right,
			}
		},
		stylingInfo: {
			editorClassName: opts.stylingInfo.editorClassName,
			fontFamily: opts.stylingInfo.fontFamily,
			fontSize: opts.stylingInfo.fontSize,
			lineHeight: opts.stylingInfo.lineHeight,
		},
		wrappingInfo: {
			isViewportWrapping: opts.wrappingInfo.isViewportWrapping,
			wrappingColumn: opts.wrappingInfo.wrappingColumn,
		},
		indentInfo: {
			tabSize: opts.indentInfo.tabSize,
			insertSpaces: opts.indentInfo.insertSpaces,
		},
		observedOuterWidth: opts.observedOuterWidth,
		observedOuterHeight: opts.observedOuterHeight,
		lineHeight: opts.lineHeight,
		pageSize: opts.pageSize,
		typicalHalfwidthCharacterWidth: opts.typicalHalfwidthCharacterWidth,
		typicalFullwidthCharacterWidth: opts.typicalFullwidthCharacterWidth,
		fontSize: opts.fontSize,
	};
}

E
Erich Gamma 已提交
168 169 170 171 172 173 174 175
class InternalEditorOptionsHelper {

	constructor() {
	}

	public static createInternalEditorOptions(
		outerWidth:number,
		outerHeight:number,
A
Alex Dima 已提交
176
		opts:editorCommon.IEditorOptions,
E
Erich Gamma 已提交
177 178 179 180 181 182 183 184
		editorClassName:string,
		requestedFontFamily:string,
		requestedFontSize:number,
		requestedLineHeight:number,
		adjustedLineHeight:number,
		themeOpts: ICSSConfig,
		isDominatedByLongLines:boolean,
		lineCount: number,
A
Alex Dima 已提交
185 186
		indentationOptions: editorCommon.IInternalIndentationOptions
	): editorCommon.IInternalEditorOptions {
E
Erich Gamma 已提交
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214

		let wrappingColumn = toInteger(opts.wrappingColumn, -1);

		let stopLineTokenizationAfter:number;
		if (typeof opts.stopLineTokenizationAfter !== 'undefined') {
			stopLineTokenizationAfter = toInteger(opts.stopLineTokenizationAfter, -1);
		} else if (wrappingColumn >= 0) {
			stopLineTokenizationAfter = -1;
		} else {
			stopLineTokenizationAfter = 10000;
		}

		let stopRenderingLineAfter:number;
		if (typeof opts.stopRenderingLineAfter !== 'undefined') {
			stopRenderingLineAfter = toInteger(opts.stopRenderingLineAfter, -1);
		} else if (wrappingColumn >= 0) {
			stopRenderingLineAfter = -1;
		} else {
			stopRenderingLineAfter = 10000;
		}

		let mouseWheelScrollSensitivity = toFloat(opts.mouseWheelScrollSensitivity, 1);
		let scrollbar = this._sanitizeScrollbarOpts(opts.scrollbar, mouseWheelScrollSensitivity);

		let glyphMargin = toBoolean(opts.glyphMargin);
		let lineNumbers = opts.lineNumbers;
		let lineNumbersMinChars = toInteger(opts.lineNumbersMinChars, 1);
		let lineDecorationsWidth = toInteger(opts.lineDecorationsWidth, 0);
M
Martin Aeschlimann 已提交
215
		if (opts.folding) {
216
			lineDecorationsWidth += 16;
M
Martin Aeschlimann 已提交
217
		}
E
Erich Gamma 已提交
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
		let layoutInfo = EditorLayoutProvider.compute({
			outerWidth: outerWidth,
			outerHeight: outerHeight,
			showGlyphMargin: glyphMargin,
			lineHeight: themeOpts.lineHeight,
			showLineNumbers: !!lineNumbers,
			lineNumbersMinChars: lineNumbersMinChars,
			lineDecorationsWidth: lineDecorationsWidth,
			maxDigitWidth: themeOpts.maxDigitWidth,
			lineCount: lineCount,
			verticalScrollbarWidth: scrollbar.verticalScrollbarSize,
			horizontalScrollbarHeight: scrollbar.horizontalScrollbarSize,
			scrollbarArrowSize: scrollbar.arrowSize,
			verticalScrollbarHasArrows: scrollbar.verticalHasArrows
		});

		let pageSize = Math.floor(layoutInfo.height / themeOpts.lineHeight) - 2;

		if (isDominatedByLongLines && wrappingColumn > 0) {
			// Force viewport width wrapping if model is dominated by long lines
			wrappingColumn = 0;
		}

A
Alex Dima 已提交
241
		let wrappingInfo: editorCommon.IEditorWrappingInfo;
E
Erich Gamma 已提交
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261

		if (wrappingColumn === 0) {
			// If viewport width wrapping is enabled
			wrappingInfo = {
				isViewportWrapping: true,
				wrappingColumn: Math.max(1, Math.floor((layoutInfo.contentWidth - layoutInfo.verticalScrollbarWidth) / themeOpts.typicalHalfwidthCharacterWidth))
			};
		} else if (wrappingColumn > 0) {
			// Wrapping is enabled
			wrappingInfo = {
				isViewportWrapping: false,
				wrappingColumn: wrappingColumn
			};
		} else {
			wrappingInfo = {
				isViewportWrapping: false,
				wrappingColumn: -1
			};
		}

262 263 264 265 266 267 268
		let readOnly = toBoolean(opts.readOnly);

		let tabFocusMode = toBoolean(opts.tabFocusMode);
		if (readOnly) {
			tabFocusMode = true;
		}

E
Erich Gamma 已提交
269 270 271 272 273 274 275 276
		return {
			// ---- Options that are transparent - get no massaging
			lineNumbers: lineNumbers,
			selectOnLineNumbers: toBoolean(opts.selectOnLineNumbers),
			glyphMargin: glyphMargin,
			revealHorizontalRightPadding: toInteger(opts.revealHorizontalRightPadding, 0),
			roundedSelection: toBoolean(opts.roundedSelection),
			theme: opts.theme,
277
			readOnly: readOnly,
E
Erich Gamma 已提交
278 279
			scrollbar: scrollbar,
			overviewRulerLanes: toInteger(opts.overviewRulerLanes, 0, 3),
280
			cursorBlinking: opts.cursorBlinking,
281
			experimentalScreenReader: toBoolean(opts.experimentalScreenReader),
282
			rulers: toSortedIntegerArray(opts.rulers),
A
Alex Dima 已提交
283
			wordSeparators: String(opts.wordSeparators),
284
			ariaLabel: String(opts.ariaLabel),
M
markrendle 已提交
285
			cursorStyle: opts.cursorStyle,
286
			fontLigatures: toBoolean(opts.fontLigatures),
E
Erich Gamma 已提交
287 288 289 290 291 292
			hideCursorInOverviewRuler: toBoolean(opts.hideCursorInOverviewRuler),
			scrollBeyondLastLine: toBoolean(opts.scrollBeyondLastLine),
			wrappingIndent: opts.wrappingIndent,
			wordWrapBreakBeforeCharacters: opts.wordWrapBreakBeforeCharacters,
			wordWrapBreakAfterCharacters: opts.wordWrapBreakAfterCharacters,
			wordWrapBreakObtrusiveCharacters: opts.wordWrapBreakObtrusiveCharacters,
293
			tabFocusMode: tabFocusMode,
E
Erich Gamma 已提交
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
			stopLineTokenizationAfter: stopLineTokenizationAfter,
			stopRenderingLineAfter: stopRenderingLineAfter,
			longLineBoundary: toInteger(opts.longLineBoundary),
			forcedTokenizationBoundary: toInteger(opts.forcedTokenizationBoundary),

			hover: toBoolean(opts.hover),
			contextmenu: toBoolean(opts.contextmenu),
			quickSuggestions: toBoolean(opts.quickSuggestions),
			quickSuggestionsDelay: toInteger(opts.quickSuggestionsDelay),
			iconsInSuggestions: toBoolean(opts.iconsInSuggestions),
			autoClosingBrackets: toBoolean(opts.autoClosingBrackets),
			formatOnType: toBoolean(opts.formatOnType),
			suggestOnTriggerCharacters: toBoolean(opts.suggestOnTriggerCharacters),
			selectionHighlight: toBoolean(opts.selectionHighlight),
			outlineMarkers: toBoolean(opts.outlineMarkers),
			referenceInfos: toBoolean(opts.referenceInfos),
M
Martin Aeschlimann 已提交
310
			folding: toBoolean(opts.folding),
E
Erich Gamma 已提交
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
			renderWhitespace: toBoolean(opts.renderWhitespace),

			layoutInfo: layoutInfo,
			stylingInfo: {
				editorClassName: editorClassName,
				fontFamily: requestedFontFamily,
				fontSize: requestedFontSize,
				lineHeight: adjustedLineHeight
			},
			wrappingInfo: wrappingInfo,
			indentInfo: indentationOptions,

			observedOuterWidth: outerWidth,
			observedOuterHeight: outerHeight,

			lineHeight: themeOpts.lineHeight,

			pageSize: pageSize,

			typicalHalfwidthCharacterWidth: themeOpts.typicalHalfwidthCharacterWidth,
			typicalFullwidthCharacterWidth: themeOpts.typicalFullwidthCharacterWidth,

			fontSize: themeOpts.fontSize,
		};
	}

A
Alex Dima 已提交
337
	private static _sanitizeScrollbarOpts(raw:editorCommon.IEditorScrollbarOptions, mouseWheelScrollSensitivity:number): editorCommon.IInternalEditorScrollbarOptions {
A
Alex Dima 已提交
338 339
		let horizontalScrollbarSize = toIntegerWithDefault(raw.horizontalScrollbarSize, 10);
		let verticalScrollbarSize = toIntegerWithDefault(raw.verticalScrollbarSize, 14);
E
Erich Gamma 已提交
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
		return {
			vertical: toStringSet(raw.vertical, ['auto', 'visible', 'hidden'], 'auto'),
			horizontal: toStringSet(raw.horizontal, ['auto', 'visible', 'hidden'], 'auto'),

			arrowSize: toIntegerWithDefault(raw.arrowSize, 11),
			useShadows: toBooleanWithDefault(raw.useShadows, true),

			verticalHasArrows: toBooleanWithDefault(raw.verticalHasArrows, false),
			horizontalHasArrows: toBooleanWithDefault(raw.horizontalHasArrows, false),

			horizontalScrollbarSize: horizontalScrollbarSize,
			horizontalSliderSize: toIntegerWithDefault(raw.horizontalSliderSize, horizontalScrollbarSize),

			verticalScrollbarSize: verticalScrollbarSize,
			verticalSliderSize: toIntegerWithDefault(raw.verticalSliderSize, verticalScrollbarSize),

			handleMouseWheel: toBooleanWithDefault(raw.handleMouseWheel, true),
			mouseWheelScrollSensitivity: mouseWheelScrollSensitivity
		};
	}

A
Alex Dima 已提交
361
	public static createConfigurationChangedEvent(prevOpts:editorCommon.IInternalEditorOptions, newOpts:editorCommon.IInternalEditorOptions): editorCommon.IConfigurationChangedEvent {
E
Erich Gamma 已提交
362
		return {
363
			experimentalScreenReader:		(prevOpts.experimentalScreenReader !== newOpts.experimentalScreenReader),
364
			rulers:							(!this._numberArraysEqual(prevOpts.rulers, newOpts.rulers)),
A
Alex Dima 已提交
365
			wordSeparators:					(prevOpts.wordSeparators !== newOpts.wordSeparators),
366
			ariaLabel:						(prevOpts.ariaLabel !== newOpts.ariaLabel),
367

368 369 370
			lineNumbers:					(prevOpts.lineNumbers !== newOpts.lineNumbers),
			selectOnLineNumbers:			(prevOpts.selectOnLineNumbers !== newOpts.selectOnLineNumbers),
			glyphMargin:					(prevOpts.glyphMargin !== newOpts.glyphMargin),
E
Erich Gamma 已提交
371 372 373 374 375 376
			revealHorizontalRightPadding:	(prevOpts.revealHorizontalRightPadding !== newOpts.revealHorizontalRightPadding),
			roundedSelection:				(prevOpts.roundedSelection !== newOpts.roundedSelection),
			theme:							(prevOpts.theme !== newOpts.theme),
			readOnly:						(prevOpts.readOnly !== newOpts.readOnly),
			scrollbar:						(!this._scrollbarOptsEqual(prevOpts.scrollbar, newOpts.scrollbar)),
			overviewRulerLanes:				(prevOpts.overviewRulerLanes !== newOpts.overviewRulerLanes),
377
			cursorBlinking:					(prevOpts.cursorBlinking !== newOpts.cursorBlinking),
378
			cursorStyle:					(prevOpts.cursorStyle !== newOpts.cursorStyle),
379
			fontLigatures:					(prevOpts.fontLigatures !== newOpts.fontLigatures),
E
Erich Gamma 已提交
380 381 382 383 384 385 386 387 388 389 390
			hideCursorInOverviewRuler:		(prevOpts.hideCursorInOverviewRuler !== newOpts.hideCursorInOverviewRuler),
			scrollBeyondLastLine:			(prevOpts.scrollBeyondLastLine !== newOpts.scrollBeyondLastLine),
			wrappingIndent:					(prevOpts.wrappingIndent !== newOpts.wrappingIndent),
			wordWrapBreakBeforeCharacters:	(prevOpts.wordWrapBreakBeforeCharacters !== newOpts.wordWrapBreakBeforeCharacters),
			wordWrapBreakAfterCharacters:	(prevOpts.wordWrapBreakAfterCharacters !== newOpts.wordWrapBreakAfterCharacters),
			wordWrapBreakObtrusiveCharacters:(prevOpts.wordWrapBreakObtrusiveCharacters !== newOpts.wordWrapBreakObtrusiveCharacters),
			tabFocusMode:					(prevOpts.tabFocusMode !== newOpts.tabFocusMode),
			stopLineTokenizationAfter:		(prevOpts.stopLineTokenizationAfter !== newOpts.stopLineTokenizationAfter),
			stopRenderingLineAfter:			(prevOpts.stopRenderingLineAfter !== newOpts.stopRenderingLineAfter),
			longLineBoundary:				(prevOpts.longLineBoundary !== newOpts.longLineBoundary),
			forcedTokenizationBoundary:		(prevOpts.forcedTokenizationBoundary !== newOpts.forcedTokenizationBoundary),
391

E
Erich Gamma 已提交
392
			hover:							(prevOpts.hover !== newOpts.hover),
393
			contextmenu:					(prevOpts.contextmenu !== newOpts.contextmenu),
E
Erich Gamma 已提交
394 395 396
			quickSuggestions:				(prevOpts.quickSuggestions !== newOpts.quickSuggestions),
			quickSuggestionsDelay:			(prevOpts.quickSuggestionsDelay !== newOpts.quickSuggestionsDelay),
			iconsInSuggestions:				(prevOpts.iconsInSuggestions !== newOpts.iconsInSuggestions),
397
			autoClosingBrackets:			(prevOpts.autoClosingBrackets !== newOpts.autoClosingBrackets),
E
Erich Gamma 已提交
398 399 400 401
			formatOnType:					(prevOpts.formatOnType !== newOpts.formatOnType),
			suggestOnTriggerCharacters:		(prevOpts.suggestOnTriggerCharacters !== newOpts.suggestOnTriggerCharacters),
			selectionHighlight:				(prevOpts.selectionHighlight !== newOpts.selectionHighlight),
			outlineMarkers:					(prevOpts.outlineMarkers !== newOpts.outlineMarkers),
402
			referenceInfos:					(prevOpts.referenceInfos !== newOpts.referenceInfos),
M
Martin Aeschlimann 已提交
403
			folding:						(prevOpts.folding !== newOpts.folding),
404 405
			renderWhitespace:				(prevOpts.renderWhitespace !== newOpts.renderWhitespace),

406
			layoutInfo: 					(!EditorLayoutProvider.layoutEqual(prevOpts.layoutInfo, newOpts.layoutInfo)),
407 408 409 410
			stylingInfo: 					(!this._stylingInfoEqual(prevOpts.stylingInfo, newOpts.stylingInfo)),
			wrappingInfo:					(!this._wrappingInfoEqual(prevOpts.wrappingInfo, newOpts.wrappingInfo)),
			indentInfo:						(!this._indentInfoEqual(prevOpts.indentInfo, newOpts.indentInfo)),
			observedOuterWidth:				(prevOpts.observedOuterWidth !== newOpts.observedOuterWidth),
411
			observedOuterHeight:			(prevOpts.observedOuterHeight !== newOpts.observedOuterHeight),
412 413 414 415 416
			lineHeight:						(prevOpts.lineHeight !== newOpts.lineHeight),
			pageSize:						(prevOpts.pageSize !== newOpts.pageSize),
			typicalHalfwidthCharacterWidth:	(prevOpts.typicalHalfwidthCharacterWidth !== newOpts.typicalHalfwidthCharacterWidth),
			typicalFullwidthCharacterWidth:	(prevOpts.typicalFullwidthCharacterWidth !== newOpts.typicalFullwidthCharacterWidth),
			fontSize:						(prevOpts.fontSize !== newOpts.fontSize)
E
Erich Gamma 已提交
417 418 419
		};
	}

A
Alex Dima 已提交
420
	private static _scrollbarOptsEqual(a:editorCommon.IInternalEditorScrollbarOptions, b:editorCommon.IInternalEditorScrollbarOptions): boolean {
E
Erich Gamma 已提交
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436
		return (
			a.arrowSize === b.arrowSize
			&& a.vertical === b.vertical
			&& a.horizontal === b.horizontal
			&& a.useShadows === b.useShadows
			&& a.verticalHasArrows === b.verticalHasArrows
			&& a.horizontalHasArrows === b.horizontalHasArrows
			&& a.handleMouseWheel === b.handleMouseWheel
			&& a.horizontalScrollbarSize === b.horizontalScrollbarSize
			&& a.horizontalSliderSize === b.horizontalSliderSize
			&& a.verticalScrollbarSize === b.verticalScrollbarSize
			&& a.verticalSliderSize === b.verticalSliderSize
			&& a.mouseWheelScrollSensitivity === b.mouseWheelScrollSensitivity
		);
	}

A
Alex Dima 已提交
437
	private static _stylingInfoEqual(a:editorCommon.IEditorStyling, b:editorCommon.IEditorStyling): boolean {
E
Erich Gamma 已提交
438 439 440 441 442 443 444 445
		return (
			a.editorClassName === b.editorClassName
			&& a.fontFamily === b.fontFamily
			&& a.fontSize === b.fontSize
			&& a.lineHeight === b.lineHeight
		);
	}

A
Alex Dima 已提交
446
	private static _wrappingInfoEqual(a:editorCommon.IEditorWrappingInfo, b:editorCommon.IEditorWrappingInfo): boolean {
E
Erich Gamma 已提交
447 448 449 450 451 452
		return (
			a.isViewportWrapping === b.isViewportWrapping
			&& a.wrappingColumn === b.wrappingColumn
		);
	}

A
Alex Dima 已提交
453
	private static _indentInfoEqual(a:editorCommon.IInternalIndentationOptions, b:editorCommon.IInternalIndentationOptions): boolean {
E
Erich Gamma 已提交
454 455 456 457 458
		return (
			a.insertSpaces === b.insertSpaces
			&& a.tabSize === b.tabSize
		);
	}
459 460 461 462 463 464 465 466 467 468 469 470

	private static _numberArraysEqual(a:number[], b:number[]): 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;
	}
E
Erich Gamma 已提交
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493
}

export interface ICSSConfig {
	typicalHalfwidthCharacterWidth:number;
	typicalFullwidthCharacterWidth:number;
	maxDigitWidth: number;
	lineHeight:number;
	font:string;
	fontSize:number;
}

function toBoolean(value:any): boolean {
	return value === 'false' ? false : Boolean(value);
}

function toBooleanWithDefault(value:any, defaultValue:boolean): boolean {
	if (typeof value === 'undefined') {
		return defaultValue;
	}
	return toBoolean(value);
}

function toFloat(source: any, defaultValue: number): number {
A
Alex Dima 已提交
494
	let r = parseFloat(source);
E
Erich Gamma 已提交
495 496 497 498 499 500 501
	if (isNaN(r)) {
		r = defaultValue;
	}
	return r;
}

function toInteger(source:any, minimum?:number, maximum?:number): number {
A
Alex Dima 已提交
502
	let r = parseInt(source, 10);
E
Erich Gamma 已提交
503 504 505 506 507 508 509 510 511 512 513 514
	if (isNaN(r)) {
		r = 0;
	}
	if (typeof minimum === 'number') {
		r = Math.max(minimum, r);
	}
	if (typeof maximum === 'number') {
		r = Math.min(maximum, r);
	}
	return r;
}

515 516 517 518 519 520 521 522 523 524
function toSortedIntegerArray(source:any): number[] {
	if (!Array.isArray(source)) {
		return [];
	}
	let arrSource = <any[]>source;
	let r = arrSource.map(el => toInteger(el));
	r.sort();
	return r;
}

E
Erich Gamma 已提交
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549
function toIntegerWithDefault(source:any, defaultValue:number): number {
	if (typeof source === 'undefined') {
		return defaultValue;
	}
	return toInteger(source);
}

function toStringSet(source:any, allowedValues:string[], defaultValue:string): string {
	if (typeof source !== 'string') {
		return defaultValue;
	}
	if (allowedValues.indexOf(source) === -1) {
		return defaultValue;
	}
	return source;
}

interface IValidatedIndentationOptions {
	tabSizeIsAuto: boolean;
	tabSize: number;
	insertSpacesIsAuto: boolean;
	insertSpaces: boolean;
}

export interface IIndentationGuesser {
A
Alex Dima 已提交
550
	(tabSize:number): editorCommon.IGuessedIndentation;
E
Erich Gamma 已提交
551 552
}

553 554 555 556 557 558 559 560
export interface IElementSizeObserver {
	startObserving(): void;
	observe(dimension?:editorCommon.IDimension): void;
	dispose(): void;
	getWidth(): number;
	getHeight(): number;
}

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

A
Alex Dima 已提交
563 564 565
	public handlerDispatcher:editorCommon.IHandlerDispatcher;
	public editor:editorCommon.IInternalEditorOptions;
	public editorClone:editorCommon.IInternalEditorOptions;
E
Erich Gamma 已提交
566 567

	protected _configWithDefaults:ConfigurationWithDefaults;
568
	protected _elementSizeObserver: IElementSizeObserver;
E
Erich Gamma 已提交
569 570
	private _indentationGuesser:IIndentationGuesser;
	private _cachedGuessedIndentationTabSize: number;
A
Alex Dima 已提交
571
	private _cachedGuessedIndentation:editorCommon.IGuessedIndentation;
E
Erich Gamma 已提交
572 573 574
	private _isDominatedByLongLines:boolean;
	private _lineCount:number;

A
Alex Dima 已提交
575 576
	private _onDidChange = this._register(new Emitter<editorCommon.IConfigurationChangedEvent>());
	public onDidChange: Event<editorCommon.IConfigurationChangedEvent> = this._onDidChange.event;
A
Alex Dima 已提交
577

578
	constructor(options:any, elementSizeObserver: IElementSizeObserver = null, indentationGuesser:IIndentationGuesser = null) {
A
Alex Dima 已提交
579
		super();
E
Erich Gamma 已提交
580
		this._configWithDefaults = new ConfigurationWithDefaults(options);
581
		this._elementSizeObserver = elementSizeObserver;
E
Erich Gamma 已提交
582 583 584 585 586 587 588 589 590
		this._indentationGuesser = indentationGuesser;
		this._cachedGuessedIndentationTabSize = -1;
		this._cachedGuessedIndentation = null;
		this._isDominatedByLongLines = false;
		this._lineCount = 1;

		this.handlerDispatcher = new HandlerDispatcher();

		this.editor = this._computeInternalOptions();
A
Alex Dima 已提交
591
		this.editorClone = cloneInternalEditorOptions(this.editor);
E
Erich Gamma 已提交
592 593 594 595 596 597 598 599 600
	}

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

	protected _recomputeOptions(): void {
		let oldOpts = this.editor;
		this.editor = this._computeInternalOptions();
A
Alex Dima 已提交
601
		this.editorClone = cloneInternalEditorOptions(this.editor);
E
Erich Gamma 已提交
602 603 604 605 606 607 608 609 610 611 612 613 614 615

		let changeEvent = InternalEditorOptionsHelper.createConfigurationChangedEvent(oldOpts, this.editor);

		let hasChanged = false;
		for (let key in changeEvent) {
			if (changeEvent.hasOwnProperty(key)) {
				if (changeEvent[key]) {
					hasChanged = true;
					break;
				}
			}
		}

		if (hasChanged) {
A
Alex Dima 已提交
616
			this._onDidChange.fire(changeEvent);
E
Erich Gamma 已提交
617 618 619
		}
	}

A
Alex Dima 已提交
620
	public getRawOptions(): editorCommon.IEditorOptions {
E
Erich Gamma 已提交
621 622 623
		return this._configWithDefaults.getEditorOptions();
	}

A
Alex Dima 已提交
624
	private _computeInternalOptions(): editorCommon.IInternalEditorOptions {
E
Erich Gamma 已提交
625 626
		let opts = this._configWithDefaults.getEditorOptions();

627
		let editorClassName = this._getEditorClassName(opts.theme, toBoolean(opts.fontLigatures));
E
Erich Gamma 已提交
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
		let requestedFontFamily = opts.fontFamily || '';
		let requestedFontSize = toInteger(opts.fontSize, 0, 100);
		let requestedLineHeight = toInteger(opts.lineHeight, 0, 150);

		let adjustedLineHeight = requestedLineHeight;
		if (requestedFontSize > 0 && requestedLineHeight === 0) {
			adjustedLineHeight = Math.round(1.3 * requestedFontSize);
		}

		let indentationOptions = CommonEditorConfiguration._computeIndentationOptions(opts, (tabSize) => this._guessIndentationOptionsCached(tabSize));

		return InternalEditorOptionsHelper.createInternalEditorOptions(
			this.getOuterWidth(),
			this.getOuterHeight(),
			opts,
			editorClassName,
			requestedFontFamily,
			requestedFontSize,
			requestedLineHeight,
			adjustedLineHeight,
			this.readConfiguration(editorClassName, requestedFontFamily, requestedFontSize, adjustedLineHeight),
			this._isDominatedByLongLines,
			this._lineCount,
			indentationOptions
		);
	}

A
Alex Dima 已提交
655
	public updateOptions(newOptions:editorCommon.IEditorOptions): void {
E
Erich Gamma 已提交
656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675
		this._configWithDefaults.updateOptions(newOptions);
		this._recomputeOptions();
	}

	public setIsDominatedByLongLines(isDominatedByLongLines:boolean): void {
		this._isDominatedByLongLines = isDominatedByLongLines;
		this._recomputeOptions();
	}

	public setLineCount(lineCount:number): void {
		this._lineCount = lineCount;
		this._recomputeOptions();
	}

	public resetIndentationOptions(): void {
		this._cachedGuessedIndentationTabSize = -1;
		this._cachedGuessedIndentation = null;
		this._recomputeOptions();
	}

A
Alex Dima 已提交
676
	private _guessIndentationOptionsCached(tabSize:number): editorCommon.IGuessedIndentation {
E
Erich Gamma 已提交
677 678 679 680 681 682 683 684 685 686 687 688
		if (!this._cachedGuessedIndentation || this._cachedGuessedIndentationTabSize !== tabSize) {
			this._cachedGuessedIndentationTabSize = tabSize;

			if (this._indentationGuesser) {
				this._cachedGuessedIndentation = this._indentationGuesser(tabSize);
			} else {
				this._cachedGuessedIndentation = null;
			}
		}
		return this._cachedGuessedIndentation;
	}

A
Alex Dima 已提交
689
	private static _getValidatedIndentationOptions(opts: editorCommon.IEditorOptions): IValidatedIndentationOptions {
E
Erich Gamma 已提交
690 691 692 693
		let r: IValidatedIndentationOptions = {
			tabSizeIsAuto: false,
			tabSize: 4,
			insertSpacesIsAuto: false,
694
			insertSpaces: true
E
Erich Gamma 已提交
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711
		};

		if (opts.tabSize === 'auto') {
			r.tabSizeIsAuto = true;
		} else {
			r.tabSize = toInteger(opts.tabSize, 1, 20);
		}

		if (opts.insertSpaces === 'auto') {
			r.insertSpacesIsAuto = true;
		} else {
			r.insertSpaces = toBoolean(opts.insertSpaces);
		}

		return r;
	}

A
Alex Dima 已提交
712
	private static _computeIndentationOptions(allOpts: editorCommon.IEditorOptions, indentationGuesser:IIndentationGuesser): editorCommon.IInternalIndentationOptions {
E
Erich Gamma 已提交
713 714
		let opts = this._getValidatedIndentationOptions(allOpts);

A
Alex Dima 已提交
715
		let guessedIndentation:editorCommon.IGuessedIndentation = null;
E
Erich Gamma 已提交
716 717 718 719 720
		if (opts.tabSizeIsAuto || opts.insertSpacesIsAuto) {
			// We must use the indentation guesser to come up with the indentation options
			guessedIndentation = indentationGuesser(opts.tabSize);
		}

A
Alex Dima 已提交
721
		let r: editorCommon.IInternalIndentationOptions = {
E
Erich Gamma 已提交
722 723 724 725 726 727 728 729 730 731 732 733 734 735
			insertSpaces: opts.insertSpaces,
			tabSize: opts.tabSize
		};

		if (guessedIndentation && opts.tabSizeIsAuto) {
			r.tabSize = guessedIndentation.tabSize;
		}
		if (guessedIndentation && opts.insertSpacesIsAuto) {
			r.insertSpaces = guessedIndentation.insertSpaces;
		}

		return r;
	}

A
Alex Dima 已提交
736
	public getIndentationOptions(): editorCommon.IInternalIndentationOptions {
E
Erich Gamma 已提交
737 738 739 740
		return this.editor.indentInfo;
	}

	private _normalizeIndentationFromWhitespace(str:string): string {
A
Alex Dima 已提交
741
		let indentation = this.getIndentationOptions(),
E
Erich Gamma 已提交
742 743 744 745 746 747 748 749 750 751 752
			spacesCnt = 0,
			i:number;

		for (i = 0; i < str.length; i++) {
			if (str.charAt(i) === '\t') {
				spacesCnt += indentation.tabSize;
			} else {
				spacesCnt++;
			}
		}

A
Alex Dima 已提交
753
		let result = '';
E
Erich Gamma 已提交
754
		if (!indentation.insertSpaces) {
A
Alex Dima 已提交
755
			let tabsCnt = Math.floor(spacesCnt / indentation.tabSize);
E
Erich Gamma 已提交
756 757 758 759 760 761 762 763 764 765 766 767 768 769
			spacesCnt = spacesCnt % indentation.tabSize;
			for (i = 0; i < tabsCnt; i++) {
				result += '\t';
			}
		}

		for (i = 0; i < spacesCnt; i++) {
			result += ' ';
		}

		return result;
	}

	public normalizeIndentation(str:string): string {
A
Alex Dima 已提交
770
		let firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(str);
E
Erich Gamma 已提交
771 772 773 774 775 776 777
		if (firstNonWhitespaceIndex === -1) {
			firstNonWhitespaceIndex = str.length;
		}
		return this._normalizeIndentationFromWhitespace(str.substring(0, firstNonWhitespaceIndex)) + str.substring(firstNonWhitespaceIndex);
	}

	public getOneIndent(): string {
A
Alex Dima 已提交
778
		let indentation = this.getIndentationOptions();
E
Erich Gamma 已提交
779
		if (indentation.insertSpaces) {
A
Alex Dima 已提交
780 781
			let result = '';
			for (let i = 0; i < indentation.tabSize; i++) {
E
Erich Gamma 已提交
782 783 784 785 786 787 788 789
				result += ' ';
			}
			return result;
		} else {
			return '\t';
		}
	}

790
	protected abstract _getEditorClassName(theme:string, fontLigatures:boolean): string;
E
Erich Gamma 已提交
791

792
	protected abstract getOuterWidth(): number;
E
Erich Gamma 已提交
793

794
	protected abstract getOuterHeight(): number;
E
Erich Gamma 已提交
795

796
	protected abstract readConfiguration(editorClassName: string, fontFamily: string, fontSize: number, lineHeight: number): ICSSConfig;
E
Erich Gamma 已提交
797 798 799 800 801 802 803 804 805 806 807 808
}

/**
 * Helper to update Monaco Editor Settings from configurations service.
 */
export class EditorConfiguration {
	public static EDITOR_SECTION = 'editor';
	public static DIFF_EDITOR_SECTION = 'diffEditor';

	/**
	 * Ask the provided configuration service to apply its configuration to the provided editor.
	 */
A
Alex Dima 已提交
809 810
	public static apply(config:any, editor?:editorCommon.IEditor): void;
	public static apply(config:any, editor?:editorCommon.IEditor[]): void;
E
Erich Gamma 已提交
811 812 813 814 815
	public static apply(config:any, editorOrArray?:any): void {
		if (!config) {
			return;
		}

A
Alex Dima 已提交
816
		let editors:editorCommon.IEditor[] = editorOrArray;
E
Erich Gamma 已提交
817 818 819 820
		if (!Array.isArray(editorOrArray)) {
			editors = [editorOrArray];
		}

A
Alex Dima 已提交
821 822
		for (let i = 0; i < editors.length; i++) {
			let editor = editors[i];
E
Erich Gamma 已提交
823 824 825

			// Editor Settings (Code Editor, Diff, Terminal)
			if (editor && typeof editor.updateOptions === 'function') {
A
Alex Dima 已提交
826
				let type = editor.getEditorType();
A
Alex Dima 已提交
827
				if (type !== editorCommon.EditorType.ICodeEditor && type !== editorCommon.EditorType.IDiffEditor) {
E
Erich Gamma 已提交
828 829 830
					continue;
				}

A
Alex Dima 已提交
831
				let editorConfig = config[EditorConfiguration.EDITOR_SECTION];
A
Alex Dima 已提交
832
				if (type === editorCommon.EditorType.IDiffEditor) {
A
Alex Dima 已提交
833
					let diffEditorConfig = config[EditorConfiguration.DIFF_EDITOR_SECTION];
E
Erich Gamma 已提交
834 835 836 837
					if (diffEditorConfig) {
						if (!editorConfig) {
							editorConfig = diffEditorConfig;
						} else {
A
Alex Dima 已提交
838
							editorConfig = objects.mixin(editorConfig, diffEditorConfig);
E
Erich Gamma 已提交
839 840 841 842 843 844 845 846 847 848 849 850 851
						}
					}
				}

				if (editorConfig) {
					delete editorConfig.readOnly; // Prevent someone from making editor readonly
					editor.updateOptions(editorConfig);
				}
			}
		}
	}
}

A
Alex Dima 已提交
852
let configurationRegistry = <IConfigurationRegistry>Registry.as(Extensions.Configuration);
E
Erich Gamma 已提交
853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883
configurationRegistry.registerConfiguration({
	'id': 'editor',
	'order': 5,
	'type': 'object',
	'title': nls.localize('editorConfigurationTitle', "Editor configuration"),
	'properties' : {
		'editor.fontFamily' : {
			'type': 'string',
			'default': DefaultConfig.editor.fontFamily,
			'description': nls.localize('fontFamily', "Controls the font family.")
		},
		'editor.fontSize' : {
			'type': 'number',
			'default': DefaultConfig.editor.fontSize,
			'description': nls.localize('fontSize', "Controls the font size.")
		},
		'editor.lineHeight' : {
			'type': 'number',
			'default': DefaultConfig.editor.lineHeight,
			'description': nls.localize('lineHeight', "Controls the line height.")
		},
		'editor.lineNumbers' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.lineNumbers,
			'description': nls.localize('lineNumbers', "Controls visibility of line numbers")
		},
		'editor.glyphMargin' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.glyphMargin,
			'description': nls.localize('glyphMargin', "Controls visibility of the glyph margin")
		},
884 885 886 887 888 889 890 891
		'editor.rulers' : {
			'type': 'array',
			'items': {
				'type': 'number'
			},
			'default': DefaultConfig.editor.rulers,
			'description': nls.localize('rulers', "Columns at which to show vertical rulers")
		},
A
Alex Dima 已提交
892 893 894 895 896
		'editor.wordSeparators' : {
			'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")
		},
E
Erich Gamma 已提交
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991
		'editor.tabSize' : {
			'oneOf': [
				{
					'type': 'number'
				},
				{
					'type': 'string',
					'enum': ['auto']
				}
			],
			'default': DefaultConfig.editor.tabSize,
			'minimum': 1,
			'description': nls.localize('tabSize', "Controls the rendering size of tabs in characters. Accepted values: \"auto\", 2, 4, 6, etc. If set to \"auto\", the value will be guessed when a file is opened.")
		},
		'editor.insertSpaces' : {
			'oneOf': [
				{
					'type': 'boolean'
				},
				{
					'type': 'string',
					'enum': ['auto']
				}
			],
			'default': DefaultConfig.editor.insertSpaces,
			'description': nls.localize('insertSpaces', "Controls if the editor will insert spaces for tabs. Accepted values:  \"auto\", true, false. If set to \"auto\", the value will be guessed when a file is opened.")
		},
		'editor.roundedSelection' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.roundedSelection,
			'description': nls.localize('roundedSelection', "Controls if selections have rounded corners")
		},
		'editor.scrollBeyondLastLine' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.scrollBeyondLastLine,
			'description': nls.localize('scrollBeyondLastLine', "Controls if the editor will scroll beyond the last line")
		},
		'editor.wrappingColumn' : {
			'type': 'integer',
			'default': DefaultConfig.editor.wrappingColumn,
			'minimum': -1,
			'description': nls.localize('wrappingColumn', "Controls after how many characters the editor will wrap to the next line. Setting this to 0 turns on viewport width wrapping")
		},
		'editor.wrappingIndent' : {
			'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'.")
		},
		'editor.mouseWheelScrollSensitivity' : {
			'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")
		},
		'editor.quickSuggestions' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.quickSuggestions,
			'description': nls.localize('quickSuggestions', "Controls if quick suggestions should show up or not while typing")
		},
		'editor.quickSuggestionsDelay' : {
			'type': 'integer',
			'default': DefaultConfig.editor.quickSuggestionsDelay,
			'minimum': 0,
			'description': nls.localize('quickSuggestionsDelay', "Controls the delay in ms after which quick suggestions will show up")
		},
		'editor.autoClosingBrackets' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.autoClosingBrackets,
			'description': nls.localize('autoClosingBrackets', "Controls if the editor should automatically close brackets after opening them")
		},
		'editor.formatOnType' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.formatOnType,
			'description': nls.localize('formatOnType', "Controls if the editor should automatically format the line after typing")
		},
		'editor.suggestOnTriggerCharacters' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.suggestOnTriggerCharacters,
			'description': nls.localize('suggestOnTriggerCharacters', "Controls if suggestions should automatically show up when typing trigger characters")
		},
		'editor.selectionHighlight' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.selectionHighlight,
			'description': nls.localize('selectionHighlight', "Controls whether the editor should highlight similar matches to the selection")
		},
//		'editor.outlineMarkers' : {
//			'type': 'boolean',
//			'default': DefaultConfig.editor.outlineMarkers,
//			'description': nls.localize('outlineMarkers', "Controls whether the editor should draw horizontal lines before classes and methods")
//		},
		'editor.overviewRulerLanes' : {
			'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")
		},
992 993 994 995
		'editor.cursorBlinking' : {
			'type': 'string',
			'enum': ['blink', 'visible', 'hidden'],
			'default': DefaultConfig.editor.cursorBlinking,
C
Chris Dias 已提交
996
			'description': nls.localize('cursorBlinking', "Controls the cursor blinking animation, accepted values are 'blink', 'visible', and 'hidden'")
997
		},
M
markrendle 已提交
998 999 1000 1001 1002 1003
		'editor.cursorStyle' : {
			'type': 'string',
			'enum': ['block', 'line'],
			'default': DefaultConfig.editor.cursorStyle,
			'description': nls.localize('cursorStyle', "Controls the cursor style, accepted values are 'block' and 'line'")
		},
1004 1005 1006 1007 1008
		'editor.fontLigatures' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.fontLigatures,
			'description': nls.localize('fontLigatures', "Enables font ligatures")
		},
E
Erich Gamma 已提交
1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023
		'editor.hideCursorInOverviewRuler' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.hideCursorInOverviewRuler,
			'description': nls.localize('hideCursorInOverviewRuler', "Controls if the cursor should be hidden in the overview ruler.")
		},
		'editor.renderWhitespace': {
			'type': 'boolean',
			default: DefaultConfig.editor.renderWhitespace,
			description: nls.localize('renderWhitespace', "Controls whether the editor should render whitespace characters")
		},
		'editor.referenceInfos' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.referenceInfos,
			'description': nls.localize('referenceInfos', "Controls if the editor shows reference information for the modes that support it")
		},
M
Martin Aeschlimann 已提交
1024 1025 1026
		'editor.folding' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.folding,
1027
			'description': nls.localize('folding', "Controls whether the editor has code folding enabled")
M
Martin Aeschlimann 已提交
1028
		},
E
Erich Gamma 已提交
1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040
		'diffEditor.renderSideBySide' : {
			'type': 'boolean',
			'default': true,
			'description': nls.localize('sideBySide', "Controls if the diff editor shows the diff side by side or inline")
		},
		'diffEditor.ignoreTrimWhitespace' : {
			'type': 'boolean',
			'default': true,
			'description': nls.localize('ignoreTrimWhitespace', "Controls if the diff editor shows changes in leading or trailing whitespace as diffs")
		}
	}
});