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

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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
export class ConfigurationWithDefaults {

	private _editor:EditorCommon.IEditorOptions;

	constructor(options:EditorCommon.IEditorOptions) {
		this._editor = <EditorCommon.IEditorOptions>Objects.clone(DefaultConfig.editor);

		this._mergeOptionsIn(options);
	}

	public getEditorOptions(): EditorCommon.IEditorOptions {
		return this._editor;
	}

	private _mergeOptionsIn(newOptions:EditorCommon.IEditorOptions): void {
		this._editor = Objects.mixin(this._editor, newOptions || {});
	}

	public updateOptions(newOptions:EditorCommon.IEditorOptions): void {
		// Apply new options
		this._mergeOptionsIn(newOptions);
	}
}

A
Alex Dima 已提交
65 66 67 68 69 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
function cloneInternalEditorOptions(opts: EditorCommon.IInternalEditorOptions): EditorCommon.IInternalEditorOptions {
	return {
		experimentalScreenReader: opts.experimentalScreenReader,
		rulers: opts.rulers.slice(0),
		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,
117
		folding: opts.folding,
A
Alex Dima 已提交
118 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
		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 已提交
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 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
class InternalEditorOptionsHelper {

	constructor() {
	}

	public static createInternalEditorOptions(
		outerWidth:number,
		outerHeight:number,
		opts:EditorCommon.IEditorOptions,
		editorClassName:string,
		requestedFontFamily:string,
		requestedFontSize:number,
		requestedLineHeight:number,
		adjustedLineHeight:number,
		themeOpts: ICSSConfig,
		isDominatedByLongLines:boolean,
		lineCount: number,
		indentationOptions: EditorCommon.IInternalIndentationOptions
	): EditorCommon.IInternalEditorOptions {

		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 已提交
214 215 216
		if (opts.folding) {
			lineDecorationsWidth += 16;
		}
E
Erich Gamma 已提交
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
		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;
		}

		let wrappingInfo: EditorCommon.IEditorWrappingInfo;

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

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

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

E
Erich Gamma 已提交
268 269 270 271 272 273 274 275
		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,
276
			readOnly: readOnly,
E
Erich Gamma 已提交
277 278
			scrollbar: scrollbar,
			overviewRulerLanes: toInteger(opts.overviewRulerLanes, 0, 3),
279
			cursorBlinking: opts.cursorBlinking,
280
			experimentalScreenReader: toBoolean(opts.experimentalScreenReader),
281
			rulers: toSortedIntegerArray(opts.rulers),
282
			ariaLabel: String(opts.ariaLabel),
M
markrendle 已提交
283
			cursorStyle: opts.cursorStyle,
284
			fontLigatures: toBoolean(opts.fontLigatures),
E
Erich Gamma 已提交
285 286 287 288 289 290
			hideCursorInOverviewRuler: toBoolean(opts.hideCursorInOverviewRuler),
			scrollBeyondLastLine: toBoolean(opts.scrollBeyondLastLine),
			wrappingIndent: opts.wrappingIndent,
			wordWrapBreakBeforeCharacters: opts.wordWrapBreakBeforeCharacters,
			wordWrapBreakAfterCharacters: opts.wordWrapBreakAfterCharacters,
			wordWrapBreakObtrusiveCharacters: opts.wordWrapBreakObtrusiveCharacters,
291
			tabFocusMode: tabFocusMode,
E
Erich Gamma 已提交
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
			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 已提交
308
			folding: toBoolean(opts.folding),
E
Erich Gamma 已提交
309 310 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
			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,
		};
	}

	private static _sanitizeScrollbarOpts(raw:EditorCommon.IEditorScrollbarOptions, mouseWheelScrollSensitivity:number): EditorCommon.IInternalEditorScrollbarOptions {
A
Alex Dima 已提交
336 337
		let horizontalScrollbarSize = toIntegerWithDefault(raw.horizontalScrollbarSize, 10);
		let verticalScrollbarSize = toIntegerWithDefault(raw.verticalScrollbarSize, 14);
E
Erich Gamma 已提交
338 339 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
		};
	}

	public static createConfigurationChangedEvent(prevOpts:EditorCommon.IInternalEditorOptions, newOpts:EditorCommon.IInternalEditorOptions): EditorCommon.IConfigurationChangedEvent {
		return {
361
			experimentalScreenReader:		(prevOpts.experimentalScreenReader !== newOpts.experimentalScreenReader),
362
			rulers:							(!this._numberArraysEqual(prevOpts.rulers, newOpts.rulers)),
363
			ariaLabel:						(prevOpts.ariaLabel !== newOpts.ariaLabel),
364

365 366 367
			lineNumbers:					(prevOpts.lineNumbers !== newOpts.lineNumbers),
			selectOnLineNumbers:			(prevOpts.selectOnLineNumbers !== newOpts.selectOnLineNumbers),
			glyphMargin:					(prevOpts.glyphMargin !== newOpts.glyphMargin),
E
Erich Gamma 已提交
368 369 370 371 372 373
			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),
374
			cursorBlinking:					(prevOpts.cursorBlinking !== newOpts.cursorBlinking),
375
			cursorStyle:					(prevOpts.cursorStyle !== newOpts.cursorStyle),
376
			fontLigatures:					(prevOpts.fontLigatures !== newOpts.fontLigatures),
E
Erich Gamma 已提交
377 378 379 380 381 382 383 384 385 386 387
			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),
388

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

403
			layoutInfo: 					(!EditorLayoutProvider.layoutEqual(prevOpts.layoutInfo, newOpts.layoutInfo)),
404 405 406 407
			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),
408
			observedOuterHeight:			(prevOpts.observedOuterHeight !== newOpts.observedOuterHeight),
409 410 411 412 413
			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 已提交
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455
		};
	}

	private static _scrollbarOptsEqual(a:EditorCommon.IInternalEditorScrollbarOptions, b:EditorCommon.IInternalEditorScrollbarOptions): boolean {
		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
		);
	}

	private static _stylingInfoEqual(a:EditorCommon.IEditorStyling, b:EditorCommon.IEditorStyling): boolean {
		return (
			a.editorClassName === b.editorClassName
			&& a.fontFamily === b.fontFamily
			&& a.fontSize === b.fontSize
			&& a.lineHeight === b.lineHeight
		);
	}

	private static _wrappingInfoEqual(a:EditorCommon.IEditorWrappingInfo, b:EditorCommon.IEditorWrappingInfo): boolean {
		return (
			a.isViewportWrapping === b.isViewportWrapping
			&& a.wrappingColumn === b.wrappingColumn
		);
	}

	private static _indentInfoEqual(a:EditorCommon.IInternalIndentationOptions, b:EditorCommon.IInternalIndentationOptions): boolean {
		return (
			a.insertSpaces === b.insertSpaces
			&& a.tabSize === b.tabSize
		);
	}
456 457 458 459 460 461 462 463 464 465 466 467

	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 已提交
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
}

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 已提交
491
	let r = parseFloat(source);
E
Erich Gamma 已提交
492 493 494 495 496 497 498
	if (isNaN(r)) {
		r = defaultValue;
	}
	return r;
}

function toInteger(source:any, minimum?:number, maximum?:number): number {
A
Alex Dima 已提交
499
	let r = parseInt(source, 10);
E
Erich Gamma 已提交
500 501 502 503 504 505 506 507 508 509 510 511
	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;
}

512 513 514 515 516 517 518 519 520 521
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 已提交
522 523 524 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 {
	(tabSize:number): EditorCommon.IGuessedIndentation;
}

A
Alex Dima 已提交
550
export abstract class CommonEditorConfiguration extends Disposable implements EditorCommon.IConfiguration {
E
Erich Gamma 已提交
551 552 553

	public handlerDispatcher:EditorCommon.IHandlerDispatcher;
	public editor:EditorCommon.IInternalEditorOptions;
A
Alex Dima 已提交
554
	public editorClone:EditorCommon.IInternalEditorOptions;
E
Erich Gamma 已提交
555 556 557 558 559 560 561 562

	protected _configWithDefaults:ConfigurationWithDefaults;
	private _indentationGuesser:IIndentationGuesser;
	private _cachedGuessedIndentationTabSize: number;
	private _cachedGuessedIndentation:EditorCommon.IGuessedIndentation;
	private _isDominatedByLongLines:boolean;
	private _lineCount:number;

A
Alex Dima 已提交
563 564 565
	private _onDidChange = this._register(new Emitter<EditorCommon.IConfigurationChangedEvent>());
	public onDidChange: Event<EditorCommon.IConfigurationChangedEvent> = this._onDidChange.event;

E
Erich Gamma 已提交
566
	constructor(options:any, indentationGuesser:IIndentationGuesser = null) {
A
Alex Dima 已提交
567
		super();
E
Erich Gamma 已提交
568 569 570 571 572 573 574 575 576 577
		this._configWithDefaults = new ConfigurationWithDefaults(options);
		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 已提交
578
		this.editorClone = cloneInternalEditorOptions(this.editor);
E
Erich Gamma 已提交
579 580 581 582 583 584 585 586 587
	}

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

	protected _recomputeOptions(): void {
		let oldOpts = this.editor;
		this.editor = this._computeInternalOptions();
A
Alex Dima 已提交
588
		this.editorClone = cloneInternalEditorOptions(this.editor);
E
Erich Gamma 已提交
589 590 591 592 593 594 595 596 597 598 599 600 601 602

		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 已提交
603
			this._onDidChange.fire(changeEvent);
E
Erich Gamma 已提交
604 605 606 607 608 609 610 611 612 613
		}
	}

	public getRawOptions(): EditorCommon.IEditorOptions {
		return this._configWithDefaults.getEditorOptions();
	}

	private _computeInternalOptions(): EditorCommon.IInternalEditorOptions {
		let opts = this._configWithDefaults.getEditorOptions();

614
		let editorClassName = this._getEditorClassName(opts.theme, toBoolean(opts.fontLigatures));
E
Erich Gamma 已提交
615 616 617 618 619 620 621 622 623 624 625 626 627 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 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680
		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
		);
	}

	public updateOptions(newOptions:EditorCommon.IEditorOptions): void {
		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();
	}

	private _guessIndentationOptionsCached(tabSize:number): EditorCommon.IGuessedIndentation {
		if (!this._cachedGuessedIndentation || this._cachedGuessedIndentationTabSize !== tabSize) {
			this._cachedGuessedIndentationTabSize = tabSize;

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

	private static _getValidatedIndentationOptions(opts: EditorCommon.IEditorOptions): IValidatedIndentationOptions {
		let r: IValidatedIndentationOptions = {
			tabSizeIsAuto: false,
			tabSize: 4,
			insertSpacesIsAuto: false,
681
			insertSpaces: true
E
Erich Gamma 已提交
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727
		};

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

	private static _computeIndentationOptions(allOpts: EditorCommon.IEditorOptions, indentationGuesser:IIndentationGuesser): EditorCommon.IInternalIndentationOptions {
		let opts = this._getValidatedIndentationOptions(allOpts);

		let guessedIndentation:EditorCommon.IGuessedIndentation = null;
		if (opts.tabSizeIsAuto || opts.insertSpacesIsAuto) {
			// We must use the indentation guesser to come up with the indentation options
			guessedIndentation = indentationGuesser(opts.tabSize);
		}

		let r: EditorCommon.IInternalIndentationOptions = {
			insertSpaces: opts.insertSpaces,
			tabSize: opts.tabSize
		};

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

		return r;
	}

	public getIndentationOptions(): EditorCommon.IInternalIndentationOptions {
		return this.editor.indentInfo;
	}

	private _normalizeIndentationFromWhitespace(str:string): string {
A
Alex Dima 已提交
728
		let indentation = this.getIndentationOptions(),
E
Erich Gamma 已提交
729 730 731 732 733 734 735 736 737 738 739
			spacesCnt = 0,
			i:number;

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

A
Alex Dima 已提交
740
		let result = '';
E
Erich Gamma 已提交
741
		if (!indentation.insertSpaces) {
A
Alex Dima 已提交
742
			let tabsCnt = Math.floor(spacesCnt / indentation.tabSize);
E
Erich Gamma 已提交
743 744 745 746 747 748 749 750 751 752 753 754 755 756
			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 已提交
757
		let firstNonWhitespaceIndex = Strings.firstNonWhitespaceIndex(str);
E
Erich Gamma 已提交
758 759 760 761 762 763 764
		if (firstNonWhitespaceIndex === -1) {
			firstNonWhitespaceIndex = str.length;
		}
		return this._normalizeIndentationFromWhitespace(str.substring(0, firstNonWhitespaceIndex)) + str.substring(firstNonWhitespaceIndex);
	}

	public getOneIndent(): string {
A
Alex Dima 已提交
765
		let indentation = this.getIndentationOptions();
E
Erich Gamma 已提交
766
		if (indentation.insertSpaces) {
A
Alex Dima 已提交
767 768
			let result = '';
			for (let i = 0; i < indentation.tabSize; i++) {
E
Erich Gamma 已提交
769 770 771 772 773 774 775 776
				result += ' ';
			}
			return result;
		} else {
			return '\t';
		}
	}

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

779
	protected abstract getOuterWidth(): number;
E
Erich Gamma 已提交
780

781
	protected abstract getOuterHeight(): number;
E
Erich Gamma 已提交
782

783
	protected abstract readConfiguration(editorClassName: string, fontFamily: string, fontSize: number, lineHeight: number): ICSSConfig;
E
Erich Gamma 已提交
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802
}

/**
 * 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.
	 */
	public static apply(config:any, editor?:EditorCommon.IEditor): void;
	public static apply(config:any, editor?:EditorCommon.IEditor[]): void;
	public static apply(config:any, editorOrArray?:any): void {
		if (!config) {
			return;
		}

A
Alex Dima 已提交
803
		let editors:EditorCommon.IEditor[] = editorOrArray;
E
Erich Gamma 已提交
804 805 806 807
		if (!Array.isArray(editorOrArray)) {
			editors = [editorOrArray];
		}

A
Alex Dima 已提交
808 809
		for (let i = 0; i < editors.length; i++) {
			let editor = editors[i];
E
Erich Gamma 已提交
810 811 812

			// Editor Settings (Code Editor, Diff, Terminal)
			if (editor && typeof editor.updateOptions === 'function') {
A
Alex Dima 已提交
813
				let type = editor.getEditorType();
E
Erich Gamma 已提交
814 815 816 817
				if (type !== EditorCommon.EditorType.ICodeEditor && type !== EditorCommon.EditorType.IDiffEditor) {
					continue;
				}

A
Alex Dima 已提交
818
				let editorConfig = config[EditorConfiguration.EDITOR_SECTION];
E
Erich Gamma 已提交
819
				if (type === EditorCommon.EditorType.IDiffEditor) {
A
Alex Dima 已提交
820
					let diffEditorConfig = config[EditorConfiguration.DIFF_EDITOR_SECTION];
E
Erich Gamma 已提交
821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838
					if (diffEditorConfig) {
						if (!editorConfig) {
							editorConfig = diffEditorConfig;
						} else {
							editorConfig = Objects.mixin(editorConfig, diffEditorConfig);
						}
					}
				}

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

A
Alex Dima 已提交
839
let configurationRegistry = <ConfigurationRegistry.IConfigurationRegistry>Registry.as(ConfigurationRegistry.Extensions.Configuration);
E
Erich Gamma 已提交
840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870
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")
		},
871 872 873 874 875 876 877 878
		'editor.rulers' : {
			'type': 'array',
			'items': {
				'type': 'number'
			},
			'default': DefaultConfig.editor.rulers,
			'description': nls.localize('rulers', "Columns at which to show vertical rulers")
		},
E
Erich Gamma 已提交
879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 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
		'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")
		},
974 975 976 977
		'editor.cursorBlinking' : {
			'type': 'string',
			'enum': ['blink', 'visible', 'hidden'],
			'default': DefaultConfig.editor.cursorBlinking,
C
Chris Dias 已提交
978
			'description': nls.localize('cursorBlinking', "Controls the cursor blinking animation, accepted values are 'blink', 'visible', and 'hidden'")
979
		},
M
markrendle 已提交
980 981 982 983 984 985
		'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'")
		},
986 987 988 989 990
		'editor.fontLigatures' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.fontLigatures,
			'description': nls.localize('fontLigatures', "Enables font ligatures")
		},
E
Erich Gamma 已提交
991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
		'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 已提交
1006 1007 1008 1009 1010
		'editor.folding' : {
			'type': 'boolean',
			'default': DefaultConfig.editor.folding,
			'description': nls.localize('folding', "Controls wheter the editor has code folding enabled")
		},
E
Erich Gamma 已提交
1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022
		'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")
		}
	}
});