diff --git a/build/monaco/monaco.d.ts.recipe b/build/monaco/monaco.d.ts.recipe index 17d87cc2687..16aaf48759c 100644 --- a/build/monaco/monaco.d.ts.recipe +++ b/build/monaco/monaco.d.ts.recipe @@ -65,9 +65,10 @@ export interface ICommandHandler { #include(vs/platform/markers/common/markers): IMarkerData #include(vs/editor/browser/standalone/colorizer): IColorizerOptions, IColorizerElementOptions #include(vs/base/common/scrollable): ScrollbarVisibility -#includeAll(vs/editor/common/editorCommon;IMode=>languages.IMode;LanguageIdentifier=>languages.LanguageIdentifier): IPosition, IRange, ISelection, SelectionDirection, IScrollEvent +#includeAll(vs/editor/common/editorCommon;IMode=>languages.IMode;LanguageIdentifier=>languages.LanguageIdentifier;editorOptions.=>): IPosition, IRange, ISelection, SelectionDirection, IScrollEvent #includeAll(vs/editor/common/model/textModelEvents): -#includeAll(vs/editor/browser/editorBrowser;editorCommon.=>): +#includeAll(vs/editor/common/config/editorOptions): +#includeAll(vs/editor/browser/editorBrowser;editorCommon.=>;editorOptions.=>): #include(vs/editor/common/config/fontInfo): FontInfo, BareFontInfo } diff --git a/src/vs/editor/browser/codeEditor.ts b/src/vs/editor/browser/codeEditor.ts index 21b25e366e9..6dc1c3e9588 100644 --- a/src/vs/editor/browser/codeEditor.ts +++ b/src/vs/editor/browser/codeEditor.ts @@ -7,12 +7,12 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { IEditorOptions } from 'vs/editor/common/editorCommon'; import { IEditorContributionCtor } from 'vs/editor/browser/editorBrowser'; import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'; import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget'; import { EditorAction, CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions'; import { EditorBrowserRegistry } from 'vs/editor/browser/editorBrowserExtensions'; +import { IEditorOptions } from "vs/editor/common/config/editorOptions"; export class CodeEditor extends CodeEditorWidget { diff --git a/src/vs/editor/browser/controller/mouseTarget.ts b/src/vs/editor/browser/controller/mouseTarget.ts index e90d35a8f77..00ff997488e 100644 --- a/src/vs/editor/browser/controller/mouseTarget.ts +++ b/src/vs/editor/browser/controller/mouseTarget.ts @@ -6,7 +6,7 @@ import { Position } from 'vs/editor/common/core/position'; import { Range as EditorRange } from 'vs/editor/common/core/range'; -import { EditorLayoutInfo, MouseTargetType } from 'vs/editor/common/editorCommon'; +import { MouseTargetType } from 'vs/editor/common/editorCommon'; import { ClassNames, IMouseTarget, IViewZoneData } from 'vs/editor/browser/editorBrowser'; import { ViewContext } from 'vs/editor/common/view/viewContext'; import { IPointerHandlerHelper } from 'vs/editor/browser/controller/mouseHandler'; @@ -15,6 +15,7 @@ import * as browser from 'vs/base/browser/browser'; import { IViewCursorRenderData } from 'vs/editor/browser/viewParts/viewCursors/viewCursor'; import { PartFingerprint, PartFingerprints } from 'vs/editor/browser/view/viewPart'; import { IViewModel } from 'vs/editor/common/viewModel/viewModel'; +import { EditorLayoutInfo } from "vs/editor/common/config/editorOptions"; interface IETextRange { boundingHeight: number; diff --git a/src/vs/editor/browser/editorBrowser.ts b/src/vs/editor/browser/editorBrowser.ts index 73a13674b40..520308f7d0e 100644 --- a/src/vs/editor/browser/editorBrowser.ts +++ b/src/vs/editor/browser/editorBrowser.ts @@ -13,6 +13,7 @@ import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { FastDomNode } from 'vs/base/browser/fastDomNode'; import { ViewOutgoingEvents } from 'vs/editor/browser/view/viewOutgoingEvents'; +import * as editorOptions from "vs/editor/common/config/editorOptions"; /** * @internal @@ -399,7 +400,7 @@ export interface IOverviewRuler { getDomNode(): HTMLElement; dispose(): void; setZones(zones: editorCommon.OverviewRulerZone[]): void; - setLayout(position: editorCommon.OverviewRulerPosition): void; + setLayout(position: editorOptions.OverviewRulerPosition): void; } /** * A rich code editor. @@ -456,7 +457,7 @@ export interface ICodeEditor extends editorCommon.ICommonCodeEditor { * An event emitted when the layout of the editor has changed. * @event */ - onDidLayoutChange(listener: (e: editorCommon.EditorLayoutInfo) => void): IDisposable; + onDidLayoutChange(listener: (e: editorOptions.EditorLayoutInfo) => void): IDisposable; /** * An event emitted when the scroll in the editor has changed. * @event diff --git a/src/vs/editor/browser/standalone/standaloneCodeEditor.ts b/src/vs/editor/browser/standalone/standaloneCodeEditor.ts index 6b06d743dd2..e7216e90572 100644 --- a/src/vs/editor/browser/standalone/standaloneCodeEditor.ts +++ b/src/vs/editor/browser/standalone/standaloneCodeEditor.ts @@ -12,7 +12,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { CommandsRegistry, ICommandService, ICommandHandler } from 'vs/platform/commands/common/commands'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { ContextKeyExpr, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { IEditorOptions, IActionDescriptor, ICodeEditorWidgetCreationOptions, IDiffEditorOptions, IModel, IModelChangedEvent } from 'vs/editor/common/editorCommon'; +import { IActionDescriptor, ICodeEditorWidgetCreationOptions, IModel, IModelChangedEvent } from 'vs/editor/common/editorCommon'; import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'; import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService'; import { StandaloneKeybindingService } from 'vs/editor/browser/standalone/simpleServices'; @@ -23,6 +23,7 @@ import { ICodeEditor, IDiffEditor } from 'vs/editor/browser/editorBrowser'; import { IStandaloneThemeService } from 'vs/editor/common/services/standaloneThemeService'; import { InternalEditorAction } from 'vs/editor/common/editorAction'; import { MenuId, MenuRegistry, IMenuItem } from 'vs/platform/actions/common/actions'; +import { IDiffEditorOptions, IEditorOptions } from "vs/editor/common/config/editorOptions"; /** * The options to create an editor. diff --git a/src/vs/editor/browser/standalone/standaloneEditor.ts b/src/vs/editor/browser/standalone/standaloneEditor.ts index 35231e618ad..85431a60334 100644 --- a/src/vs/editor/browser/standalone/standaloneEditor.ts +++ b/src/vs/editor/browser/standalone/standaloneEditor.ts @@ -34,6 +34,7 @@ import { NULL_STATE, nullTokenize } from 'vs/editor/common/modes/nullMode'; import { IStandaloneThemeData, IStandaloneThemeService } from 'vs/editor/common/services/standaloneThemeService'; import { Token } from 'vs/editor/common/core/token'; import { FontInfo, BareFontInfo } from 'vs/editor/common/config/fontInfo'; +import * as editorOptions from "vs/editor/common/config/editorOptions"; /** * @internal @@ -336,7 +337,7 @@ export function createMonacoEditorAPI(): typeof monaco.editor { // enums ScrollbarVisibility: ScrollbarVisibility, - WrappingIndent: editorCommon.WrappingIndent, + WrappingIndent: editorOptions.WrappingIndent, OverviewRulerLane: editorCommon.OverviewRulerLane, EndOfLinePreference: editorCommon.EndOfLinePreference, DefaultEndOfLine: editorCommon.DefaultEndOfLine, @@ -344,21 +345,21 @@ export function createMonacoEditorAPI(): typeof monaco.editor { TrackedRangeStickiness: editorCommon.TrackedRangeStickiness, CursorChangeReason: editorCommon.CursorChangeReason, MouseTargetType: editorCommon.MouseTargetType, - TextEditorCursorStyle: editorCommon.TextEditorCursorStyle, - TextEditorCursorBlinkingStyle: editorCommon.TextEditorCursorBlinkingStyle, + TextEditorCursorStyle: editorOptions.TextEditorCursorStyle, + TextEditorCursorBlinkingStyle: editorOptions.TextEditorCursorBlinkingStyle, ContentWidgetPositionPreference: ContentWidgetPositionPreference, OverlayWidgetPositionPreference: OverlayWidgetPositionPreference, - RenderMinimap: editorCommon.RenderMinimap, + RenderMinimap: editorOptions.RenderMinimap, // classes - InternalEditorScrollbarOptions: editorCommon.InternalEditorScrollbarOptions, - InternalEditorMinimapOptions: editorCommon.InternalEditorMinimapOptions, - EditorWrappingInfo: editorCommon.EditorWrappingInfo, - InternalEditorViewOptions: editorCommon.InternalEditorViewOptions, - EditorContribOptions: editorCommon.EditorContribOptions, - InternalEditorOptions: editorCommon.InternalEditorOptions, - OverviewRulerPosition: editorCommon.OverviewRulerPosition, - EditorLayoutInfo: editorCommon.EditorLayoutInfo, + InternalEditorScrollbarOptions: editorOptions.InternalEditorScrollbarOptions, + InternalEditorMinimapOptions: editorOptions.InternalEditorMinimapOptions, + EditorWrappingInfo: editorOptions.EditorWrappingInfo, + InternalEditorViewOptions: editorOptions.InternalEditorViewOptions, + EditorContribOptions: editorOptions.EditorContribOptions, + InternalEditorOptions: editorOptions.InternalEditorOptions, + OverviewRulerPosition: editorOptions.OverviewRulerPosition, + EditorLayoutInfo: editorOptions.EditorLayoutInfo, BareFontInfo: BareFontInfo, FontInfo: FontInfo, TextModelResolvedOptions: editorCommon.TextModelResolvedOptions, diff --git a/src/vs/editor/browser/viewParts/overviewRuler/overviewRuler.ts b/src/vs/editor/browser/viewParts/overviewRuler/overviewRuler.ts index 6602162e7ea..b82141108fc 100644 --- a/src/vs/editor/browser/viewParts/overviewRuler/overviewRuler.ts +++ b/src/vs/editor/browser/viewParts/overviewRuler/overviewRuler.ts @@ -4,12 +4,13 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import { OverviewRulerPosition, OverviewRulerZone } from 'vs/editor/common/editorCommon'; +import { OverviewRulerZone } from 'vs/editor/common/editorCommon'; import { ViewEventHandler } from 'vs/editor/common/viewModel/viewEventHandler'; import { IOverviewRuler } from 'vs/editor/browser/editorBrowser'; import { OverviewRulerImpl } from 'vs/editor/browser/viewParts/overviewRuler/overviewRulerImpl'; import { ViewContext } from 'vs/editor/common/view/viewContext'; import * as viewEvents from 'vs/editor/common/view/viewEvents'; +import { OverviewRulerPosition } from "vs/editor/common/config/editorOptions"; export class OverviewRuler extends ViewEventHandler implements IOverviewRuler { diff --git a/src/vs/editor/browser/viewParts/overviewRuler/overviewRulerImpl.ts b/src/vs/editor/browser/viewParts/overviewRuler/overviewRulerImpl.ts index 5c4a4205883..ae1888fe762 100644 --- a/src/vs/editor/browser/viewParts/overviewRuler/overviewRulerImpl.ts +++ b/src/vs/editor/browser/viewParts/overviewRuler/overviewRulerImpl.ts @@ -5,11 +5,12 @@ 'use strict'; import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode'; -import { OverviewRulerPosition, OverviewRulerLane, OverviewRulerZone, ColorZone, ThemeType } from 'vs/editor/common/editorCommon'; +import { OverviewRulerLane, OverviewRulerZone, ColorZone, ThemeType } from 'vs/editor/common/editorCommon'; import { IDisposable } from 'vs/base/common/lifecycle'; import * as browser from 'vs/base/browser/browser'; import { OverviewZoneManager } from 'vs/editor/common/view/overviewZoneManager'; import { Color } from 'vs/base/common/color'; +import { OverviewRulerPosition } from "vs/editor/common/config/editorOptions"; export class OverviewRulerImpl { diff --git a/src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts b/src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts index e3abadf3faf..ab7b80ff4ff 100644 --- a/src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts +++ b/src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts @@ -7,7 +7,7 @@ import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; -import { TextEditorCursorStyle } from 'vs/editor/common/editorCommon'; +import { TextEditorCursorStyle } from 'vs/editor/common/config/editorOptions'; import { Configuration } from 'vs/editor/browser/config/configuration'; import { ViewContext } from 'vs/editor/common/view/viewContext'; import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/view/renderingContext'; diff --git a/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts b/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts index c1e77506c64..7874ef6e7a1 100644 --- a/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts +++ b/src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts @@ -6,7 +6,6 @@ 'use strict'; import 'vs/css!./viewCursors'; -import * as editorCommon from 'vs/editor/common/editorCommon'; import { ClassNames } from 'vs/editor/browser/editorBrowser'; import { ViewPart } from 'vs/editor/browser/view/viewPart'; import { Position } from 'vs/editor/common/core/position'; @@ -18,14 +17,15 @@ import { TimeoutTimer, IntervalTimer } from 'vs/base/common/async'; import * as viewEvents from 'vs/editor/common/view/viewEvents'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { editorCursor } from 'vs/editor/common/view/editorColorRegistry'; +import { TextEditorCursorBlinkingStyle, TextEditorCursorStyle } from "vs/editor/common/config/editorOptions"; export class ViewCursors extends ViewPart { static BLINK_INTERVAL = 500; private _readOnly: boolean; - private _cursorBlinking: editorCommon.TextEditorCursorBlinkingStyle; - private _cursorStyle: editorCommon.TextEditorCursorStyle; + private _cursorBlinking: TextEditorCursorBlinkingStyle; + private _cursorStyle: TextEditorCursorStyle; private _selectionIsEmpty: boolean; private _isVisible: boolean; @@ -198,12 +198,12 @@ export class ViewCursors extends ViewPart { // ---- blinking logic - private _getCursorBlinking(): editorCommon.TextEditorCursorBlinkingStyle { + private _getCursorBlinking(): TextEditorCursorBlinkingStyle { if (!this._editorHasFocus) { - return editorCommon.TextEditorCursorBlinkingStyle.Hidden; + return TextEditorCursorBlinkingStyle.Hidden; } if (this._readOnly || !this._primaryCursor.getIsInEditableRange()) { - return editorCommon.TextEditorCursorBlinkingStyle.Solid; + return TextEditorCursorBlinkingStyle.Solid; } return this._cursorBlinking; } @@ -215,8 +215,8 @@ export class ViewCursors extends ViewPart { let blinkingStyle = this._getCursorBlinking(); // hidden and solid are special as they involve no animations - let isHidden = (blinkingStyle === editorCommon.TextEditorCursorBlinkingStyle.Hidden); - let isSolid = (blinkingStyle === editorCommon.TextEditorCursorBlinkingStyle.Solid); + let isHidden = (blinkingStyle === TextEditorCursorBlinkingStyle.Hidden); + let isSolid = (blinkingStyle === TextEditorCursorBlinkingStyle.Solid); if (isHidden) { this._hide(); @@ -228,7 +228,7 @@ export class ViewCursors extends ViewPart { this._updateDomClassName(); if (!isHidden && !isSolid) { - if (blinkingStyle === editorCommon.TextEditorCursorBlinkingStyle.Blink) { + if (blinkingStyle === TextEditorCursorBlinkingStyle.Blink) { // flat blinking is handled by JavaScript to save battery life due to Chromium step timing issue https://bugs.chromium.org/p/chromium/issues/detail?id=361587 this._cursorFlatBlinkInterval.cancelAndSet(() => { if (this._isVisible) { @@ -257,22 +257,22 @@ export class ViewCursors extends ViewPart { result += ' has-selection'; } switch (this._cursorStyle) { - case editorCommon.TextEditorCursorStyle.Line: + case TextEditorCursorStyle.Line: result += ' cursor-line-style'; break; - case editorCommon.TextEditorCursorStyle.Block: + case TextEditorCursorStyle.Block: result += ' cursor-block-style'; break; - case editorCommon.TextEditorCursorStyle.Underline: + case TextEditorCursorStyle.Underline: result += ' cursor-underline-style'; break; - case editorCommon.TextEditorCursorStyle.LineThin: + case TextEditorCursorStyle.LineThin: result += ' cursor-line-thin-style'; break; - case editorCommon.TextEditorCursorStyle.BlockOutline: + case TextEditorCursorStyle.BlockOutline: result += ' cursor-block-outline-style'; break; - case editorCommon.TextEditorCursorStyle.UnderlineThin: + case TextEditorCursorStyle.UnderlineThin: result += ' cursor-underline-thin-style'; break; default: @@ -280,19 +280,19 @@ export class ViewCursors extends ViewPart { } if (this._blinkingEnabled) { switch (this._getCursorBlinking()) { - case editorCommon.TextEditorCursorBlinkingStyle.Blink: + case TextEditorCursorBlinkingStyle.Blink: result += ' cursor-blink'; break; - case editorCommon.TextEditorCursorBlinkingStyle.Smooth: + case TextEditorCursorBlinkingStyle.Smooth: result += ' cursor-smooth'; break; - case editorCommon.TextEditorCursorBlinkingStyle.Phase: + case TextEditorCursorBlinkingStyle.Phase: result += ' cursor-phase'; break; - case editorCommon.TextEditorCursorBlinkingStyle.Expand: + case TextEditorCursorBlinkingStyle.Expand: result += ' cursor-expand'; break; - case editorCommon.TextEditorCursorBlinkingStyle.Solid: + case TextEditorCursorBlinkingStyle.Solid: result += ' cursor-solid'; break; default: diff --git a/src/vs/editor/browser/widget/codeEditorWidget.ts b/src/vs/editor/browser/widget/codeEditorWidget.ts index 94ab9c0f149..1b9501a52f8 100644 --- a/src/vs/editor/browser/widget/codeEditorWidget.ts +++ b/src/vs/editor/browser/widget/codeEditorWidget.ts @@ -29,6 +29,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import Event, { Emitter } from 'vs/base/common/event'; import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { InternalEditorAction } from 'vs/editor/common/editorAction'; +import { IEditorOptions } from "vs/editor/common/config/editorOptions"; export abstract class CodeEditorWidget extends CommonCodeEditor implements editorBrowser.ICodeEditor { @@ -80,7 +81,7 @@ export abstract class CodeEditorWidget extends CommonCodeEditor implements edito constructor( domElement: HTMLElement, - options: editorCommon.IEditorOptions, + options: IEditorOptions, @IInstantiationService instantiationService: IInstantiationService, @ICodeEditorService codeEditorService: ICodeEditorService, @ICommandService commandService: ICommandService, @@ -151,7 +152,7 @@ export abstract class CodeEditorWidget extends CommonCodeEditor implements edito super.dispose(); } - public updateOptions(newOptions: editorCommon.IEditorOptions): void { + public updateOptions(newOptions: IEditorOptions): void { let oldTheme = this._configuration.editor.viewInfo.theme; super.updateOptions(newOptions); let newTheme = this._configuration.editor.viewInfo.theme; diff --git a/src/vs/editor/browser/widget/diffEditorWidget.ts b/src/vs/editor/browser/widget/diffEditorWidget.ts index 37d9797f384..9e137b959c3 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget.ts @@ -31,6 +31,7 @@ import { InlineDecoration } from 'vs/editor/common/viewModel/viewModel'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { ColorId, MetadataConsts, FontStyle } from 'vs/editor/common/modes'; import Event, { Emitter } from 'vs/base/common/event'; +import * as editorOptions from "vs/editor/common/config/editorOptions"; interface IEditorDiffDecorations { decorations: editorCommon.IModelDeltaDecoration[]; @@ -185,7 +186,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE constructor( domElement: HTMLElement, - options: editorCommon.IDiffEditorOptions, + options: editorOptions.IDiffEditorOptions, @IEditorWorkerService editorWorkerService: IEditorWorkerService, @IContextKeyService contextKeyService: IContextKeyService, @IInstantiationService instantiationService: IInstantiationService, @@ -351,7 +352,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE this._containerDomElement.appendChild(this._modifiedDomNode); } - private _createLeftHandSideEditor(options: editorCommon.IDiffEditorOptions, instantiationService: IInstantiationService): void { + private _createLeftHandSideEditor(options: editorOptions.IDiffEditorOptions, instantiationService: IInstantiationService): void { this.originalEditor = this._createInnerEditor(instantiationService, this._originalDomNode, this._adjustOptionsForLeftHandSide(options, this._originalIsEditable)); this._register(this.originalEditor.onDidScrollChange((e) => { @@ -380,7 +381,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE })); } - private _createRightHandSideEditor(options: editorCommon.IDiffEditorOptions, instantiationService: IInstantiationService): void { + private _createRightHandSideEditor(options: editorOptions.IDiffEditorOptions, instantiationService: IInstantiationService): void { this.modifiedEditor = this._createInnerEditor(instantiationService, this._modifiedDomNode, this._adjustOptionsForRightHandSide(options)); this._register(this.modifiedEditor.onDidScrollChange((e) => { @@ -417,7 +418,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE })); } - protected _createInnerEditor(instantiationService: IInstantiationService, container: HTMLElement, options: editorCommon.IEditorOptions): CodeEditor { + protected _createInnerEditor(instantiationService: IInstantiationService, container: HTMLElement, options: editorOptions.IEditorOptions): CodeEditor { return instantiationService.createInstance(CodeEditor, container, options); } @@ -467,7 +468,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE return this.modifiedEditor; } - public updateOptions(newOptions: editorCommon.IDiffEditorOptions): void { + public updateOptions(newOptions: editorOptions.IDiffEditorOptions): void { // Handle new theme this._theme = newOptions && newOptions.theme ? newOptions.theme : this._theme; @@ -759,13 +760,13 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE let freeSpace = DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH - 2 * DiffEditorWidget.ONE_OVERVIEW_WIDTH; let layoutInfo = this.modifiedEditor.getLayoutInfo(); if (layoutInfo) { - this._originalOverviewRuler.setLayout(new editorCommon.OverviewRulerPosition({ + this._originalOverviewRuler.setLayout(new editorOptions.OverviewRulerPosition({ top: 0, width: DiffEditorWidget.ONE_OVERVIEW_WIDTH, right: freeSpace + DiffEditorWidget.ONE_OVERVIEW_WIDTH, height: this._height })); - this._modifiedOverviewRuler.setLayout(new editorCommon.OverviewRulerPosition({ + this._modifiedOverviewRuler.setLayout(new editorOptions.OverviewRulerPosition({ top: 0, right: 0, width: DiffEditorWidget.ONE_OVERVIEW_WIDTH, @@ -851,8 +852,8 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE } } - private _adjustOptionsForSubEditor(options: editorCommon.IDiffEditorOptions): editorCommon.IDiffEditorOptions { - let clonedOptions: editorCommon.IDiffEditorOptions = objects.clone(options || {}); + private _adjustOptionsForSubEditor(options: editorOptions.IDiffEditorOptions): editorOptions.IDiffEditorOptions { + let clonedOptions: editorOptions.IDiffEditorOptions = objects.clone(options || {}); clonedOptions.inDiffEditor = true; clonedOptions.wordWrap = 'off'; clonedOptions.wordWrapMinified = false; @@ -870,7 +871,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE return clonedOptions; } - private _adjustOptionsForLeftHandSide(options: editorCommon.IDiffEditorOptions, isEditable: boolean): editorCommon.IEditorOptions { + private _adjustOptionsForLeftHandSide(options: editorOptions.IDiffEditorOptions, isEditable: boolean): editorOptions.IEditorOptions { let result = this._adjustOptionsForSubEditor(options); result.readOnly = !isEditable; result.overviewRulerLanes = 1; @@ -878,7 +879,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE return result; } - private _adjustOptionsForRightHandSide(options: editorCommon.IDiffEditorOptions): editorCommon.IEditorOptions { + private _adjustOptionsForRightHandSide(options: editorOptions.IDiffEditorOptions): editorOptions.IEditorOptions { let result = this._adjustOptionsForSubEditor(options); result.revealHorizontalRightPadding = DefaultConfig.editor.revealHorizontalRightPadding + DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH; result.scrollbar.verticalHasArrows = false; @@ -1643,7 +1644,7 @@ class DiffEdtorWidgetInline extends DiffEditorWidgetStyle implements IDiffEditor this.decorationsLeft = dataSource.getOriginalEditor().getLayoutInfo().decorationsLeft; - this._register(dataSource.getOriginalEditor().onDidLayoutChange((layoutInfo: editorCommon.EditorLayoutInfo) => { + this._register(dataSource.getOriginalEditor().onDidLayoutChange((layoutInfo: editorOptions.EditorLayoutInfo) => { if (this.decorationsLeft !== layoutInfo.decorationsLeft) { this.decorationsLeft = layoutInfo.decorationsLeft; dataSource.relayoutEditors(); @@ -1775,7 +1776,7 @@ class DiffEdtorWidgetInline extends DiffEditorWidgetStyle implements IDiffEditor class InlineViewZonesComputer extends ViewZonesComputer { private originalModel: editorCommon.IModel; - private modifiedEditorConfiguration: editorCommon.InternalEditorOptions; + private modifiedEditorConfiguration: editorOptions.InternalEditorOptions; private modifiedEditorTabSize: number; private renderIndicators: boolean; @@ -1849,7 +1850,7 @@ class InlineViewZonesComputer extends ViewZonesComputer { }; } - private renderOriginalLine(count: number, originalModel: editorCommon.IModel, config: editorCommon.InternalEditorOptions, tabSize: number, lineNumber: number, decorations: InlineDecoration[]): string[] { + private renderOriginalLine(count: number, originalModel: editorCommon.IModel, config: editorOptions.InternalEditorOptions, tabSize: number, lineNumber: number, decorations: InlineDecoration[]): string[] { let lineContent = originalModel.getLineContent(lineNumber); let actualDecorations = LineDecoration.filter(decorations, lineNumber, 1, lineContent.length + 1); diff --git a/src/vs/editor/browser/widget/embeddedCodeEditorWidget.ts b/src/vs/editor/browser/widget/embeddedCodeEditorWidget.ts index e128dc533a6..ab6acdedb0b 100644 --- a/src/vs/editor/browser/widget/embeddedCodeEditorWidget.ts +++ b/src/vs/editor/browser/widget/embeddedCodeEditorWidget.ts @@ -8,10 +8,11 @@ import * as objects from 'vs/base/common/objects'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { ICodeEditorWidgetCreationOptions, IConfigurationChangedEvent, IEditorOptions } from 'vs/editor/common/editorCommon'; +import { ICodeEditorWidgetCreationOptions } from 'vs/editor/common/editorCommon'; import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { CodeEditor } from 'vs/editor/browser/codeEditor'; +import { IConfigurationChangedEvent, IEditorOptions } from "vs/editor/common/config/editorOptions"; export class EmbeddedCodeEditorWidget extends CodeEditor { diff --git a/src/vs/editor/common/commonCodeEditor.ts b/src/vs/editor/common/commonCodeEditor.ts index b4b408f1298..9e645bd7c88 100644 --- a/src/vs/editor/common/commonCodeEditor.ts +++ b/src/vs/editor/common/commonCodeEditor.ts @@ -30,6 +30,7 @@ import { IModelContentChangedEvent, IModelDecorationsChangedEvent, IModelLanguageChangedEvent, IModelOptionsChangedEvent, TextModelEventType } from 'vs/editor/common/model/textModelEvents'; +import * as editorOptions from "vs/editor/common/config/editorOptions"; import EditorContextKeys = editorCommon.EditorContextKeys; @@ -52,8 +53,8 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo private readonly _onDidChangeModelDecorations: Emitter = this._register(new Emitter()); public readonly onDidChangeModelDecorations: Event = this._onDidChangeModelDecorations.event; - private readonly _onDidChangeConfiguration: Emitter = this._register(new Emitter()); - public readonly onDidChangeConfiguration: Event = this._onDidChangeConfiguration.event; + private readonly _onDidChangeConfiguration: Emitter = this._register(new Emitter()); + public readonly onDidChangeConfiguration: Event = this._onDidChangeConfiguration.event; protected readonly _onDidChangeModel: Emitter = this._register(new Emitter()); public readonly onDidChangeModel: Event = this._onDidChangeModel.event; @@ -64,8 +65,8 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo private readonly _onDidChangeCursorSelection: Emitter = this._register(new Emitter()); public readonly onDidChangeCursorSelection: Event = this._onDidChangeCursorSelection.event; - private readonly _onDidLayoutChange: Emitter = this._register(new Emitter()); - public readonly onDidLayoutChange: Event = this._onDidLayoutChange.event; + private readonly _onDidLayoutChange: Emitter = this._register(new Emitter()); + public readonly onDidLayoutChange: Event = this._onDidLayoutChange.event; protected readonly _onDidFocusEditorText: Emitter = this._register(new Emitter()); public readonly onDidFocusEditorText: Event = this._onDidFocusEditorText.event; @@ -118,7 +119,7 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo constructor( domElement: IContextKeyServiceTarget, - options: editorCommon.IEditorOptions, + options: editorOptions.IEditorOptions, instantiationService: IInstantiationService, contextKeyService: IContextKeyService ) { @@ -204,15 +205,15 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo return this._instantiationService.invokeFunction(fn); } - public updateOptions(newOptions: editorCommon.IEditorOptions): void { + public updateOptions(newOptions: editorOptions.IEditorOptions): void { this._configuration.updateOptions(newOptions); } - public getConfiguration(): editorCommon.InternalEditorOptions { + public getConfiguration(): editorOptions.InternalEditorOptions { return this._configuration.editorClone; } - public getRawConfiguration(): editorCommon.IEditorOptions { + public getRawConfiguration(): editorOptions.IEditorOptions { return this._configuration.getRawOptions(); } @@ -759,7 +760,7 @@ export abstract class CommonCodeEditor extends Disposable implements editorCommo } } - public getLayoutInfo(): editorCommon.EditorLayoutInfo { + public getLayoutInfo(): editorOptions.EditorLayoutInfo { return this._configuration.editor.layoutInfo; } diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index d8085633a58..d3dec7efba2 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -18,6 +18,7 @@ import { ScrollbarVisibility } from 'vs/base/common/scrollable'; import { FontInfo, BareFontInfo } from 'vs/editor/common/config/fontInfo'; import { Constants } from 'vs/editor/common/core/uint'; import { EditorZoom } from 'vs/editor/common/config/editorZoom'; +import * as editorOptions from "vs/editor/common/config/editorOptions"; /** * Control what pressing Tab does. @@ -75,23 +76,23 @@ export class GlobalScreenReaderNVDA { export class ConfigurationWithDefaults { - private _editor: editorCommon.IEditorOptions; + private _editor: editorOptions.IEditorOptions; - constructor(options: editorCommon.IEditorOptions) { - this._editor = objects.clone(DefaultConfig.editor); + constructor(options: editorOptions.IEditorOptions) { + this._editor = objects.clone(DefaultConfig.editor); this._mergeOptionsIn(options); } - public getEditorOptions(): editorCommon.IEditorOptions { + public getEditorOptions(): editorOptions.IEditorOptions { return this._editor; } - private _mergeOptionsIn(newOptions: editorCommon.IEditorOptions): void { + private _mergeOptionsIn(newOptions: editorOptions.IEditorOptions): void { this._editor = objects.mixin(this._editor, newOptions || {}); } - public updateOptions(newOptions: editorCommon.IEditorOptions): void { + public updateOptions(newOptions: editorOptions.IEditorOptions): void { // Apply new options this._mergeOptionsIn(newOptions); } @@ -105,14 +106,14 @@ class InternalEditorOptionsHelper { public static createInternalEditorOptions( outerWidth: number, outerHeight: number, - opts: editorCommon.IEditorOptions, + opts: editorOptions.IEditorOptions, fontInfo: FontInfo, editorClassName: string, isDominatedByLongLines: boolean, lineNumbersDigitCount: number, canUseTranslate3d: boolean, pixelRatio: number - ): editorCommon.InternalEditorOptions { + ): editorOptions.InternalEditorOptions { let stopRenderingLineAfter: number; if (typeof opts.stopRenderingLineAfter !== 'undefined') { @@ -237,7 +238,7 @@ class InternalEditorOptionsHelper { } } - let wrappingInfo = new editorCommon.EditorWrappingInfo({ + let wrappingInfo = new editorOptions.EditorWrappingInfo({ inDiffEditor: Boolean(opts.inDiffEditor), isDominatedByLongLines: isDominatedByLongLines, isWordWrapMinified: bareWrappingInfo.isWordWrapMinified, @@ -273,7 +274,7 @@ class InternalEditorOptionsHelper { renderLineHighlight = 'none'; } - let viewInfo = new editorCommon.InternalEditorViewOptions({ + let viewInfo = new editorOptions.InternalEditorViewOptions({ theme: opts.theme, canUseTranslate3d: canUseTranslate3d, disableMonospaceOptimizations: (toBoolean(opts.disableMonospaceOptimizations) || toBoolean(opts.fontLigatures)), @@ -306,7 +307,7 @@ class InternalEditorOptionsHelper { fixedOverflowWidgets: toBoolean(opts.fixedOverflowWidgets) }); - let contribInfo = new editorCommon.EditorContribOptions({ + let contribInfo = new editorOptions.EditorContribOptions({ selectionClipboard: toBoolean(opts.selectionClipboard), hover: toBoolean(opts.hover), contextmenu: toBoolean(opts.contextmenu), @@ -331,7 +332,7 @@ class InternalEditorOptionsHelper { matchBrackets: toBoolean(opts.matchBrackets), }); - return new editorCommon.InternalEditorOptions({ + return new editorOptions.InternalEditorOptions({ lineHeight: fontInfo.lineHeight, // todo -> duplicated in styling readOnly: readOnly, wordSeparators: String(opts.wordSeparators), @@ -347,7 +348,7 @@ class InternalEditorOptionsHelper { }); } - private static _sanitizeScrollbarOpts(raw: editorCommon.IEditorScrollbarOptions, mouseWheelScrollSensitivity: number): editorCommon.InternalEditorScrollbarOptions { + private static _sanitizeScrollbarOpts(raw: editorOptions.IEditorScrollbarOptions, mouseWheelScrollSensitivity: number): editorOptions.InternalEditorScrollbarOptions { let visibilityFromString = (visibility: string) => { switch (visibility) { @@ -362,7 +363,7 @@ class InternalEditorOptionsHelper { let horizontalScrollbarSize = toIntegerWithDefault(raw.horizontalScrollbarSize, 10); let verticalScrollbarSize = toIntegerWithDefault(raw.verticalScrollbarSize, 14); - return new editorCommon.InternalEditorScrollbarOptions({ + return new editorOptions.InternalEditorScrollbarOptions({ vertical: visibilityFromString(raw.vertical), horizontal: visibilityFromString(raw.horizontal), @@ -383,12 +384,12 @@ class InternalEditorOptionsHelper { }); } - private static _sanitizeMinimapOpts(raw: editorCommon.IEditorMinimapOptions): editorCommon.InternalEditorMinimapOptions { + private static _sanitizeMinimapOpts(raw: editorOptions.IEditorMinimapOptions): editorOptions.InternalEditorMinimapOptions { let maxColumn = toIntegerWithDefault(raw.maxColumn, DefaultConfig.editor.minimap.maxColumn); if (maxColumn < 1) { maxColumn = 1; } - return new editorCommon.InternalEditorMinimapOptions({ + return new editorOptions.InternalEditorMinimapOptions({ enabled: toBooleanWithDefault(raw.enabled, DefaultConfig.editor.minimap.enabled), renderCharacters: toBooleanWithDefault(raw.renderCharacters, DefaultConfig.editor.minimap.renderCharacters), maxColumn: maxColumn, @@ -435,48 +436,48 @@ function toSortedIntegerArray(source: any): number[] { return r; } -function wrappingIndentFromString(wrappingIndent: string): editorCommon.WrappingIndent { +function wrappingIndentFromString(wrappingIndent: string): editorOptions.WrappingIndent { if (wrappingIndent === 'indent') { - return editorCommon.WrappingIndent.Indent; + return editorOptions.WrappingIndent.Indent; } else if (wrappingIndent === 'same') { - return editorCommon.WrappingIndent.Same; + return editorOptions.WrappingIndent.Same; } else { - return editorCommon.WrappingIndent.None; + return editorOptions.WrappingIndent.None; } } -function cursorStyleFromString(cursorStyle: string): editorCommon.TextEditorCursorStyle { +function cursorStyleFromString(cursorStyle: string): editorOptions.TextEditorCursorStyle { if (cursorStyle === 'line') { - return editorCommon.TextEditorCursorStyle.Line; + return editorOptions.TextEditorCursorStyle.Line; } else if (cursorStyle === 'block') { - return editorCommon.TextEditorCursorStyle.Block; + return editorOptions.TextEditorCursorStyle.Block; } else if (cursorStyle === 'underline') { - return editorCommon.TextEditorCursorStyle.Underline; + return editorOptions.TextEditorCursorStyle.Underline; } else if (cursorStyle === 'line-thin') { - return editorCommon.TextEditorCursorStyle.LineThin; + return editorOptions.TextEditorCursorStyle.LineThin; } else if (cursorStyle === 'block-outline') { - return editorCommon.TextEditorCursorStyle.BlockOutline; + return editorOptions.TextEditorCursorStyle.BlockOutline; } else if (cursorStyle === 'underline-thin') { - return editorCommon.TextEditorCursorStyle.UnderlineThin; + return editorOptions.TextEditorCursorStyle.UnderlineThin; } - return editorCommon.TextEditorCursorStyle.Line; + return editorOptions.TextEditorCursorStyle.Line; } -function cursorBlinkingStyleFromString(cursorBlinkingStyle: string): editorCommon.TextEditorCursorBlinkingStyle { +function cursorBlinkingStyleFromString(cursorBlinkingStyle: string): editorOptions.TextEditorCursorBlinkingStyle { switch (cursorBlinkingStyle) { case 'blink': - return editorCommon.TextEditorCursorBlinkingStyle.Blink; + return editorOptions.TextEditorCursorBlinkingStyle.Blink; case 'smooth': - return editorCommon.TextEditorCursorBlinkingStyle.Smooth; + return editorOptions.TextEditorCursorBlinkingStyle.Smooth; case 'phase': - return editorCommon.TextEditorCursorBlinkingStyle.Phase; + return editorOptions.TextEditorCursorBlinkingStyle.Phase; case 'expand': - return editorCommon.TextEditorCursorBlinkingStyle.Expand; + return editorOptions.TextEditorCursorBlinkingStyle.Expand; case 'visible': // maintain compatibility case 'solid': - return editorCommon.TextEditorCursorBlinkingStyle.Solid; + return editorOptions.TextEditorCursorBlinkingStyle.Solid; } - return editorCommon.TextEditorCursorBlinkingStyle.Blink; + return editorOptions.TextEditorCursorBlinkingStyle.Blink; } function toIntegerWithDefault(source: any, defaultValue: number): number { @@ -496,18 +497,18 @@ export interface IElementSizeObserver { export abstract class CommonEditorConfiguration extends Disposable implements editorCommon.IConfiguration { - public editor: editorCommon.InternalEditorOptions; - public editorClone: editorCommon.InternalEditorOptions; + public editor: editorOptions.InternalEditorOptions; + public editorClone: editorOptions.InternalEditorOptions; protected _configWithDefaults: ConfigurationWithDefaults; protected _elementSizeObserver: IElementSizeObserver; private _isDominatedByLongLines: boolean; private _lineNumbersDigitCount: number; - private _onDidChange = this._register(new Emitter()); - public onDidChange: Event = this._onDidChange.event; + private _onDidChange = this._register(new Emitter()); + public onDidChange: Event = this._onDidChange.event; - constructor(options: editorCommon.IEditorOptions, elementSizeObserver: IElementSizeObserver = null) { + constructor(options: editorOptions.IEditorOptions, elementSizeObserver: IElementSizeObserver = null) { super(); this._configWithDefaults = new ConfigurationWithDefaults(options); this._elementSizeObserver = elementSizeObserver; @@ -527,7 +528,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed this._setOptions(this._computeInternalOptions()); } - private _setOptions(newOptions: editorCommon.InternalEditorOptions): void { + private _setOptions(newOptions: editorOptions.InternalEditorOptions): void { if (this.editor && this.editor.equals(newOptions)) { return; } @@ -538,11 +539,11 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed this._onDidChange.fire(changeEvent); } - public getRawOptions(): editorCommon.IEditorOptions { + public getRawOptions(): editorOptions.IEditorOptions { return this._configWithDefaults.getEditorOptions(); } - private _computeInternalOptions(): editorCommon.InternalEditorOptions { + private _computeInternalOptions(): editorOptions.InternalEditorOptions { let opts = this._configWithDefaults.getEditorOptions(); let editorClassName = this._getEditorClassName(opts.theme, toBoolean(opts.fontLigatures), opts.mouseStyle); @@ -568,7 +569,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed ); } - public updateOptions(newOptions: editorCommon.IEditorOptions): void { + public updateOptions(newOptions: editorOptions.IEditorOptions): void { this._configWithDefaults.updateOptions(newOptions); this._recomputeOptions(); } diff --git a/src/vs/editor/common/config/defaultConfig.ts b/src/vs/editor/common/config/defaultConfig.ts index 8c178305c52..bea58575f21 100644 --- a/src/vs/editor/common/config/defaultConfig.ts +++ b/src/vs/editor/common/config/defaultConfig.ts @@ -5,9 +5,9 @@ 'use strict'; import * as nls from 'vs/nls'; -import { IEditorOptions } from 'vs/editor/common/editorCommon'; import * as platform from 'vs/base/common/platform'; import { USUAL_WORD_SEPARATORS } from 'vs/editor/common/model/wordHelper'; +import { IEditorOptions } from "vs/editor/common/config/editorOptions"; export interface IConfiguration { editor: IEditorOptions; diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts new file mode 100644 index 00000000000..e8bee72579b --- /dev/null +++ b/src/vs/editor/common/config/editorOptions.ts @@ -0,0 +1,1498 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +import { ScrollbarVisibility } from 'vs/base/common/scrollable'; +import { FontInfo } from 'vs/editor/common/config/fontInfo'; +import * as objects from 'vs/base/common/objects'; + +/** + * Configuration options for editor scrollbars + */ +export interface IEditorScrollbarOptions { + /** + * The size of arrows (if displayed). + * Defaults to 11. + */ + arrowSize?: number; + /** + * Render vertical scrollbar. + * Accepted values: 'auto', 'visible', 'hidden'. + * Defaults to 'auto'. + */ + vertical?: string; + /** + * Render horizontal scrollbar. + * Accepted values: 'auto', 'visible', 'hidden'. + * Defaults to 'auto'. + */ + horizontal?: string; + /** + * Cast horizontal and vertical shadows when the content is scrolled. + * Defaults to true. + */ + useShadows?: boolean; + /** + * Render arrows at the top and bottom of the vertical scrollbar. + * Defaults to false. + */ + verticalHasArrows?: boolean; + /** + * Render arrows at the left and right of the horizontal scrollbar. + * Defaults to false. + */ + horizontalHasArrows?: boolean; + /** + * Listen to mouse wheel events and react to them by scrolling. + * Defaults to true. + */ + handleMouseWheel?: boolean; + /** + * Height in pixels for the horizontal scrollbar. + * Defaults to 10 (px). + */ + horizontalScrollbarSize?: number; + /** + * Width in pixels for the vertical scrollbar. + * Defaults to 10 (px). + */ + verticalScrollbarSize?: number; + /** + * Width in pixels for the vertical slider. + * Defaults to `verticalScrollbarSize`. + */ + verticalSliderSize?: number; + /** + * Height in pixels for the horizontal slider. + * Defaults to `horizontalScrollbarSize`. + */ + horizontalSliderSize?: number; +} + +/** + * Configuration options for editor minimap + */ +export interface IEditorMinimapOptions { + /** + * Enable the rendering of the minimap. + * Defaults to false. + */ + enabled?: boolean; + /** + * Render the actual text on a line (as opposed to color blocks). + * Defaults to true. + */ + renderCharacters?: boolean; + /** + * Limit the width of the minimap to render at most a certain number of columns. + * Defaults to 120. + */ + maxColumn?: number; +} + +export type LineNumbersOption = 'on' | 'off' | 'relative' | ((lineNumber: number) => string); + +/** + * Configuration options for the editor. + */ +export interface IEditorOptions { + /** + * This editor is used inside a diff editor. + * @internal + */ + inDiffEditor?: boolean; + /** + * Enable experimental screen reader support. + * Defaults to `true`. + */ + experimentalScreenReader?: boolean; + /** + * The aria label for the editor's textarea (when it is focused). + */ + ariaLabel?: string; + /** + * Render vertical lines at the specified columns. + * Defaults to empty array. + */ + rulers?: number[]; + /** + * A string containing the word separators used when doing word navigation. + * Defaults to `~!@#$%^&*()-=+[{]}\\|;:\'",.<>/? + */ + wordSeparators?: string; + /** + * Enable Linux primary clipboard. + * Defaults to true. + */ + selectionClipboard?: boolean; + /** + * Control the rendering of line numbers. + * If it is a function, it will be invoked when rendering a line number and the return value will be rendered. + * Otherwise, if it is a truey, line numbers will be rendered normally (equivalent of using an identity function). + * Otherwise, line numbers will not be rendered. + * Defaults to true. + */ + lineNumbers?: LineNumbersOption; + /** + * Should the corresponding line be selected when clicking on the line number? + * Defaults to true. + */ + selectOnLineNumbers?: boolean; + /** + * Control the width of line numbers, by reserving horizontal space for rendering at least an amount of digits. + * Defaults to 5. + */ + lineNumbersMinChars?: number; + /** + * Enable the rendering of the glyph margin. + * Defaults to true in vscode and to false in monaco-editor. + */ + glyphMargin?: boolean; + /** + * The width reserved for line decorations (in px). + * Line decorations are placed between line numbers and the editor content. + * You can pass in a string in the format floating point followed by "ch". e.g. 1.3ch. + * Defaults to 10. + */ + lineDecorationsWidth?: number | string; + /** + * When revealing the cursor, a virtual padding (px) is added to the cursor, turning it into a rectangle. + * This virtual padding ensures that the cursor gets revealed before hitting the edge of the viewport. + * Defaults to 30 (px). + */ + revealHorizontalRightPadding?: number; + /** + * Render the editor selection with rounded borders. + * Defaults to true. + */ + roundedSelection?: boolean; + /** + * Theme to be used for rendering. + * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'. + * You can create custom themes via `monaco.editor.defineTheme`. + */ + theme?: string; + /** + * Should the editor be read only. + * Defaults to false. + */ + readOnly?: boolean; + /** + * Control the behavior and rendering of the scrollbars. + */ + scrollbar?: IEditorScrollbarOptions; + /** + * Control the behavior and rendering of the minimap. + */ + minimap?: IEditorMinimapOptions; + /** + * Display overflow widgets as `fixed`. + * Defaults to `false`. + */ + fixedOverflowWidgets?: boolean; + /** + * The number of vertical lanes the overview ruler should render. + * Defaults to 2. + */ + overviewRulerLanes?: number; + /** + * Controls if a border should be drawn around the overview ruler. + * Defaults to `true`. + */ + overviewRulerBorder?: boolean; + /** + * Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'. + * Defaults to 'blink'. + */ + cursorBlinking?: string; + /** + * Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl. + * Defaults to false. + */ + mouseWheelZoom?: boolean; + /** + * Control the mouse pointer style, either 'text' or 'default' or 'copy' + * Defaults to 'text' + * @internal + */ + mouseStyle?: 'text' | 'default' | 'copy'; + /** + * Control the cursor style, either 'block' or 'line'. + * Defaults to 'line'. + */ + cursorStyle?: string; + /** + * Enable font ligatures. + * Defaults to false. + */ + fontLigatures?: boolean; + /** + * Disable the use of `translate3d`. + * Defaults to false. + */ + disableTranslate3d?: boolean; + /** + * Disable the optimizations for monospace fonts. + * Defaults to false. + */ + disableMonospaceOptimizations?: boolean; + /** + * Should the cursor be hidden in the overview ruler. + * Defaults to false. + */ + hideCursorInOverviewRuler?: boolean; + /** + * Enable that scrolling can go one screen size after the last line. + * Defaults to true. + */ + scrollBeyondLastLine?: boolean; + /** + * Enable that the editor will install an interval to check if its container dom node size has changed. + * Enabling this might have a severe performance impact. + * Defaults to false. + */ + automaticLayout?: boolean; + /** + * Control the wrapping of the editor. + * When `wordWrap` = "off", the lines will never wrap. + * When `wordWrap` = "on", the lines will wrap at the viewport width. + * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`. + * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn). + * Defaults to "off". + */ + wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded'; + /** + * Control the wrapping of the editor. + * When `wordWrap` = "off", the lines will never wrap. + * When `wordWrap` = "on", the lines will wrap at the viewport width. + * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`. + * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn). + * Defaults to 80. + */ + wordWrapColumn?: number; + /** + * Force word wrapping when the text appears to be of a minified/generated file. + * Defaults to true. + */ + wordWrapMinified?: boolean; + /** + * Control indentation of wrapped lines. Can be: 'none', 'same' or 'indent'. + * Defaults to 'same' in vscode and to 'none' in monaco-editor. + */ + wrappingIndent?: string; + /** + * Configure word wrapping characters. A break will be introduced before these characters. + * Defaults to '{([+'. + */ + wordWrapBreakBeforeCharacters?: string; + /** + * Configure word wrapping characters. A break will be introduced after these characters. + * Defaults to ' \t})]?|&,;'. + */ + wordWrapBreakAfterCharacters?: string; + /** + * Configure word wrapping characters. A break will be introduced after these characters only if no `wordWrapBreakBeforeCharacters` or `wordWrapBreakAfterCharacters` were found. + * Defaults to '.'. + */ + wordWrapBreakObtrusiveCharacters?: string; + + /** + * Performance guard: Stop rendering a line after x characters. + * Defaults to 10000. + * Use -1 to never stop rendering + */ + stopRenderingLineAfter?: number; + /** + * Enable hover. + * Defaults to true. + */ + hover?: boolean; + /** + * Enable custom contextmenu. + * Defaults to true. + */ + contextmenu?: boolean; + /** + * A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events. + * Defaults to 1. + */ + mouseWheelScrollSensitivity?: number; + /** + * Enable quick suggestions (shadow suggestions) + * Defaults to true. + */ + quickSuggestions?: boolean | { other: boolean, comments: boolean, strings: boolean }; + /** + * Quick suggestions show delay (in ms) + * Defaults to 500 (ms) + */ + quickSuggestionsDelay?: number; + /** + * Enables parameter hints + */ + parameterHints?: boolean; + /** + * Render icons in suggestions box. + * Defaults to true. + */ + iconsInSuggestions?: boolean; + /** + * Enable auto closing brackets. + * Defaults to true. + */ + autoClosingBrackets?: boolean; + /** + * Enable format on type. + * Defaults to false. + */ + formatOnType?: boolean; + /** + * Enable format on paste. + * Defaults to false. + */ + formatOnPaste?: boolean; + /** + * Controls if the editor should allow to move selections via drag and drop. + * Defaults to false. + */ + dragAndDrop?: boolean; + /** + * Enable the suggestion box to pop-up on trigger characters. + * Defaults to true. + */ + suggestOnTriggerCharacters?: boolean; + /** + * Accept suggestions on ENTER. + * Defaults to true. + */ + acceptSuggestionOnEnter?: boolean; + /** + * Accept suggestions on provider defined characters. + * Defaults to true. + */ + acceptSuggestionOnCommitCharacter?: boolean; + /** + * Enable snippet suggestions. Default to 'true'. + */ + snippetSuggestions?: 'top' | 'bottom' | 'inline' | 'none'; + /** + * Copying without a selection copies the current line. + */ + emptySelectionClipboard?: boolean; + /** + * Enable word based suggestions. Defaults to 'true' + */ + wordBasedSuggestions?: boolean; + /** + * The font size for the suggest widget. + * Defaults to the editor font size. + */ + suggestFontSize?: number; + /** + * The line height for the suggest widget. + * Defaults to the editor line height. + */ + suggestLineHeight?: number; + /** + * Enable selection highlight. + * Defaults to true. + */ + selectionHighlight?: boolean; + /** + * Enable semantic occurrences highlight. + * Defaults to true. + */ + occurrencesHighlight?: boolean; + /** + * Show code lens + * Defaults to true. + */ + codeLens?: boolean; + /** + * @deprecated - use codeLens instead + * @internal + */ + referenceInfos?: boolean; + /** + * Enable code folding + * Defaults to true in vscode and to false in monaco-editor. + */ + folding?: boolean; + /** + * Enable highlighting of matching brackets. + * Defaults to true. + */ + matchBrackets?: boolean; + /** + * Enable rendering of whitespace. + * Defaults to none. + */ + renderWhitespace?: 'none' | 'boundary' | 'all'; + /** + * Enable rendering of control characters. + * Defaults to false. + */ + renderControlCharacters?: boolean; + /** + * Enable rendering of indent guides. + * Defaults to false. + */ + renderIndentGuides?: boolean; + /** + * Enable rendering of current line highlight. + * Defaults to all. + */ + renderLineHighlight?: 'none' | 'gutter' | 'line' | 'all'; + /** + * Inserting and deleting whitespace follows tab stops. + */ + useTabStops?: boolean; + /** + * The font family + */ + fontFamily?: string; + /** + * The font weight + */ + fontWeight?: 'normal' | 'bold' | 'bolder' | 'lighter' | 'initial' | 'inherit' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'; + /** + * The font size + */ + fontSize?: number; + /** + * The line height + */ + lineHeight?: number; +} + +/** + * Configuration options for the diff editor. + */ +export interface IDiffEditorOptions extends IEditorOptions { + /** + * Allow the user to resize the diff editor split view. + * Defaults to true. + */ + enableSplitViewResizing?: boolean; + /** + * Render the differences in two side-by-side editors. + * Defaults to true. + */ + renderSideBySide?: boolean; + /** + * Compute the diff by ignoring leading/trailing whitespace + * Defaults to true. + */ + ignoreTrimWhitespace?: boolean; + /** + * Render +/- indicators for added/deleted changes. + * Defaults to true. + */ + renderIndicators?: boolean; + /** + * Original model should be editable? + * Defaults to false. + */ + originalEditable?: boolean; +} + +export enum RenderMinimap { + None = 0, + Small = 1, + Large = 2, + SmallBlocks = 3, + LargeBlocks = 4, +} + +/** + * Describes how to indent wrapped lines. + */ +export enum WrappingIndent { + /** + * No indentation => wrapped lines begin at column 1. + */ + None = 0, + /** + * Same => wrapped lines get the same indentation as the parent. + */ + Same = 1, + /** + * Indent => wrapped lines get +1 indentation as the parent. + */ + Indent = 2 +} + +/** + * The kind of animation in which the editor's cursor should be rendered. + */ +export enum TextEditorCursorBlinkingStyle { + /** + * Hidden + */ + Hidden = 0, + /** + * Blinking + */ + Blink = 1, + /** + * Blinking with smooth fading + */ + Smooth = 2, + /** + * Blinking with prolonged filled state and smooth fading + */ + Phase = 3, + /** + * Expand collapse animation on the y axis + */ + Expand = 4, + /** + * No-Blinking + */ + Solid = 5 +} + +/** + * The style in which the editor's cursor should be rendered. + */ +export enum TextEditorCursorStyle { + /** + * As a vertical line (sitting between two characters). + */ + Line = 1, + /** + * As a block (sitting on top of a character). + */ + Block = 2, + /** + * As a horizontal line (sitting under a character). + */ + Underline = 3, + /** + * As a thin vertical line (sitting between two characters). + */ + LineThin = 4, + /** + * As an outlined block (sitting on top of a character). + */ + BlockOutline = 5, + /** + * As a thin horizontal line (sitting under a character). + */ + UnderlineThin = 6 +} + +/** + * @internal + */ +export function cursorStyleToString(cursorStyle: TextEditorCursorStyle): string { + if (cursorStyle === TextEditorCursorStyle.Line) { + return 'line'; + } else if (cursorStyle === TextEditorCursorStyle.Block) { + return 'block'; + } else if (cursorStyle === TextEditorCursorStyle.Underline) { + return 'underline'; + } else if (cursorStyle === TextEditorCursorStyle.LineThin) { + return 'line-thin'; + } else if (cursorStyle === TextEditorCursorStyle.BlockOutline) { + return 'block-outline'; + } else if (cursorStyle === TextEditorCursorStyle.UnderlineThin) { + return 'underline-thin'; + } else { + throw new Error('cursorStyleToString: Unknown cursorStyle'); + } +} + +export class InternalEditorScrollbarOptions { + readonly _internalEditorScrollbarOptionsBrand: void; + + readonly arrowSize: number; + readonly vertical: ScrollbarVisibility; + readonly horizontal: ScrollbarVisibility; + readonly useShadows: boolean; + readonly verticalHasArrows: boolean; + readonly horizontalHasArrows: boolean; + readonly handleMouseWheel: boolean; + readonly horizontalScrollbarSize: number; + readonly horizontalSliderSize: number; + readonly verticalScrollbarSize: number; + readonly verticalSliderSize: number; + readonly mouseWheelScrollSensitivity: number; + + /** + * @internal + */ + constructor(source: { + arrowSize: number; + vertical: ScrollbarVisibility; + horizontal: ScrollbarVisibility; + useShadows: boolean; + verticalHasArrows: boolean; + horizontalHasArrows: boolean; + handleMouseWheel: boolean; + horizontalScrollbarSize: number; + horizontalSliderSize: number; + verticalScrollbarSize: number; + verticalSliderSize: number; + mouseWheelScrollSensitivity: number; + }) { + this.arrowSize = source.arrowSize | 0; + this.vertical = source.vertical | 0; + this.horizontal = source.horizontal | 0; + this.useShadows = Boolean(source.useShadows); + this.verticalHasArrows = Boolean(source.verticalHasArrows); + this.horizontalHasArrows = Boolean(source.horizontalHasArrows); + this.handleMouseWheel = Boolean(source.handleMouseWheel); + this.horizontalScrollbarSize = source.horizontalScrollbarSize | 0; + this.horizontalSliderSize = source.horizontalSliderSize | 0; + this.verticalScrollbarSize = source.verticalScrollbarSize | 0; + this.verticalSliderSize = source.verticalSliderSize | 0; + this.mouseWheelScrollSensitivity = Number(source.mouseWheelScrollSensitivity); + } + + /** + * @internal + */ + public equals(other: InternalEditorScrollbarOptions): boolean { + return ( + this.arrowSize === other.arrowSize + && this.vertical === other.vertical + && this.horizontal === other.horizontal + && this.useShadows === other.useShadows + && this.verticalHasArrows === other.verticalHasArrows + && this.horizontalHasArrows === other.horizontalHasArrows + && this.handleMouseWheel === other.handleMouseWheel + && this.horizontalScrollbarSize === other.horizontalScrollbarSize + && this.horizontalSliderSize === other.horizontalSliderSize + && this.verticalScrollbarSize === other.verticalScrollbarSize + && this.verticalSliderSize === other.verticalSliderSize + && this.mouseWheelScrollSensitivity === other.mouseWheelScrollSensitivity + ); + } + + /** + * @internal + */ + public clone(): InternalEditorScrollbarOptions { + return new InternalEditorScrollbarOptions(this); + } +} + +export class InternalEditorMinimapOptions { + readonly _internalEditorMinimapOptionsBrand: void; + + readonly enabled: boolean; + readonly renderCharacters: boolean; + readonly maxColumn: number; + + /** + * @internal + */ + constructor(source: { + enabled: boolean; + renderCharacters: boolean; + maxColumn: number; + }) { + this.enabled = Boolean(source.enabled); + this.renderCharacters = Boolean(source.renderCharacters); + this.maxColumn = source.maxColumn | 0; + } + + /** + * @internal + */ + public equals(other: InternalEditorMinimapOptions): boolean { + return ( + this.enabled === other.enabled + && this.renderCharacters === other.renderCharacters + && this.maxColumn === other.maxColumn + ); + } + + /** + * @internal + */ + public clone(): InternalEditorMinimapOptions { + return new InternalEditorMinimapOptions(this); + } +} + +export class EditorWrappingInfo { + readonly _editorWrappingInfoBrand: void; + + readonly inDiffEditor: boolean; + readonly isDominatedByLongLines: boolean; + readonly isWordWrapMinified: boolean; + readonly isViewportWrapping: boolean; + readonly wrappingColumn: number; + readonly wrappingIndent: WrappingIndent; + readonly wordWrapBreakBeforeCharacters: string; + readonly wordWrapBreakAfterCharacters: string; + readonly wordWrapBreakObtrusiveCharacters: string; + + /** + * @internal + */ + constructor(source: { + inDiffEditor: boolean; + isDominatedByLongLines: boolean; + isWordWrapMinified: boolean; + isViewportWrapping: boolean; + wrappingColumn: number; + wrappingIndent: WrappingIndent; + wordWrapBreakBeforeCharacters: string; + wordWrapBreakAfterCharacters: string; + wordWrapBreakObtrusiveCharacters: string; + }) { + this.inDiffEditor = Boolean(source.inDiffEditor); + this.isDominatedByLongLines = Boolean(source.isDominatedByLongLines); + this.isWordWrapMinified = Boolean(source.isWordWrapMinified); + this.isViewportWrapping = Boolean(source.isViewportWrapping); + this.wrappingColumn = source.wrappingColumn | 0; + this.wrappingIndent = source.wrappingIndent | 0; + this.wordWrapBreakBeforeCharacters = String(source.wordWrapBreakBeforeCharacters); + this.wordWrapBreakAfterCharacters = String(source.wordWrapBreakAfterCharacters); + this.wordWrapBreakObtrusiveCharacters = String(source.wordWrapBreakObtrusiveCharacters); + } + + /** + * @internal + */ + public equals(other: EditorWrappingInfo): boolean { + return ( + this.inDiffEditor === other.inDiffEditor + && this.isDominatedByLongLines === other.isDominatedByLongLines + && this.isWordWrapMinified === other.isWordWrapMinified + && this.isViewportWrapping === other.isViewportWrapping + && this.wrappingColumn === other.wrappingColumn + && this.wrappingIndent === other.wrappingIndent + && this.wordWrapBreakBeforeCharacters === other.wordWrapBreakBeforeCharacters + && this.wordWrapBreakAfterCharacters === other.wordWrapBreakAfterCharacters + && this.wordWrapBreakObtrusiveCharacters === other.wordWrapBreakObtrusiveCharacters + ); + } + + /** + * @internal + */ + public clone(): EditorWrappingInfo { + return new EditorWrappingInfo(this); + } +} + +export class InternalEditorViewOptions { + readonly _internalEditorViewOptionsBrand: void; + + readonly theme: string; + readonly canUseTranslate3d: boolean; + readonly disableMonospaceOptimizations: boolean; + readonly experimentalScreenReader: boolean; + readonly rulers: number[]; + readonly ariaLabel: string; + readonly renderLineNumbers: boolean; + readonly renderCustomLineNumbers: (lineNumber: number) => string; + readonly renderRelativeLineNumbers: boolean; + readonly selectOnLineNumbers: boolean; + readonly glyphMargin: boolean; + readonly revealHorizontalRightPadding: number; + readonly roundedSelection: boolean; + readonly overviewRulerLanes: number; + readonly overviewRulerBorder: boolean; + readonly cursorBlinking: TextEditorCursorBlinkingStyle; + readonly mouseWheelZoom: boolean; + readonly cursorStyle: TextEditorCursorStyle; + readonly hideCursorInOverviewRuler: boolean; + readonly scrollBeyondLastLine: boolean; + readonly editorClassName: string; + readonly stopRenderingLineAfter: number; + readonly renderWhitespace: 'none' | 'boundary' | 'all'; + readonly renderControlCharacters: boolean; + readonly fontLigatures: boolean; + readonly renderIndentGuides: boolean; + readonly renderLineHighlight: 'none' | 'gutter' | 'line' | 'all'; + readonly scrollbar: InternalEditorScrollbarOptions; + readonly minimap: InternalEditorMinimapOptions; + readonly fixedOverflowWidgets: boolean; + + /** + * @internal + */ + constructor(source: { + theme: string; + canUseTranslate3d: boolean; + disableMonospaceOptimizations: boolean; + experimentalScreenReader: boolean; + rulers: number[]; + ariaLabel: string; + renderLineNumbers: boolean; + renderCustomLineNumbers: (lineNumber: number) => string; + renderRelativeLineNumbers: boolean; + selectOnLineNumbers: boolean; + glyphMargin: boolean; + revealHorizontalRightPadding: number; + roundedSelection: boolean; + overviewRulerLanes: number; + overviewRulerBorder: boolean; + cursorBlinking: TextEditorCursorBlinkingStyle; + mouseWheelZoom: boolean; + cursorStyle: TextEditorCursorStyle; + hideCursorInOverviewRuler: boolean; + scrollBeyondLastLine: boolean; + editorClassName: string; + stopRenderingLineAfter: number; + renderWhitespace: 'none' | 'boundary' | 'all'; + renderControlCharacters: boolean; + fontLigatures: boolean; + renderIndentGuides: boolean; + renderLineHighlight: 'none' | 'gutter' | 'line' | 'all'; + scrollbar: InternalEditorScrollbarOptions; + minimap: InternalEditorMinimapOptions; + fixedOverflowWidgets: boolean; + }) { + this.theme = String(source.theme); + this.canUseTranslate3d = Boolean(source.canUseTranslate3d); + this.disableMonospaceOptimizations = Boolean(source.disableMonospaceOptimizations); + this.experimentalScreenReader = Boolean(source.experimentalScreenReader); + this.rulers = InternalEditorViewOptions._toSortedIntegerArray(source.rulers); + this.ariaLabel = String(source.ariaLabel); + this.renderLineNumbers = Boolean(source.renderLineNumbers); + this.renderCustomLineNumbers = source.renderCustomLineNumbers; + this.renderRelativeLineNumbers = Boolean(source.renderRelativeLineNumbers); + this.selectOnLineNumbers = Boolean(source.selectOnLineNumbers); + this.glyphMargin = Boolean(source.glyphMargin); + this.revealHorizontalRightPadding = source.revealHorizontalRightPadding | 0; + this.roundedSelection = Boolean(source.roundedSelection); + this.overviewRulerLanes = source.overviewRulerLanes | 0; + this.overviewRulerBorder = Boolean(source.overviewRulerBorder); + this.cursorBlinking = source.cursorBlinking | 0; + this.mouseWheelZoom = Boolean(source.mouseWheelZoom); + this.cursorStyle = source.cursorStyle | 0; + this.hideCursorInOverviewRuler = Boolean(source.hideCursorInOverviewRuler); + this.scrollBeyondLastLine = Boolean(source.scrollBeyondLastLine); + this.editorClassName = String(source.editorClassName); + this.stopRenderingLineAfter = source.stopRenderingLineAfter | 0; + this.renderWhitespace = source.renderWhitespace; + this.renderControlCharacters = Boolean(source.renderControlCharacters); + this.fontLigatures = Boolean(source.fontLigatures); + this.renderIndentGuides = Boolean(source.renderIndentGuides); + this.renderLineHighlight = source.renderLineHighlight; + this.scrollbar = source.scrollbar.clone(); + this.minimap = source.minimap.clone(); + this.fixedOverflowWidgets = Boolean(source.fixedOverflowWidgets); + } + + private static _toSortedIntegerArray(source: any): number[] { + if (!Array.isArray(source)) { + return []; + } + let arrSource = source; + let result = arrSource.map(el => { + let r = parseInt(el, 10); + if (isNaN(r)) { + return 0; + } + return r; + }); + result.sort(); + return result; + } + + 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; + } + + /** + * @internal + */ + public equals(other: InternalEditorViewOptions): boolean { + return ( + this.theme === other.theme + && this.canUseTranslate3d === other.canUseTranslate3d + && this.disableMonospaceOptimizations === other.disableMonospaceOptimizations + && this.experimentalScreenReader === other.experimentalScreenReader + && InternalEditorViewOptions._numberArraysEqual(this.rulers, other.rulers) + && this.ariaLabel === other.ariaLabel + && this.renderLineNumbers === other.renderLineNumbers + && this.renderCustomLineNumbers === other.renderCustomLineNumbers + && this.renderRelativeLineNumbers === other.renderRelativeLineNumbers + && this.selectOnLineNumbers === other.selectOnLineNumbers + && this.glyphMargin === other.glyphMargin + && this.revealHorizontalRightPadding === other.revealHorizontalRightPadding + && this.roundedSelection === other.roundedSelection + && this.overviewRulerLanes === other.overviewRulerLanes + && this.overviewRulerBorder === other.overviewRulerBorder + && this.cursorBlinking === other.cursorBlinking + && this.mouseWheelZoom === other.mouseWheelZoom + && this.cursorStyle === other.cursorStyle + && this.hideCursorInOverviewRuler === other.hideCursorInOverviewRuler + && this.scrollBeyondLastLine === other.scrollBeyondLastLine + && this.editorClassName === other.editorClassName + && this.stopRenderingLineAfter === other.stopRenderingLineAfter + && this.renderWhitespace === other.renderWhitespace + && this.renderControlCharacters === other.renderControlCharacters + && this.fontLigatures === other.fontLigatures + && this.renderIndentGuides === other.renderIndentGuides + && this.renderLineHighlight === other.renderLineHighlight + && this.scrollbar.equals(other.scrollbar) + && this.minimap.equals(other.minimap) + && this.fixedOverflowWidgets === other.fixedOverflowWidgets + ); + } + + /** + * @internal + */ + public createChangeEvent(newOpts: InternalEditorViewOptions): IViewConfigurationChangedEvent { + return { + theme: this.theme !== newOpts.theme, + canUseTranslate3d: this.canUseTranslate3d !== newOpts.canUseTranslate3d, + disableMonospaceOptimizations: this.disableMonospaceOptimizations !== newOpts.disableMonospaceOptimizations, + experimentalScreenReader: this.experimentalScreenReader !== newOpts.experimentalScreenReader, + rulers: (!InternalEditorViewOptions._numberArraysEqual(this.rulers, newOpts.rulers)), + ariaLabel: this.ariaLabel !== newOpts.ariaLabel, + renderLineNumbers: this.renderLineNumbers !== newOpts.renderLineNumbers, + renderCustomLineNumbers: this.renderCustomLineNumbers !== newOpts.renderCustomLineNumbers, + renderRelativeLineNumbers: this.renderRelativeLineNumbers !== newOpts.renderRelativeLineNumbers, + selectOnLineNumbers: this.selectOnLineNumbers !== newOpts.selectOnLineNumbers, + glyphMargin: this.glyphMargin !== newOpts.glyphMargin, + revealHorizontalRightPadding: this.revealHorizontalRightPadding !== newOpts.revealHorizontalRightPadding, + roundedSelection: this.roundedSelection !== newOpts.roundedSelection, + overviewRulerLanes: this.overviewRulerLanes !== newOpts.overviewRulerLanes, + overviewRulerBorder: this.overviewRulerBorder !== newOpts.overviewRulerBorder, + cursorBlinking: this.cursorBlinking !== newOpts.cursorBlinking, + mouseWheelZoom: this.mouseWheelZoom !== newOpts.mouseWheelZoom, + cursorStyle: this.cursorStyle !== newOpts.cursorStyle, + hideCursorInOverviewRuler: this.hideCursorInOverviewRuler !== newOpts.hideCursorInOverviewRuler, + scrollBeyondLastLine: this.scrollBeyondLastLine !== newOpts.scrollBeyondLastLine, + editorClassName: this.editorClassName !== newOpts.editorClassName, + stopRenderingLineAfter: this.stopRenderingLineAfter !== newOpts.stopRenderingLineAfter, + renderWhitespace: this.renderWhitespace !== newOpts.renderWhitespace, + renderControlCharacters: this.renderControlCharacters !== newOpts.renderControlCharacters, + fontLigatures: this.fontLigatures !== newOpts.fontLigatures, + renderIndentGuides: this.renderIndentGuides !== newOpts.renderIndentGuides, + renderLineHighlight: this.renderLineHighlight !== newOpts.renderLineHighlight, + scrollbar: (!this.scrollbar.equals(newOpts.scrollbar)), + minimap: (!this.minimap.equals(newOpts.minimap)), + fixedOverflowWidgets: this.fixedOverflowWidgets !== newOpts.fixedOverflowWidgets + }; + } + + /** + * @internal + */ + public clone(): InternalEditorViewOptions { + return new InternalEditorViewOptions(this); + } +} + +export class EditorContribOptions { + readonly selectionClipboard: boolean; + readonly hover: boolean; + readonly contextmenu: boolean; + readonly quickSuggestions: boolean | { other: boolean, comments: boolean, strings: boolean }; + readonly quickSuggestionsDelay: number; + readonly parameterHints: boolean; + readonly iconsInSuggestions: boolean; + readonly formatOnType: boolean; + readonly formatOnPaste: boolean; + readonly suggestOnTriggerCharacters: boolean; + readonly acceptSuggestionOnEnter: boolean; + readonly acceptSuggestionOnCommitCharacter: boolean; + readonly snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none'; + readonly emptySelectionClipboard: boolean; + readonly wordBasedSuggestions: boolean; + readonly suggestFontSize: number; + readonly suggestLineHeight: number; + readonly selectionHighlight: boolean; + readonly occurrencesHighlight: boolean; + readonly codeLens: boolean; + readonly folding: boolean; + readonly matchBrackets: boolean; + + /** + * @internal + */ + constructor(source: { + selectionClipboard: boolean; + hover: boolean; + contextmenu: boolean; + quickSuggestions: boolean | { other: boolean, comments: boolean, strings: boolean }; + quickSuggestionsDelay: number; + parameterHints: boolean; + iconsInSuggestions: boolean; + formatOnType: boolean; + formatOnPaste: boolean; + suggestOnTriggerCharacters: boolean; + acceptSuggestionOnEnter: boolean; + acceptSuggestionOnCommitCharacter: boolean; + snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none'; + emptySelectionClipboard: boolean; + wordBasedSuggestions: boolean; + suggestFontSize: number; + suggestLineHeight: number; + selectionHighlight: boolean; + occurrencesHighlight: boolean; + codeLens: boolean; + folding: boolean; + matchBrackets: boolean; + }) { + this.selectionClipboard = Boolean(source.selectionClipboard); + this.hover = Boolean(source.hover); + this.contextmenu = Boolean(source.contextmenu); + this.quickSuggestions = source.quickSuggestions; + this.quickSuggestionsDelay = source.quickSuggestionsDelay || 0; + this.parameterHints = Boolean(source.parameterHints); + this.iconsInSuggestions = Boolean(source.iconsInSuggestions); + this.formatOnType = Boolean(source.formatOnType); + this.formatOnPaste = Boolean(source.formatOnPaste); + this.suggestOnTriggerCharacters = Boolean(source.suggestOnTriggerCharacters); + this.acceptSuggestionOnEnter = Boolean(source.acceptSuggestionOnEnter); + this.acceptSuggestionOnCommitCharacter = Boolean(source.acceptSuggestionOnCommitCharacter); + this.snippetSuggestions = source.snippetSuggestions; + this.emptySelectionClipboard = source.emptySelectionClipboard; + this.wordBasedSuggestions = source.wordBasedSuggestions; + this.suggestFontSize = source.suggestFontSize; + this.suggestLineHeight = source.suggestLineHeight; + this.selectionHighlight = Boolean(source.selectionHighlight); + this.occurrencesHighlight = Boolean(source.occurrencesHighlight); + this.codeLens = Boolean(source.codeLens); + this.folding = Boolean(source.folding); + this.matchBrackets = Boolean(source.matchBrackets); + } + + /** + * @internal + */ + public equals(other: EditorContribOptions): boolean { + return ( + this.selectionClipboard === other.selectionClipboard + && this.hover === other.hover + && this.contextmenu === other.contextmenu + && objects.equals(this.quickSuggestions, other.quickSuggestions) + && this.quickSuggestionsDelay === other.quickSuggestionsDelay + && this.parameterHints === other.parameterHints + && this.iconsInSuggestions === other.iconsInSuggestions + && this.formatOnType === other.formatOnType + && this.formatOnPaste === other.formatOnPaste + && this.suggestOnTriggerCharacters === other.suggestOnTriggerCharacters + && this.acceptSuggestionOnEnter === other.acceptSuggestionOnEnter + && this.acceptSuggestionOnCommitCharacter === other.acceptSuggestionOnCommitCharacter + && this.snippetSuggestions === other.snippetSuggestions + && this.emptySelectionClipboard === other.emptySelectionClipboard + && objects.equals(this.wordBasedSuggestions, other.wordBasedSuggestions) + && this.suggestFontSize === other.suggestFontSize + && this.suggestLineHeight === other.suggestLineHeight + && this.selectionHighlight === other.selectionHighlight + && this.occurrencesHighlight === other.occurrencesHighlight + && this.codeLens === other.codeLens + && this.folding === other.folding + && this.matchBrackets === other.matchBrackets + ); + } + + /** + * @internal + */ + public clone(): EditorContribOptions { + return new EditorContribOptions(this); + } +} + +/** + * Internal configuration options (transformed or computed) for the editor. + */ +export class InternalEditorOptions { + readonly _internalEditorOptionsBrand: void; + + readonly lineHeight: number; // todo: move to fontInfo + + readonly readOnly: boolean; + // ---- cursor options + readonly wordSeparators: string; + readonly autoClosingBrackets: boolean; + readonly useTabStops: boolean; + readonly tabFocusMode: boolean; + readonly dragAndDrop: boolean; + // ---- grouped options + readonly layoutInfo: EditorLayoutInfo; + readonly fontInfo: FontInfo; + readonly viewInfo: InternalEditorViewOptions; + readonly wrappingInfo: EditorWrappingInfo; + readonly contribInfo: EditorContribOptions; + + /** + * @internal + */ + constructor(source: { + lineHeight: number; + readOnly: boolean; + wordSeparators: string; + autoClosingBrackets: boolean; + useTabStops: boolean; + tabFocusMode: boolean; + dragAndDrop: boolean; + layoutInfo: EditorLayoutInfo; + fontInfo: FontInfo; + viewInfo: InternalEditorViewOptions; + wrappingInfo: EditorWrappingInfo; + contribInfo: EditorContribOptions; + }) { + this.lineHeight = source.lineHeight | 0; + this.readOnly = Boolean(source.readOnly); + this.wordSeparators = String(source.wordSeparators); + this.autoClosingBrackets = Boolean(source.autoClosingBrackets); + this.useTabStops = Boolean(source.useTabStops); + this.tabFocusMode = Boolean(source.tabFocusMode); + this.dragAndDrop = Boolean(source.dragAndDrop); + this.layoutInfo = source.layoutInfo.clone(); + this.fontInfo = source.fontInfo.clone(); + this.viewInfo = source.viewInfo.clone(); + this.wrappingInfo = source.wrappingInfo.clone(); + this.contribInfo = source.contribInfo.clone(); + } + + /** + * @internal + */ + public equals(other: InternalEditorOptions): boolean { + return ( + this.lineHeight === other.lineHeight + && this.readOnly === other.readOnly + && this.wordSeparators === other.wordSeparators + && this.autoClosingBrackets === other.autoClosingBrackets + && this.useTabStops === other.useTabStops + && this.tabFocusMode === other.tabFocusMode + && this.dragAndDrop === other.dragAndDrop + && this.layoutInfo.equals(other.layoutInfo) + && this.fontInfo.equals(other.fontInfo) + && this.viewInfo.equals(other.viewInfo) + && this.wrappingInfo.equals(other.wrappingInfo) + && this.contribInfo.equals(other.contribInfo) + ); + } + + /** + * @internal + */ + public createChangeEvent(newOpts: InternalEditorOptions): IConfigurationChangedEvent { + return { + lineHeight: (this.lineHeight !== newOpts.lineHeight), + readOnly: (this.readOnly !== newOpts.readOnly), + wordSeparators: (this.wordSeparators !== newOpts.wordSeparators), + autoClosingBrackets: (this.autoClosingBrackets !== newOpts.autoClosingBrackets), + useTabStops: (this.useTabStops !== newOpts.useTabStops), + tabFocusMode: (this.tabFocusMode !== newOpts.tabFocusMode), + dragAndDrop: (this.dragAndDrop !== newOpts.dragAndDrop), + layoutInfo: (!this.layoutInfo.equals(newOpts.layoutInfo)), + fontInfo: (!this.fontInfo.equals(newOpts.fontInfo)), + viewInfo: this.viewInfo.createChangeEvent(newOpts.viewInfo), + wrappingInfo: (!this.wrappingInfo.equals(newOpts.wrappingInfo)), + contribInfo: (!this.contribInfo.equals(newOpts.contribInfo)), + }; + } + + /** + * @internal + */ + public clone(): InternalEditorOptions { + return new InternalEditorOptions(this); + } +} + +/** + * A description for the overview ruler position. + */ +export class OverviewRulerPosition { + readonly _overviewRulerPositionBrand: void; + + /** + * Width of the overview ruler + */ + readonly width: number; + /** + * Height of the overview ruler + */ + readonly height: number; + /** + * Top position for the overview ruler + */ + readonly top: number; + /** + * Right position for the overview ruler + */ + readonly right: number; + + /** + * @internal + */ + constructor(source: { + width: number; + height: number; + top: number; + right: number; + }) { + this.width = source.width | 0; + this.height = source.height | 0; + this.top = source.top | 0; + this.right = source.right | 0; + } + + /** + * @internal + */ + public equals(other: OverviewRulerPosition): boolean { + return ( + this.width === other.width + && this.height === other.height + && this.top === other.top + && this.right === other.right + ); + } + + /** + * @internal + */ + public clone(): OverviewRulerPosition { + return new OverviewRulerPosition(this); + } +} + +/** + * The internal layout details of the editor. + */ +export class EditorLayoutInfo { + readonly _editorLayoutInfoBrand: void; + + /** + * Full editor width. + */ + readonly width: number; + /** + * Full editor height. + */ + readonly height: number; + + /** + * Left position for the glyph margin. + */ + readonly glyphMarginLeft: number; + /** + * The width of the glyph margin. + */ + readonly glyphMarginWidth: number; + /** + * The height of the glyph margin. + */ + readonly glyphMarginHeight: number; + + /** + * Left position for the line numbers. + */ + readonly lineNumbersLeft: number; + /** + * The width of the line numbers. + */ + readonly lineNumbersWidth: number; + /** + * The height of the line numbers. + */ + readonly lineNumbersHeight: number; + + /** + * Left position for the line decorations. + */ + readonly decorationsLeft: number; + /** + * The width of the line decorations. + */ + readonly decorationsWidth: number; + /** + * The height of the line decorations. + */ + readonly decorationsHeight: number; + + /** + * Left position for the content (actual text) + */ + readonly contentLeft: number; + /** + * The width of the content (actual text) + */ + readonly contentWidth: number; + /** + * The height of the content (actual height) + */ + readonly contentHeight: number; + + /** + * The width of the minimap + */ + readonly minimapWidth: number; + + /** + * Minimap render type + */ + readonly renderMinimap: RenderMinimap; + + /** + * The number of columns (of typical characters) fitting on a viewport line. + */ + readonly viewportColumn: number; + + /** + * The width of the vertical scrollbar. + */ + readonly verticalScrollbarWidth: number; + /** + * The height of the horizontal scrollbar. + */ + readonly horizontalScrollbarHeight: number; + + /** + * The position of the overview ruler. + */ + readonly overviewRuler: OverviewRulerPosition; + + /** + * @internal + */ + constructor(source: { + width: number; + height: number; + glyphMarginLeft: number; + glyphMarginWidth: number; + glyphMarginHeight: number; + lineNumbersLeft: number; + lineNumbersWidth: number; + lineNumbersHeight: number; + decorationsLeft: number; + decorationsWidth: number; + decorationsHeight: number; + contentLeft: number; + contentWidth: number; + contentHeight: number; + renderMinimap: RenderMinimap; + minimapWidth: number; + viewportColumn: number; + verticalScrollbarWidth: number; + horizontalScrollbarHeight: number; + overviewRuler: OverviewRulerPosition; + }) { + this.width = source.width | 0; + this.height = source.height | 0; + this.glyphMarginLeft = source.glyphMarginLeft | 0; + this.glyphMarginWidth = source.glyphMarginWidth | 0; + this.glyphMarginHeight = source.glyphMarginHeight | 0; + this.lineNumbersLeft = source.lineNumbersLeft | 0; + this.lineNumbersWidth = source.lineNumbersWidth | 0; + this.lineNumbersHeight = source.lineNumbersHeight | 0; + this.decorationsLeft = source.decorationsLeft | 0; + this.decorationsWidth = source.decorationsWidth | 0; + this.decorationsHeight = source.decorationsHeight | 0; + this.contentLeft = source.contentLeft | 0; + this.contentWidth = source.contentWidth | 0; + this.contentHeight = source.contentHeight | 0; + this.renderMinimap = source.renderMinimap | 0; + this.minimapWidth = source.minimapWidth | 0; + this.viewportColumn = source.viewportColumn | 0; + this.verticalScrollbarWidth = source.verticalScrollbarWidth | 0; + this.horizontalScrollbarHeight = source.horizontalScrollbarHeight | 0; + this.overviewRuler = source.overviewRuler.clone(); + } + + /** + * @internal + */ + public equals(other: EditorLayoutInfo): boolean { + return ( + this.width === other.width + && this.height === other.height + && this.glyphMarginLeft === other.glyphMarginLeft + && this.glyphMarginWidth === other.glyphMarginWidth + && this.glyphMarginHeight === other.glyphMarginHeight + && this.lineNumbersLeft === other.lineNumbersLeft + && this.lineNumbersWidth === other.lineNumbersWidth + && this.lineNumbersHeight === other.lineNumbersHeight + && this.decorationsLeft === other.decorationsLeft + && this.decorationsWidth === other.decorationsWidth + && this.decorationsHeight === other.decorationsHeight + && this.contentLeft === other.contentLeft + && this.contentWidth === other.contentWidth + && this.contentHeight === other.contentHeight + && this.renderMinimap === other.renderMinimap + && this.minimapWidth === other.minimapWidth + && this.viewportColumn === other.viewportColumn + && this.verticalScrollbarWidth === other.verticalScrollbarWidth + && this.horizontalScrollbarHeight === other.horizontalScrollbarHeight + && this.overviewRuler.equals(other.overviewRuler) + ); + } + + /** + * @internal + */ + public clone(): EditorLayoutInfo { + return new EditorLayoutInfo(this); + } +} + +export interface IViewConfigurationChangedEvent { + readonly theme: boolean; + readonly canUseTranslate3d: boolean; + readonly disableMonospaceOptimizations: boolean; + readonly experimentalScreenReader: boolean; + readonly rulers: boolean; + readonly ariaLabel: boolean; + readonly renderLineNumbers: boolean; + readonly renderCustomLineNumbers: boolean; + readonly renderRelativeLineNumbers: boolean; + readonly selectOnLineNumbers: boolean; + readonly glyphMargin: boolean; + readonly revealHorizontalRightPadding: boolean; + readonly roundedSelection: boolean; + readonly overviewRulerLanes: boolean; + readonly overviewRulerBorder: boolean; + readonly cursorBlinking: boolean; + readonly mouseWheelZoom: boolean; + readonly cursorStyle: boolean; + readonly hideCursorInOverviewRuler: boolean; + readonly scrollBeyondLastLine: boolean; + readonly editorClassName: boolean; + readonly stopRenderingLineAfter: boolean; + readonly renderWhitespace: boolean; + readonly renderControlCharacters: boolean; + readonly fontLigatures: boolean; + readonly renderIndentGuides: boolean; + readonly renderLineHighlight: boolean; + readonly scrollbar: boolean; + readonly minimap: boolean; + readonly fixedOverflowWidgets: boolean; +} + +/** + * An event describing that the configuration of the editor has changed. + */ +export interface IConfigurationChangedEvent { + readonly lineHeight: boolean; + readonly readOnly: boolean; + readonly wordSeparators: boolean; + readonly autoClosingBrackets: boolean; + readonly useTabStops: boolean; + readonly tabFocusMode: boolean; + readonly dragAndDrop: boolean; + readonly layoutInfo: boolean; + readonly fontInfo: boolean; + readonly viewInfo: IViewConfigurationChangedEvent; + readonly wrappingInfo: boolean; + readonly contribInfo: boolean; +} diff --git a/src/vs/editor/common/controller/cursorCommon.ts b/src/vs/editor/common/controller/cursorCommon.ts index 9d45df6d603..1b4621c8de5 100644 --- a/src/vs/editor/common/controller/cursorCommon.ts +++ b/src/vs/editor/common/controller/cursorCommon.ts @@ -7,7 +7,7 @@ import { Position } from 'vs/editor/common/core/position'; import { CharCode } from 'vs/base/common/charCode'; import * as strings from 'vs/base/common/strings'; -import { ICommand, IConfigurationChangedEvent, TextModelResolvedOptions, IConfiguration } from 'vs/editor/common/editorCommon'; +import { ICommand, TextModelResolvedOptions, IConfiguration } from 'vs/editor/common/editorCommon'; import { TextModel } from 'vs/editor/common/model/textModel'; import { Selection } from 'vs/editor/common/core/selection'; import { Range } from 'vs/editor/common/core/range'; @@ -15,6 +15,7 @@ import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageCo import { onUnexpectedError } from 'vs/base/common/errors'; import { LanguageIdentifier } from 'vs/editor/common/modes'; import { IAutoClosingPair } from 'vs/editor/common/modes/languageConfiguration'; +import { IConfigurationChangedEvent } from "vs/editor/common/config/editorOptions"; export interface CharacterMap { [char: string]: string; diff --git a/src/vs/editor/common/editorCommon.ts b/src/vs/editor/common/editorCommon.ts index 5f1dec56076..b543d79b355 100644 --- a/src/vs/editor/common/editorCommon.ts +++ b/src/vs/editor/common/editorCommon.ts @@ -7,13 +7,11 @@ import { BulkListenerCallback } from 'vs/base/common/eventEmitter'; import { MarkedString } from 'vs/base/common/htmlContent'; import * as types from 'vs/base/common/types'; -import * as objects from 'vs/base/common/objects'; import URI from 'vs/base/common/uri'; import { TPromise } from 'vs/base/common/winjs.base'; import { ServicesAccessor, IConstructorSignature1 } from 'vs/platform/instantiation/common/instantiation'; import { LanguageId, LanguageIdentifier, StandardTokenType } from 'vs/editor/common/modes'; import { LineTokens } from 'vs/editor/common/core/lineTokens'; -import { ScrollbarVisibility } from 'vs/base/common/scrollable'; import { IDisposable } from 'vs/base/common/lifecycle'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; @@ -21,12 +19,12 @@ import { Selection } from 'vs/editor/common/core/selection'; import { IndentRange } from 'vs/editor/common/model/indentRanges'; import { ICommandHandlerDescription } from 'vs/platform/commands/common/commands'; import { ContextKeyExpr, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; -import { FontInfo } from 'vs/editor/common/config/fontInfo'; import { ITextSource } from 'vs/editor/common/model/textSource'; import { ModelRawContentChangedEvent, IModelContentChangedEvent, IModelDecorationsChangedEvent, IModelLanguageChangedEvent, IModelOptionsChangedEvent } from 'vs/editor/common/model/textModelEvents'; +import * as editorOptions from "vs/editor/common/config/editorOptions"; /** * @internal @@ -96,1170 +94,6 @@ export interface ISelection { readonly positionColumn: number; } -/** - * Configuration options for editor scrollbars - */ -export interface IEditorScrollbarOptions { - /** - * The size of arrows (if displayed). - * Defaults to 11. - */ - arrowSize?: number; - /** - * Render vertical scrollbar. - * Accepted values: 'auto', 'visible', 'hidden'. - * Defaults to 'auto'. - */ - vertical?: string; - /** - * Render horizontal scrollbar. - * Accepted values: 'auto', 'visible', 'hidden'. - * Defaults to 'auto'. - */ - horizontal?: string; - /** - * Cast horizontal and vertical shadows when the content is scrolled. - * Defaults to true. - */ - useShadows?: boolean; - /** - * Render arrows at the top and bottom of the vertical scrollbar. - * Defaults to false. - */ - verticalHasArrows?: boolean; - /** - * Render arrows at the left and right of the horizontal scrollbar. - * Defaults to false. - */ - horizontalHasArrows?: boolean; - /** - * Listen to mouse wheel events and react to them by scrolling. - * Defaults to true. - */ - handleMouseWheel?: boolean; - /** - * Height in pixels for the horizontal scrollbar. - * Defaults to 10 (px). - */ - horizontalScrollbarSize?: number; - /** - * Width in pixels for the vertical scrollbar. - * Defaults to 10 (px). - */ - verticalScrollbarSize?: number; - /** - * Width in pixels for the vertical slider. - * Defaults to `verticalScrollbarSize`. - */ - verticalSliderSize?: number; - /** - * Height in pixels for the horizontal slider. - * Defaults to `horizontalScrollbarSize`. - */ - horizontalSliderSize?: number; -} - - -/** - * Configuration options for editor minimap - */ -export interface IEditorMinimapOptions { - /** - * Enable the rendering of the minimap. - * Defaults to false. - */ - enabled?: boolean; - /** - * Render the actual text on a line (as opposed to color blocks). - * Defaults to true. - */ - renderCharacters?: boolean; - /** - * Limit the width of the minimap to render at most a certain number of columns. - * Defaults to 120. - */ - maxColumn?: number; -} - -/** - * Describes how to indent wrapped lines. - */ -export enum WrappingIndent { - /** - * No indentation => wrapped lines begin at column 1. - */ - None = 0, - /** - * Same => wrapped lines get the same indentation as the parent. - */ - Same = 1, - /** - * Indent => wrapped lines get +1 indentation as the parent. - */ - Indent = 2 -} - -export type LineNumbersOption = 'on' | 'off' | 'relative' | ((lineNumber: number) => string); - -/** - * Configuration options for the editor. - */ -export interface IEditorOptions { - /** - * This editor is used inside a diff editor. - * @internal - */ - inDiffEditor?: boolean; - /** - * Enable experimental screen reader support. - * Defaults to `true`. - */ - experimentalScreenReader?: boolean; - /** - * The aria label for the editor's textarea (when it is focused). - */ - ariaLabel?: string; - /** - * Render vertical lines at the specified columns. - * Defaults to empty array. - */ - rulers?: number[]; - /** - * A string containing the word separators used when doing word navigation. - * Defaults to `~!@#$%^&*()-=+[{]}\\|;:\'",.<>/? - */ - wordSeparators?: string; - /** - * Enable Linux primary clipboard. - * Defaults to true. - */ - selectionClipboard?: boolean; - /** - * Control the rendering of line numbers. - * If it is a function, it will be invoked when rendering a line number and the return value will be rendered. - * Otherwise, if it is a truey, line numbers will be rendered normally (equivalent of using an identity function). - * Otherwise, line numbers will not be rendered. - * Defaults to true. - */ - lineNumbers?: LineNumbersOption; - /** - * Should the corresponding line be selected when clicking on the line number? - * Defaults to true. - */ - selectOnLineNumbers?: boolean; - /** - * Control the width of line numbers, by reserving horizontal space for rendering at least an amount of digits. - * Defaults to 5. - */ - lineNumbersMinChars?: number; - /** - * Enable the rendering of the glyph margin. - * Defaults to true in vscode and to false in monaco-editor. - */ - glyphMargin?: boolean; - /** - * The width reserved for line decorations (in px). - * Line decorations are placed between line numbers and the editor content. - * You can pass in a string in the format floating point followed by "ch". e.g. 1.3ch. - * Defaults to 10. - */ - lineDecorationsWidth?: number | string; - /** - * When revealing the cursor, a virtual padding (px) is added to the cursor, turning it into a rectangle. - * This virtual padding ensures that the cursor gets revealed before hitting the edge of the viewport. - * Defaults to 30 (px). - */ - revealHorizontalRightPadding?: number; - /** - * Render the editor selection with rounded borders. - * Defaults to true. - */ - roundedSelection?: boolean; - /** - * Theme to be used for rendering. - * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'. - * You can create custom themes via `monaco.editor.defineTheme`. - */ - theme?: string; - /** - * Should the editor be read only. - * Defaults to false. - */ - readOnly?: boolean; - /** - * Control the behavior and rendering of the scrollbars. - */ - scrollbar?: IEditorScrollbarOptions; - /** - * Control the behavior and rendering of the minimap. - */ - minimap?: IEditorMinimapOptions; - /** - * Display overflow widgets as `fixed`. - * Defaults to `false`. - */ - fixedOverflowWidgets?: boolean; - /** - * The number of vertical lanes the overview ruler should render. - * Defaults to 2. - */ - overviewRulerLanes?: number; - /** - * Controls if a border should be drawn around the overview ruler. - * Defaults to `true`. - */ - overviewRulerBorder?: boolean; - /** - * Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'. - * Defaults to 'blink'. - */ - cursorBlinking?: string; - /** - * Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl. - * Defaults to false. - */ - mouseWheelZoom?: boolean; - /** - * Control the mouse pointer style, either 'text' or 'default' or 'copy' - * Defaults to 'text' - * @internal - */ - mouseStyle?: 'text' | 'default' | 'copy'; - /** - * Control the cursor style, either 'block' or 'line'. - * Defaults to 'line'. - */ - cursorStyle?: string; - /** - * Enable font ligatures. - * Defaults to false. - */ - fontLigatures?: boolean; - /** - * Disable the use of `translate3d`. - * Defaults to false. - */ - disableTranslate3d?: boolean; - /** - * Disable the optimizations for monospace fonts. - * Defaults to false. - */ - disableMonospaceOptimizations?: boolean; - /** - * Should the cursor be hidden in the overview ruler. - * Defaults to false. - */ - hideCursorInOverviewRuler?: boolean; - /** - * Enable that scrolling can go one screen size after the last line. - * Defaults to true. - */ - scrollBeyondLastLine?: boolean; - /** - * Enable that the editor will install an interval to check if its container dom node size has changed. - * Enabling this might have a severe performance impact. - * Defaults to false. - */ - automaticLayout?: boolean; - /** - * Control the wrapping of the editor. - * When `wordWrap` = "off", the lines will never wrap. - * When `wordWrap` = "on", the lines will wrap at the viewport width. - * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`. - * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn). - * Defaults to "off". - */ - wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded'; - /** - * Control the wrapping of the editor. - * When `wordWrap` = "off", the lines will never wrap. - * When `wordWrap` = "on", the lines will wrap at the viewport width. - * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`. - * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn). - * Defaults to 80. - */ - wordWrapColumn?: number; - /** - * Force word wrapping when the text appears to be of a minified/generated file. - * Defaults to true. - */ - wordWrapMinified?: boolean; - /** - * Control indentation of wrapped lines. Can be: 'none', 'same' or 'indent'. - * Defaults to 'same' in vscode and to 'none' in monaco-editor. - */ - wrappingIndent?: string; - /** - * Configure word wrapping characters. A break will be introduced before these characters. - * Defaults to '{([+'. - */ - wordWrapBreakBeforeCharacters?: string; - /** - * Configure word wrapping characters. A break will be introduced after these characters. - * Defaults to ' \t})]?|&,;'. - */ - wordWrapBreakAfterCharacters?: string; - /** - * Configure word wrapping characters. A break will be introduced after these characters only if no `wordWrapBreakBeforeCharacters` or `wordWrapBreakAfterCharacters` were found. - * Defaults to '.'. - */ - wordWrapBreakObtrusiveCharacters?: string; - - /** - * Performance guard: Stop rendering a line after x characters. - * Defaults to 10000. - * Use -1 to never stop rendering - */ - stopRenderingLineAfter?: number; - /** - * Enable hover. - * Defaults to true. - */ - hover?: boolean; - /** - * Enable custom contextmenu. - * Defaults to true. - */ - contextmenu?: boolean; - /** - * A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events. - * Defaults to 1. - */ - mouseWheelScrollSensitivity?: number; - /** - * Enable quick suggestions (shadow suggestions) - * Defaults to true. - */ - quickSuggestions?: boolean | { other: boolean, comments: boolean, strings: boolean }; - /** - * Quick suggestions show delay (in ms) - * Defaults to 500 (ms) - */ - quickSuggestionsDelay?: number; - /** - * Enables parameter hints - */ - parameterHints?: boolean; - /** - * Render icons in suggestions box. - * Defaults to true. - */ - iconsInSuggestions?: boolean; - /** - * Enable auto closing brackets. - * Defaults to true. - */ - autoClosingBrackets?: boolean; - /** - * Enable format on type. - * Defaults to false. - */ - formatOnType?: boolean; - /** - * Enable format on paste. - * Defaults to false. - */ - formatOnPaste?: boolean; - /** - * Controls if the editor should allow to move selections via drag and drop. - * Defaults to false. - */ - dragAndDrop?: boolean; - /** - * Enable the suggestion box to pop-up on trigger characters. - * Defaults to true. - */ - suggestOnTriggerCharacters?: boolean; - /** - * Accept suggestions on ENTER. - * Defaults to true. - */ - acceptSuggestionOnEnter?: boolean; - /** - * Accept suggestions on provider defined characters. - * Defaults to true. - */ - acceptSuggestionOnCommitCharacter?: boolean; - /** - * Enable snippet suggestions. Default to 'true'. - */ - snippetSuggestions?: 'top' | 'bottom' | 'inline' | 'none'; - /** - * Copying without a selection copies the current line. - */ - emptySelectionClipboard?: boolean; - /** - * Enable word based suggestions. Defaults to 'true' - */ - wordBasedSuggestions?: boolean; - /** - * The font size for the suggest widget. - * Defaults to the editor font size. - */ - suggestFontSize?: number; - /** - * The line height for the suggest widget. - * Defaults to the editor line height. - */ - suggestLineHeight?: number; - /** - * Enable selection highlight. - * Defaults to true. - */ - selectionHighlight?: boolean; - /** - * Enable semantic occurrences highlight. - * Defaults to true. - */ - occurrencesHighlight?: boolean; - /** - * Show code lens - * Defaults to true. - */ - codeLens?: boolean; - /** - * @deprecated - use codeLens instead - * @internal - */ - referenceInfos?: boolean; - /** - * Enable code folding - * Defaults to true in vscode and to false in monaco-editor. - */ - folding?: boolean; - /** - * Enable highlighting of matching brackets. - * Defaults to true. - */ - matchBrackets?: boolean; - /** - * Enable rendering of whitespace. - * Defaults to none. - */ - renderWhitespace?: 'none' | 'boundary' | 'all'; - /** - * Enable rendering of control characters. - * Defaults to false. - */ - renderControlCharacters?: boolean; - /** - * Enable rendering of indent guides. - * Defaults to false. - */ - renderIndentGuides?: boolean; - /** - * Enable rendering of current line highlight. - * Defaults to all. - */ - renderLineHighlight?: 'none' | 'gutter' | 'line' | 'all'; - /** - * Inserting and deleting whitespace follows tab stops. - */ - useTabStops?: boolean; - /** - * The font family - */ - fontFamily?: string; - /** - * The font weight - */ - fontWeight?: 'normal' | 'bold' | 'bolder' | 'lighter' | 'initial' | 'inherit' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'; - /** - * The font size - */ - fontSize?: number; - /** - * The line height - */ - lineHeight?: number; -} - -/** - * Configuration options for the diff editor. - */ -export interface IDiffEditorOptions extends IEditorOptions { - /** - * Allow the user to resize the diff editor split view. - * Defaults to true. - */ - enableSplitViewResizing?: boolean; - /** - * Render the differences in two side-by-side editors. - * Defaults to true. - */ - renderSideBySide?: boolean; - /** - * Compute the diff by ignoring leading/trailing whitespace - * Defaults to true. - */ - ignoreTrimWhitespace?: boolean; - /** - * Render +/- indicators for added/deleted changes. - * Defaults to true. - */ - renderIndicators?: boolean; - /** - * Original model should be editable? - * Defaults to false. - */ - originalEditable?: boolean; -} - -export class InternalEditorScrollbarOptions { - readonly _internalEditorScrollbarOptionsBrand: void; - - readonly arrowSize: number; - readonly vertical: ScrollbarVisibility; - readonly horizontal: ScrollbarVisibility; - readonly useShadows: boolean; - readonly verticalHasArrows: boolean; - readonly horizontalHasArrows: boolean; - readonly handleMouseWheel: boolean; - readonly horizontalScrollbarSize: number; - readonly horizontalSliderSize: number; - readonly verticalScrollbarSize: number; - readonly verticalSliderSize: number; - readonly mouseWheelScrollSensitivity: number; - - /** - * @internal - */ - constructor(source: { - arrowSize: number; - vertical: ScrollbarVisibility; - horizontal: ScrollbarVisibility; - useShadows: boolean; - verticalHasArrows: boolean; - horizontalHasArrows: boolean; - handleMouseWheel: boolean; - horizontalScrollbarSize: number; - horizontalSliderSize: number; - verticalScrollbarSize: number; - verticalSliderSize: number; - mouseWheelScrollSensitivity: number; - }) { - this.arrowSize = source.arrowSize | 0; - this.vertical = source.vertical | 0; - this.horizontal = source.horizontal | 0; - this.useShadows = Boolean(source.useShadows); - this.verticalHasArrows = Boolean(source.verticalHasArrows); - this.horizontalHasArrows = Boolean(source.horizontalHasArrows); - this.handleMouseWheel = Boolean(source.handleMouseWheel); - this.horizontalScrollbarSize = source.horizontalScrollbarSize | 0; - this.horizontalSliderSize = source.horizontalSliderSize | 0; - this.verticalScrollbarSize = source.verticalScrollbarSize | 0; - this.verticalSliderSize = source.verticalSliderSize | 0; - this.mouseWheelScrollSensitivity = Number(source.mouseWheelScrollSensitivity); - } - - /** - * @internal - */ - public equals(other: InternalEditorScrollbarOptions): boolean { - return ( - this.arrowSize === other.arrowSize - && this.vertical === other.vertical - && this.horizontal === other.horizontal - && this.useShadows === other.useShadows - && this.verticalHasArrows === other.verticalHasArrows - && this.horizontalHasArrows === other.horizontalHasArrows - && this.handleMouseWheel === other.handleMouseWheel - && this.horizontalScrollbarSize === other.horizontalScrollbarSize - && this.horizontalSliderSize === other.horizontalSliderSize - && this.verticalScrollbarSize === other.verticalScrollbarSize - && this.verticalSliderSize === other.verticalSliderSize - && this.mouseWheelScrollSensitivity === other.mouseWheelScrollSensitivity - ); - } - - /** - * @internal - */ - public clone(): InternalEditorScrollbarOptions { - return new InternalEditorScrollbarOptions(this); - } -} - -export class InternalEditorMinimapOptions { - readonly _internalEditorMinimapOptionsBrand: void; - - readonly enabled: boolean; - readonly renderCharacters: boolean; - readonly maxColumn: number; - - /** - * @internal - */ - constructor(source: { - enabled: boolean; - renderCharacters: boolean; - maxColumn: number; - }) { - this.enabled = Boolean(source.enabled); - this.renderCharacters = Boolean(source.renderCharacters); - this.maxColumn = source.maxColumn | 0; - } - - /** - * @internal - */ - public equals(other: InternalEditorMinimapOptions): boolean { - return ( - this.enabled === other.enabled - && this.renderCharacters === other.renderCharacters - && this.maxColumn === other.maxColumn - ); - } - - /** - * @internal - */ - public clone(): InternalEditorMinimapOptions { - return new InternalEditorMinimapOptions(this); - } -} - -export class EditorWrappingInfo { - readonly _editorWrappingInfoBrand: void; - - readonly inDiffEditor: boolean; - readonly isDominatedByLongLines: boolean; - readonly isWordWrapMinified: boolean; - readonly isViewportWrapping: boolean; - readonly wrappingColumn: number; - readonly wrappingIndent: WrappingIndent; - readonly wordWrapBreakBeforeCharacters: string; - readonly wordWrapBreakAfterCharacters: string; - readonly wordWrapBreakObtrusiveCharacters: string; - - /** - * @internal - */ - constructor(source: { - inDiffEditor: boolean; - isDominatedByLongLines: boolean; - isWordWrapMinified: boolean; - isViewportWrapping: boolean; - wrappingColumn: number; - wrappingIndent: WrappingIndent; - wordWrapBreakBeforeCharacters: string; - wordWrapBreakAfterCharacters: string; - wordWrapBreakObtrusiveCharacters: string; - }) { - this.inDiffEditor = Boolean(source.inDiffEditor); - this.isDominatedByLongLines = Boolean(source.isDominatedByLongLines); - this.isWordWrapMinified = Boolean(source.isWordWrapMinified); - this.isViewportWrapping = Boolean(source.isViewportWrapping); - this.wrappingColumn = source.wrappingColumn | 0; - this.wrappingIndent = source.wrappingIndent | 0; - this.wordWrapBreakBeforeCharacters = String(source.wordWrapBreakBeforeCharacters); - this.wordWrapBreakAfterCharacters = String(source.wordWrapBreakAfterCharacters); - this.wordWrapBreakObtrusiveCharacters = String(source.wordWrapBreakObtrusiveCharacters); - } - - /** - * @internal - */ - public equals(other: EditorWrappingInfo): boolean { - return ( - this.inDiffEditor === other.inDiffEditor - && this.isDominatedByLongLines === other.isDominatedByLongLines - && this.isWordWrapMinified === other.isWordWrapMinified - && this.isViewportWrapping === other.isViewportWrapping - && this.wrappingColumn === other.wrappingColumn - && this.wrappingIndent === other.wrappingIndent - && this.wordWrapBreakBeforeCharacters === other.wordWrapBreakBeforeCharacters - && this.wordWrapBreakAfterCharacters === other.wordWrapBreakAfterCharacters - && this.wordWrapBreakObtrusiveCharacters === other.wordWrapBreakObtrusiveCharacters - ); - } - - /** - * @internal - */ - public clone(): EditorWrappingInfo { - return new EditorWrappingInfo(this); - } -} - -export class InternalEditorViewOptions { - readonly _internalEditorViewOptionsBrand: void; - - readonly theme: string; - readonly canUseTranslate3d: boolean; - readonly disableMonospaceOptimizations: boolean; - readonly experimentalScreenReader: boolean; - readonly rulers: number[]; - readonly ariaLabel: string; - readonly renderLineNumbers: boolean; - readonly renderCustomLineNumbers: (lineNumber: number) => string; - readonly renderRelativeLineNumbers: boolean; - readonly selectOnLineNumbers: boolean; - readonly glyphMargin: boolean; - readonly revealHorizontalRightPadding: number; - readonly roundedSelection: boolean; - readonly overviewRulerLanes: number; - readonly overviewRulerBorder: boolean; - readonly cursorBlinking: TextEditorCursorBlinkingStyle; - readonly mouseWheelZoom: boolean; - readonly cursorStyle: TextEditorCursorStyle; - readonly hideCursorInOverviewRuler: boolean; - readonly scrollBeyondLastLine: boolean; - readonly editorClassName: string; - readonly stopRenderingLineAfter: number; - readonly renderWhitespace: 'none' | 'boundary' | 'all'; - readonly renderControlCharacters: boolean; - readonly fontLigatures: boolean; - readonly renderIndentGuides: boolean; - readonly renderLineHighlight: 'none' | 'gutter' | 'line' | 'all'; - readonly scrollbar: InternalEditorScrollbarOptions; - readonly minimap: InternalEditorMinimapOptions; - readonly fixedOverflowWidgets: boolean; - - /** - * @internal - */ - constructor(source: { - theme: string; - canUseTranslate3d: boolean; - disableMonospaceOptimizations: boolean; - experimentalScreenReader: boolean; - rulers: number[]; - ariaLabel: string; - renderLineNumbers: boolean; - renderCustomLineNumbers: (lineNumber: number) => string; - renderRelativeLineNumbers: boolean; - selectOnLineNumbers: boolean; - glyphMargin: boolean; - revealHorizontalRightPadding: number; - roundedSelection: boolean; - overviewRulerLanes: number; - overviewRulerBorder: boolean; - cursorBlinking: TextEditorCursorBlinkingStyle; - mouseWheelZoom: boolean; - cursorStyle: TextEditorCursorStyle; - hideCursorInOverviewRuler: boolean; - scrollBeyondLastLine: boolean; - editorClassName: string; - stopRenderingLineAfter: number; - renderWhitespace: 'none' | 'boundary' | 'all'; - renderControlCharacters: boolean; - fontLigatures: boolean; - renderIndentGuides: boolean; - renderLineHighlight: 'none' | 'gutter' | 'line' | 'all'; - scrollbar: InternalEditorScrollbarOptions; - minimap: InternalEditorMinimapOptions; - fixedOverflowWidgets: boolean; - }) { - this.theme = String(source.theme); - this.canUseTranslate3d = Boolean(source.canUseTranslate3d); - this.disableMonospaceOptimizations = Boolean(source.disableMonospaceOptimizations); - this.experimentalScreenReader = Boolean(source.experimentalScreenReader); - this.rulers = InternalEditorViewOptions._toSortedIntegerArray(source.rulers); - this.ariaLabel = String(source.ariaLabel); - this.renderLineNumbers = Boolean(source.renderLineNumbers); - this.renderCustomLineNumbers = source.renderCustomLineNumbers; - this.renderRelativeLineNumbers = Boolean(source.renderRelativeLineNumbers); - this.selectOnLineNumbers = Boolean(source.selectOnLineNumbers); - this.glyphMargin = Boolean(source.glyphMargin); - this.revealHorizontalRightPadding = source.revealHorizontalRightPadding | 0; - this.roundedSelection = Boolean(source.roundedSelection); - this.overviewRulerLanes = source.overviewRulerLanes | 0; - this.overviewRulerBorder = Boolean(source.overviewRulerBorder); - this.cursorBlinking = source.cursorBlinking | 0; - this.mouseWheelZoom = Boolean(source.mouseWheelZoom); - this.cursorStyle = source.cursorStyle | 0; - this.hideCursorInOverviewRuler = Boolean(source.hideCursorInOverviewRuler); - this.scrollBeyondLastLine = Boolean(source.scrollBeyondLastLine); - this.editorClassName = String(source.editorClassName); - this.stopRenderingLineAfter = source.stopRenderingLineAfter | 0; - this.renderWhitespace = source.renderWhitespace; - this.renderControlCharacters = Boolean(source.renderControlCharacters); - this.fontLigatures = Boolean(source.fontLigatures); - this.renderIndentGuides = Boolean(source.renderIndentGuides); - this.renderLineHighlight = source.renderLineHighlight; - this.scrollbar = source.scrollbar.clone(); - this.minimap = source.minimap.clone(); - this.fixedOverflowWidgets = Boolean(source.fixedOverflowWidgets); - } - - private static _toSortedIntegerArray(source: any): number[] { - if (!Array.isArray(source)) { - return []; - } - let arrSource = source; - let result = arrSource.map(el => { - let r = parseInt(el, 10); - if (isNaN(r)) { - return 0; - } - return r; - }); - result.sort(); - return result; - } - - 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; - } - - /** - * @internal - */ - public equals(other: InternalEditorViewOptions): boolean { - return ( - this.theme === other.theme - && this.canUseTranslate3d === other.canUseTranslate3d - && this.disableMonospaceOptimizations === other.disableMonospaceOptimizations - && this.experimentalScreenReader === other.experimentalScreenReader - && InternalEditorViewOptions._numberArraysEqual(this.rulers, other.rulers) - && this.ariaLabel === other.ariaLabel - && this.renderLineNumbers === other.renderLineNumbers - && this.renderCustomLineNumbers === other.renderCustomLineNumbers - && this.renderRelativeLineNumbers === other.renderRelativeLineNumbers - && this.selectOnLineNumbers === other.selectOnLineNumbers - && this.glyphMargin === other.glyphMargin - && this.revealHorizontalRightPadding === other.revealHorizontalRightPadding - && this.roundedSelection === other.roundedSelection - && this.overviewRulerLanes === other.overviewRulerLanes - && this.overviewRulerBorder === other.overviewRulerBorder - && this.cursorBlinking === other.cursorBlinking - && this.mouseWheelZoom === other.mouseWheelZoom - && this.cursorStyle === other.cursorStyle - && this.hideCursorInOverviewRuler === other.hideCursorInOverviewRuler - && this.scrollBeyondLastLine === other.scrollBeyondLastLine - && this.editorClassName === other.editorClassName - && this.stopRenderingLineAfter === other.stopRenderingLineAfter - && this.renderWhitespace === other.renderWhitespace - && this.renderControlCharacters === other.renderControlCharacters - && this.fontLigatures === other.fontLigatures - && this.renderIndentGuides === other.renderIndentGuides - && this.renderLineHighlight === other.renderLineHighlight - && this.scrollbar.equals(other.scrollbar) - && this.minimap.equals(other.minimap) - && this.fixedOverflowWidgets === other.fixedOverflowWidgets - ); - } - - /** - * @internal - */ - public createChangeEvent(newOpts: InternalEditorViewOptions): IViewConfigurationChangedEvent { - return { - theme: this.theme !== newOpts.theme, - canUseTranslate3d: this.canUseTranslate3d !== newOpts.canUseTranslate3d, - disableMonospaceOptimizations: this.disableMonospaceOptimizations !== newOpts.disableMonospaceOptimizations, - experimentalScreenReader: this.experimentalScreenReader !== newOpts.experimentalScreenReader, - rulers: (!InternalEditorViewOptions._numberArraysEqual(this.rulers, newOpts.rulers)), - ariaLabel: this.ariaLabel !== newOpts.ariaLabel, - renderLineNumbers: this.renderLineNumbers !== newOpts.renderLineNumbers, - renderCustomLineNumbers: this.renderCustomLineNumbers !== newOpts.renderCustomLineNumbers, - renderRelativeLineNumbers: this.renderRelativeLineNumbers !== newOpts.renderRelativeLineNumbers, - selectOnLineNumbers: this.selectOnLineNumbers !== newOpts.selectOnLineNumbers, - glyphMargin: this.glyphMargin !== newOpts.glyphMargin, - revealHorizontalRightPadding: this.revealHorizontalRightPadding !== newOpts.revealHorizontalRightPadding, - roundedSelection: this.roundedSelection !== newOpts.roundedSelection, - overviewRulerLanes: this.overviewRulerLanes !== newOpts.overviewRulerLanes, - overviewRulerBorder: this.overviewRulerBorder !== newOpts.overviewRulerBorder, - cursorBlinking: this.cursorBlinking !== newOpts.cursorBlinking, - mouseWheelZoom: this.mouseWheelZoom !== newOpts.mouseWheelZoom, - cursorStyle: this.cursorStyle !== newOpts.cursorStyle, - hideCursorInOverviewRuler: this.hideCursorInOverviewRuler !== newOpts.hideCursorInOverviewRuler, - scrollBeyondLastLine: this.scrollBeyondLastLine !== newOpts.scrollBeyondLastLine, - editorClassName: this.editorClassName !== newOpts.editorClassName, - stopRenderingLineAfter: this.stopRenderingLineAfter !== newOpts.stopRenderingLineAfter, - renderWhitespace: this.renderWhitespace !== newOpts.renderWhitespace, - renderControlCharacters: this.renderControlCharacters !== newOpts.renderControlCharacters, - fontLigatures: this.fontLigatures !== newOpts.fontLigatures, - renderIndentGuides: this.renderIndentGuides !== newOpts.renderIndentGuides, - renderLineHighlight: this.renderLineHighlight !== newOpts.renderLineHighlight, - scrollbar: (!this.scrollbar.equals(newOpts.scrollbar)), - minimap: (!this.minimap.equals(newOpts.minimap)), - fixedOverflowWidgets: this.fixedOverflowWidgets !== newOpts.fixedOverflowWidgets - }; - } - - /** - * @internal - */ - public clone(): InternalEditorViewOptions { - return new InternalEditorViewOptions(this); - } -} - -export interface IViewConfigurationChangedEvent { - readonly theme: boolean; - readonly canUseTranslate3d: boolean; - readonly disableMonospaceOptimizations: boolean; - readonly experimentalScreenReader: boolean; - readonly rulers: boolean; - readonly ariaLabel: boolean; - readonly renderLineNumbers: boolean; - readonly renderCustomLineNumbers: boolean; - readonly renderRelativeLineNumbers: boolean; - readonly selectOnLineNumbers: boolean; - readonly glyphMargin: boolean; - readonly revealHorizontalRightPadding: boolean; - readonly roundedSelection: boolean; - readonly overviewRulerLanes: boolean; - readonly overviewRulerBorder: boolean; - readonly cursorBlinking: boolean; - readonly mouseWheelZoom: boolean; - readonly cursorStyle: boolean; - readonly hideCursorInOverviewRuler: boolean; - readonly scrollBeyondLastLine: boolean; - readonly editorClassName: boolean; - readonly stopRenderingLineAfter: boolean; - readonly renderWhitespace: boolean; - readonly renderControlCharacters: boolean; - readonly fontLigatures: boolean; - readonly renderIndentGuides: boolean; - readonly renderLineHighlight: boolean; - readonly scrollbar: boolean; - readonly minimap: boolean; - readonly fixedOverflowWidgets: boolean; -} - -export class EditorContribOptions { - readonly selectionClipboard: boolean; - readonly hover: boolean; - readonly contextmenu: boolean; - readonly quickSuggestions: boolean | { other: boolean, comments: boolean, strings: boolean }; - readonly quickSuggestionsDelay: number; - readonly parameterHints: boolean; - readonly iconsInSuggestions: boolean; - readonly formatOnType: boolean; - readonly formatOnPaste: boolean; - readonly suggestOnTriggerCharacters: boolean; - readonly acceptSuggestionOnEnter: boolean; - readonly acceptSuggestionOnCommitCharacter: boolean; - readonly snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none'; - readonly emptySelectionClipboard: boolean; - readonly wordBasedSuggestions: boolean; - readonly suggestFontSize: number; - readonly suggestLineHeight: number; - readonly selectionHighlight: boolean; - readonly occurrencesHighlight: boolean; - readonly codeLens: boolean; - readonly folding: boolean; - readonly matchBrackets: boolean; - - /** - * @internal - */ - constructor(source: { - selectionClipboard: boolean; - hover: boolean; - contextmenu: boolean; - quickSuggestions: boolean | { other: boolean, comments: boolean, strings: boolean }; - quickSuggestionsDelay: number; - parameterHints: boolean; - iconsInSuggestions: boolean; - formatOnType: boolean; - formatOnPaste: boolean; - suggestOnTriggerCharacters: boolean; - acceptSuggestionOnEnter: boolean; - acceptSuggestionOnCommitCharacter: boolean; - snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none'; - emptySelectionClipboard: boolean; - wordBasedSuggestions: boolean; - suggestFontSize: number; - suggestLineHeight: number; - selectionHighlight: boolean; - occurrencesHighlight: boolean; - codeLens: boolean; - folding: boolean; - matchBrackets: boolean; - }) { - this.selectionClipboard = Boolean(source.selectionClipboard); - this.hover = Boolean(source.hover); - this.contextmenu = Boolean(source.contextmenu); - this.quickSuggestions = source.quickSuggestions; - this.quickSuggestionsDelay = source.quickSuggestionsDelay || 0; - this.parameterHints = Boolean(source.parameterHints); - this.iconsInSuggestions = Boolean(source.iconsInSuggestions); - this.formatOnType = Boolean(source.formatOnType); - this.formatOnPaste = Boolean(source.formatOnPaste); - this.suggestOnTriggerCharacters = Boolean(source.suggestOnTriggerCharacters); - this.acceptSuggestionOnEnter = Boolean(source.acceptSuggestionOnEnter); - this.acceptSuggestionOnCommitCharacter = Boolean(source.acceptSuggestionOnCommitCharacter); - this.snippetSuggestions = source.snippetSuggestions; - this.emptySelectionClipboard = source.emptySelectionClipboard; - this.wordBasedSuggestions = source.wordBasedSuggestions; - this.suggestFontSize = source.suggestFontSize; - this.suggestLineHeight = source.suggestLineHeight; - this.selectionHighlight = Boolean(source.selectionHighlight); - this.occurrencesHighlight = Boolean(source.occurrencesHighlight); - this.codeLens = Boolean(source.codeLens); - this.folding = Boolean(source.folding); - this.matchBrackets = Boolean(source.matchBrackets); - } - - /** - * @internal - */ - public equals(other: EditorContribOptions): boolean { - return ( - this.selectionClipboard === other.selectionClipboard - && this.hover === other.hover - && this.contextmenu === other.contextmenu - && objects.equals(this.quickSuggestions, other.quickSuggestions) - && this.quickSuggestionsDelay === other.quickSuggestionsDelay - && this.parameterHints === other.parameterHints - && this.iconsInSuggestions === other.iconsInSuggestions - && this.formatOnType === other.formatOnType - && this.formatOnPaste === other.formatOnPaste - && this.suggestOnTriggerCharacters === other.suggestOnTriggerCharacters - && this.acceptSuggestionOnEnter === other.acceptSuggestionOnEnter - && this.acceptSuggestionOnCommitCharacter === other.acceptSuggestionOnCommitCharacter - && this.snippetSuggestions === other.snippetSuggestions - && this.emptySelectionClipboard === other.emptySelectionClipboard - && objects.equals(this.wordBasedSuggestions, other.wordBasedSuggestions) - && this.suggestFontSize === other.suggestFontSize - && this.suggestLineHeight === other.suggestLineHeight - && this.selectionHighlight === other.selectionHighlight - && this.occurrencesHighlight === other.occurrencesHighlight - && this.codeLens === other.codeLens - && this.folding === other.folding - && this.matchBrackets === other.matchBrackets - ); - } - - /** - * @internal - */ - public clone(): EditorContribOptions { - return new EditorContribOptions(this); - } -} - -/** - * Internal configuration options (transformed or computed) for the editor. - */ -export class InternalEditorOptions { - readonly _internalEditorOptionsBrand: void; - - readonly lineHeight: number; // todo: move to fontInfo - - readonly readOnly: boolean; - // ---- cursor options - readonly wordSeparators: string; - readonly autoClosingBrackets: boolean; - readonly useTabStops: boolean; - readonly tabFocusMode: boolean; - readonly dragAndDrop: boolean; - // ---- grouped options - readonly layoutInfo: EditorLayoutInfo; - readonly fontInfo: FontInfo; - readonly viewInfo: InternalEditorViewOptions; - readonly wrappingInfo: EditorWrappingInfo; - readonly contribInfo: EditorContribOptions; - - /** - * @internal - */ - constructor(source: { - lineHeight: number; - readOnly: boolean; - wordSeparators: string; - autoClosingBrackets: boolean; - useTabStops: boolean; - tabFocusMode: boolean; - dragAndDrop: boolean; - layoutInfo: EditorLayoutInfo; - fontInfo: FontInfo; - viewInfo: InternalEditorViewOptions; - wrappingInfo: EditorWrappingInfo; - contribInfo: EditorContribOptions; - }) { - this.lineHeight = source.lineHeight | 0; - this.readOnly = Boolean(source.readOnly); - this.wordSeparators = String(source.wordSeparators); - this.autoClosingBrackets = Boolean(source.autoClosingBrackets); - this.useTabStops = Boolean(source.useTabStops); - this.tabFocusMode = Boolean(source.tabFocusMode); - this.dragAndDrop = Boolean(source.dragAndDrop); - this.layoutInfo = source.layoutInfo.clone(); - this.fontInfo = source.fontInfo.clone(); - this.viewInfo = source.viewInfo.clone(); - this.wrappingInfo = source.wrappingInfo.clone(); - this.contribInfo = source.contribInfo.clone(); - } - - /** - * @internal - */ - public equals(other: InternalEditorOptions): boolean { - return ( - this.lineHeight === other.lineHeight - && this.readOnly === other.readOnly - && this.wordSeparators === other.wordSeparators - && this.autoClosingBrackets === other.autoClosingBrackets - && this.useTabStops === other.useTabStops - && this.tabFocusMode === other.tabFocusMode - && this.dragAndDrop === other.dragAndDrop - && this.layoutInfo.equals(other.layoutInfo) - && this.fontInfo.equals(other.fontInfo) - && this.viewInfo.equals(other.viewInfo) - && this.wrappingInfo.equals(other.wrappingInfo) - && this.contribInfo.equals(other.contribInfo) - ); - } - - /** - * @internal - */ - public createChangeEvent(newOpts: InternalEditorOptions): IConfigurationChangedEvent { - return { - lineHeight: (this.lineHeight !== newOpts.lineHeight), - readOnly: (this.readOnly !== newOpts.readOnly), - wordSeparators: (this.wordSeparators !== newOpts.wordSeparators), - autoClosingBrackets: (this.autoClosingBrackets !== newOpts.autoClosingBrackets), - useTabStops: (this.useTabStops !== newOpts.useTabStops), - tabFocusMode: (this.tabFocusMode !== newOpts.tabFocusMode), - dragAndDrop: (this.dragAndDrop !== newOpts.dragAndDrop), - layoutInfo: (!this.layoutInfo.equals(newOpts.layoutInfo)), - fontInfo: (!this.fontInfo.equals(newOpts.fontInfo)), - viewInfo: this.viewInfo.createChangeEvent(newOpts.viewInfo), - wrappingInfo: (!this.wrappingInfo.equals(newOpts.wrappingInfo)), - contribInfo: (!this.contribInfo.equals(newOpts.contribInfo)), - }; - } - - /** - * @internal - */ - public clone(): InternalEditorOptions { - return new InternalEditorOptions(this); - } -} - -/** - * An event describing that the configuration of the editor has changed. - */ -export interface IConfigurationChangedEvent { - readonly lineHeight: boolean; - readonly readOnly: boolean; - readonly wordSeparators: boolean; - readonly autoClosingBrackets: boolean; - readonly useTabStops: boolean; - readonly tabFocusMode: boolean; - readonly dragAndDrop: boolean; - readonly layoutInfo: boolean; - readonly fontInfo: boolean; - readonly viewInfo: IViewConfigurationChangedEvent; - readonly wrappingInfo: boolean; - readonly contribInfo: boolean; -} - /** * Vertical Lane in the overview ruler of the editor. */ @@ -2591,255 +1425,12 @@ export interface IEditorWhitespace { readonly heightInLines: number; } -/** - * A description for the overview ruler position. - */ -export class OverviewRulerPosition { - readonly _overviewRulerPositionBrand: void; - /** - * Width of the overview ruler - */ - readonly width: number; - /** - * Height of the overview ruler - */ - readonly height: number; - /** - * Top position for the overview ruler - */ - readonly top: number; - /** - * Right position for the overview ruler - */ - readonly right: number; - - /** - * @internal - */ - constructor(source: { - width: number; - height: number; - top: number; - right: number; - }) { - this.width = source.width | 0; - this.height = source.height | 0; - this.top = source.top | 0; - this.right = source.right | 0; - } - - /** - * @internal - */ - public equals(other: OverviewRulerPosition): boolean { - return ( - this.width === other.width - && this.height === other.height - && this.top === other.top - && this.right === other.right - ); - } - - /** - * @internal - */ - public clone(): OverviewRulerPosition { - return new OverviewRulerPosition(this); - } -} - -export enum RenderMinimap { - None = 0, - Small = 1, - Large = 2, - SmallBlocks = 3, - LargeBlocks = 4, -} - -/** - * The internal layout details of the editor. - */ -export class EditorLayoutInfo { - readonly _editorLayoutInfoBrand: void; - - /** - * Full editor width. - */ - readonly width: number; - /** - * Full editor height. - */ - readonly height: number; - - /** - * Left position for the glyph margin. - */ - readonly glyphMarginLeft: number; - /** - * The width of the glyph margin. - */ - readonly glyphMarginWidth: number; - /** - * The height of the glyph margin. - */ - readonly glyphMarginHeight: number; - - /** - * Left position for the line numbers. - */ - readonly lineNumbersLeft: number; - /** - * The width of the line numbers. - */ - readonly lineNumbersWidth: number; - /** - * The height of the line numbers. - */ - readonly lineNumbersHeight: number; - - /** - * Left position for the line decorations. - */ - readonly decorationsLeft: number; - /** - * The width of the line decorations. - */ - readonly decorationsWidth: number; - /** - * The height of the line decorations. - */ - readonly decorationsHeight: number; - - /** - * Left position for the content (actual text) - */ - readonly contentLeft: number; - /** - * The width of the content (actual text) - */ - readonly contentWidth: number; - /** - * The height of the content (actual height) - */ - readonly contentHeight: number; - - /** - * The width of the minimap - */ - readonly minimapWidth: number; - - /** - * Minimap render type - */ - readonly renderMinimap: RenderMinimap; - - /** - * The number of columns (of typical characters) fitting on a viewport line. - */ - readonly viewportColumn: number; - - /** - * The width of the vertical scrollbar. - */ - readonly verticalScrollbarWidth: number; - /** - * The height of the horizontal scrollbar. - */ - readonly horizontalScrollbarHeight: number; - - /** - * The position of the overview ruler. - */ - readonly overviewRuler: OverviewRulerPosition; - - /** - * @internal - */ - constructor(source: { - width: number; - height: number; - glyphMarginLeft: number; - glyphMarginWidth: number; - glyphMarginHeight: number; - lineNumbersLeft: number; - lineNumbersWidth: number; - lineNumbersHeight: number; - decorationsLeft: number; - decorationsWidth: number; - decorationsHeight: number; - contentLeft: number; - contentWidth: number; - contentHeight: number; - renderMinimap: RenderMinimap; - minimapWidth: number; - viewportColumn: number; - verticalScrollbarWidth: number; - horizontalScrollbarHeight: number; - overviewRuler: OverviewRulerPosition; - }) { - this.width = source.width | 0; - this.height = source.height | 0; - this.glyphMarginLeft = source.glyphMarginLeft | 0; - this.glyphMarginWidth = source.glyphMarginWidth | 0; - this.glyphMarginHeight = source.glyphMarginHeight | 0; - this.lineNumbersLeft = source.lineNumbersLeft | 0; - this.lineNumbersWidth = source.lineNumbersWidth | 0; - this.lineNumbersHeight = source.lineNumbersHeight | 0; - this.decorationsLeft = source.decorationsLeft | 0; - this.decorationsWidth = source.decorationsWidth | 0; - this.decorationsHeight = source.decorationsHeight | 0; - this.contentLeft = source.contentLeft | 0; - this.contentWidth = source.contentWidth | 0; - this.contentHeight = source.contentHeight | 0; - this.renderMinimap = source.renderMinimap | 0; - this.minimapWidth = source.minimapWidth | 0; - this.viewportColumn = source.viewportColumn | 0; - this.verticalScrollbarWidth = source.verticalScrollbarWidth | 0; - this.horizontalScrollbarHeight = source.horizontalScrollbarHeight | 0; - this.overviewRuler = source.overviewRuler.clone(); - } - - /** - * @internal - */ - public equals(other: EditorLayoutInfo): boolean { - return ( - this.width === other.width - && this.height === other.height - && this.glyphMarginLeft === other.glyphMarginLeft - && this.glyphMarginWidth === other.glyphMarginWidth - && this.glyphMarginHeight === other.glyphMarginHeight - && this.lineNumbersLeft === other.lineNumbersLeft - && this.lineNumbersWidth === other.lineNumbersWidth - && this.lineNumbersHeight === other.lineNumbersHeight - && this.decorationsLeft === other.decorationsLeft - && this.decorationsWidth === other.decorationsWidth - && this.decorationsHeight === other.decorationsHeight - && this.contentLeft === other.contentLeft - && this.contentWidth === other.contentWidth - && this.contentHeight === other.contentHeight - && this.renderMinimap === other.renderMinimap - && this.minimapWidth === other.minimapWidth - && this.viewportColumn === other.viewportColumn - && this.verticalScrollbarWidth === other.verticalScrollbarWidth - && this.horizontalScrollbarHeight === other.horizontalScrollbarHeight - && this.overviewRuler.equals(other.overviewRuler) - ); - } - - /** - * @internal - */ - public clone(): EditorLayoutInfo { - return new EditorLayoutInfo(this); - } -} /** * Options for creating the editor. */ -export interface ICodeEditorWidgetCreationOptions extends IEditorOptions { +export interface ICodeEditorWidgetCreationOptions extends editorOptions.IEditorOptions { /** * The initial model associated with this code editor. */ @@ -3135,9 +1726,9 @@ export namespace ModeContextKeys { * @internal */ export interface IConfiguration { - readonly onDidChange: Event; + readonly onDidChange: Event; - readonly editor: InternalEditorOptions; + readonly editor: editorOptions.InternalEditorOptions; setMaxLineNumber(maxLineNumber: number): void; } @@ -3283,7 +1874,7 @@ export interface IEditor { /** * Update the editor's options after the editor has been created. */ - updateOptions(newOptions: IEditorOptions): void; + updateOptions(newOptions: editorOptions.IEditorOptions): void; /** * Indicates that the editor becomes visible. @@ -3630,7 +2221,7 @@ export interface ICommonCodeEditor extends IEditor { * An event emitted when the configuration of the editor has changed. (e.g. `editor.updateOptions()`) * @event */ - onDidChangeConfiguration(listener: (e: IConfigurationChangedEvent) => void): IDisposable; + onDidChangeConfiguration(listener: (e: editorOptions.IConfigurationChangedEvent) => void): IDisposable; /** * An event emitted when the cursor position has changed. * @event @@ -3724,13 +2315,13 @@ export interface ICommonCodeEditor extends IEditor { /** * Returns the current editor's configuration */ - getConfiguration(): InternalEditorOptions; + getConfiguration(): editorOptions.InternalEditorOptions; /** * Returns the 'raw' editor's configuration, as it was applied over the defaults, but without any computed members. * @internal */ - getRawConfiguration(): IEditorOptions; + getRawConfiguration(): editorOptions.IEditorOptions; /** * Get value of the current model attached to this editor. @@ -3833,7 +2424,7 @@ export interface ICommonCodeEditor extends IEditor { /** * Get the layout info for the editor. */ - getLayoutInfo(): EditorLayoutInfo; + getLayoutInfo(): editorOptions.EditorLayoutInfo; /** * @internal @@ -4274,86 +2865,7 @@ export var Handler = { RevealLine: 'revealLine' }; -/** - * The style in which the editor's cursor should be rendered. - */ -export enum TextEditorCursorStyle { - /** - * As a vertical line (sitting between two characters). - */ - Line = 1, - /** - * As a block (sitting on top of a character). - */ - Block = 2, - /** - * As a horizontal line (sitting under a character). - */ - Underline = 3, - /** - * As a thin vertical line (sitting between two characters). - */ - LineThin = 4, - /** - * As an outlined block (sitting on top of a character). - */ - BlockOutline = 5, - /** - * As a thin horizontal line (sitting under a character). - */ - UnderlineThin = 6 -} -/** - * The kind of animation in which the editor's cursor should be rendered. - */ -export enum TextEditorCursorBlinkingStyle { - /** - * Hidden - */ - Hidden = 0, - /** - * Blinking - */ - Blink = 1, - /** - * Blinking with smooth fading - */ - Smooth = 2, - /** - * Blinking with prolonged filled state and smooth fading - */ - Phase = 3, - /** - * Expand collapse animation on the y axis - */ - Expand = 4, - /** - * No-Blinking - */ - Solid = 5 -} - -/** - * @internal - */ -export function cursorStyleToString(cursorStyle: TextEditorCursorStyle): string { - if (cursorStyle === TextEditorCursorStyle.Line) { - return 'line'; - } else if (cursorStyle === TextEditorCursorStyle.Block) { - return 'block'; - } else if (cursorStyle === TextEditorCursorStyle.Underline) { - return 'underline'; - } else if (cursorStyle === TextEditorCursorStyle.LineThin) { - return 'line-thin'; - } else if (cursorStyle === TextEditorCursorStyle.BlockOutline) { - return 'block-outline'; - } else if (cursorStyle === TextEditorCursorStyle.UnderlineThin) { - return 'underline-thin'; - } else { - throw new Error('cursorStyleToString: Unknown cursorStyle'); - } -} /** * @internal diff --git a/src/vs/editor/common/services/editorWorkerServiceImpl.ts b/src/vs/editor/common/services/editorWorkerServiceImpl.ts index d4708aaf3dd..993225285c8 100644 --- a/src/vs/editor/common/services/editorWorkerServiceImpl.ts +++ b/src/vs/editor/common/services/editorWorkerServiceImpl.ts @@ -18,6 +18,7 @@ import { IModelService } from 'vs/editor/common/services/modelService'; import { EditorSimpleWorkerImpl } from 'vs/editor/common/services/editorSimpleWorker'; import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IEditorOptions } from "vs/editor/common/config/editorOptions"; /** * Stop syncing a model to the worker if it was not needed for 1 min. @@ -89,7 +90,7 @@ class WordBasedCompletionItemProvider implements modes.ISuggestSupport { provideCompletionItems(model: editorCommon.IModel, position: Position): TPromise { - const { wordBasedSuggestions } = this._configurationService.getConfiguration('editor'); + const { wordBasedSuggestions } = this._configurationService.getConfiguration('editor'); if (!wordBasedSuggestions) { return undefined; } diff --git a/src/vs/editor/common/view/viewEvents.ts b/src/vs/editor/common/view/viewEvents.ts index e1ed4b58480..25be320de43 100644 --- a/src/vs/editor/common/view/viewEvents.ts +++ b/src/vs/editor/common/view/viewEvents.ts @@ -4,11 +4,12 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import { VerticalRevealType, IConfigurationChangedEvent, IViewConfigurationChangedEvent } from 'vs/editor/common/editorCommon'; +import { VerticalRevealType } from 'vs/editor/common/editorCommon'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; import { ScrollEvent } from 'vs/base/common/scrollable'; +import { IViewConfigurationChangedEvent, IConfigurationChangedEvent } from "vs/editor/common/config/editorOptions"; export const enum ViewEventType { ViewConfigurationChanged = 1, diff --git a/src/vs/editor/common/viewLayout/editorLayoutProvider.ts b/src/vs/editor/common/viewLayout/editorLayoutProvider.ts index 3f81a04fc09..daf1522ab92 100644 --- a/src/vs/editor/common/viewLayout/editorLayoutProvider.ts +++ b/src/vs/editor/common/viewLayout/editorLayoutProvider.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import { RenderMinimap, EditorLayoutInfo, OverviewRulerPosition } from 'vs/editor/common/editorCommon'; +import { RenderMinimap, EditorLayoutInfo, OverviewRulerPosition } from 'vs/editor/common/config/editorOptions'; export interface IEditorLayoutProviderOpts { outerWidth: number; diff --git a/src/vs/editor/common/viewModel/characterHardWrappingLineMapper.ts b/src/vs/editor/common/viewModel/characterHardWrappingLineMapper.ts index 50fbfbe4956..b98331cb615 100644 --- a/src/vs/editor/common/viewModel/characterHardWrappingLineMapper.ts +++ b/src/vs/editor/common/viewModel/characterHardWrappingLineMapper.ts @@ -5,12 +5,12 @@ 'use strict'; import * as strings from 'vs/base/common/strings'; -import { WrappingIndent } from 'vs/editor/common/editorCommon'; import { PrefixSumComputer } from 'vs/editor/common/viewModel/prefixSumComputer'; import { ILineMapperFactory, ILineMapping, OutputPosition } from 'vs/editor/common/viewModel/splitLinesCollection'; import { CharCode } from 'vs/base/common/charCode'; import { CharacterClassifier } from 'vs/editor/common/core/characterClassifier'; import { toUint32Array } from 'vs/editor/common/core/uint'; +import { WrappingIndent } from "vs/editor/common/config/editorOptions"; const enum CharacterClass { NONE = 0, diff --git a/src/vs/editor/common/viewModel/splitLinesCollection.ts b/src/vs/editor/common/viewModel/splitLinesCollection.ts index 5de57d4e282..a33974f8dcb 100644 --- a/src/vs/editor/common/viewModel/splitLinesCollection.ts +++ b/src/vs/editor/common/viewModel/splitLinesCollection.ts @@ -11,6 +11,7 @@ import { LineTokens } from 'vs/editor/common/core/lineTokens'; import { PrefixSumComputerWithCache } from 'vs/editor/common/viewModel/prefixSumComputer'; import { ViewLineData, ViewEventsCollector } from 'vs/editor/common/viewModel/viewModel'; import * as viewEvents from 'vs/editor/common/view/viewEvents'; +import { WrappingIndent } from "vs/editor/common/config/editorOptions"; export class OutputPosition { _outputPositionBrand: void; @@ -31,7 +32,7 @@ export interface ILineMapping { } export interface ILineMapperFactory { - createLineMapping(lineText: string, tabSize: number, wrappingColumn: number, columnsForFullWidthChar: number, wrappingIndent: editorCommon.WrappingIndent): ILineMapping; + createLineMapping(lineText: string, tabSize: number, wrappingColumn: number, columnsForFullWidthChar: number, wrappingIndent: WrappingIndent): ILineMapping; } export interface IModel { @@ -320,7 +321,7 @@ export class SplitLine implements ISplitLine { } } -function createSplitLine(linePositionMapperFactory: ILineMapperFactory, text: string, tabSize: number, wrappingColumn: number, columnsForFullWidthChar: number, wrappingIndent: editorCommon.WrappingIndent, isVisible: boolean): ISplitLine { +function createSplitLine(linePositionMapperFactory: ILineMapperFactory, text: string, tabSize: number, wrappingColumn: number, columnsForFullWidthChar: number, wrappingIndent: WrappingIndent, isVisible: boolean): ISplitLine { let positionMapper = linePositionMapperFactory.createLineMapping(text, tabSize, wrappingColumn, columnsForFullWidthChar, wrappingIndent); if (positionMapper === null) { // No mapping needed @@ -340,7 +341,7 @@ export class SplitLinesCollection { private wrappingColumn: number; private columnsForFullWidthChar: number; - private wrappingIndent: editorCommon.WrappingIndent; + private wrappingIndent: WrappingIndent; private tabSize: number; private lines: ISplitLine[]; @@ -350,7 +351,7 @@ export class SplitLinesCollection { private hiddenAreasIds: string[]; - constructor(model: editorCommon.IModel, linePositionMapperFactory: ILineMapperFactory, tabSize: number, wrappingColumn: number, columnsForFullWidthChar: number, wrappingIndent: editorCommon.WrappingIndent) { + constructor(model: editorCommon.IModel, linePositionMapperFactory: ILineMapperFactory, tabSize: number, wrappingColumn: number, columnsForFullWidthChar: number, wrappingIndent: WrappingIndent) { this.model = model; this._validModelVersionId = -1; this.tabSize = tabSize; @@ -532,7 +533,7 @@ export class SplitLinesCollection { return true; } - public setWrappingIndent(eventsCollector: ViewEventsCollector, newWrappingIndent: editorCommon.WrappingIndent): boolean { + public setWrappingIndent(eventsCollector: ViewEventsCollector, newWrappingIndent: WrappingIndent): boolean { if (this.wrappingIndent === newWrappingIndent) { return false; } diff --git a/src/vs/editor/common/viewModel/viewModelImpl.ts b/src/vs/editor/common/viewModel/viewModelImpl.ts index 698338f21fe..36b03bad579 100644 --- a/src/vs/editor/common/viewModel/viewModelImpl.ts +++ b/src/vs/editor/common/viewModel/viewModelImpl.ts @@ -22,6 +22,7 @@ import * as errors from 'vs/base/common/errors'; import { MinimapTokensColorTracker } from 'vs/editor/common/view/minimapCharRenderer'; import * as textModelEvents from 'vs/editor/common/model/textModelEvents'; import { CursorEventType } from 'vs/editor/common/controller/cursor'; +import { WrappingIndent, IConfigurationChangedEvent } from "vs/editor/common/config/editorOptions"; const ConfigurationChanged = 'configurationChanged'; @@ -195,7 +196,7 @@ export class ViewModel implements IViewModel { return lineMappingChanged; } - private _onWrappingIndentChange(eventsCollector: ViewEventsCollector, newWrappingIndent: editorCommon.WrappingIndent): boolean { + private _onWrappingIndentChange(eventsCollector: ViewEventsCollector, newWrappingIndent: WrappingIndent): boolean { var lineMappingChanged = this.lines.setWrappingIndent(eventsCollector, newWrappingIndent); if (lineMappingChanged) { eventsCollector.emit(new viewEvents.ViewLineMappingChangedEvent()); @@ -406,7 +407,7 @@ export class ViewModel implements IViewModel { break; } case ConfigurationChanged: { - const e = data; + const e = data; revealPreviousCenteredModelRange = this._onWrappingIndentChange(eventsCollector, this.configuration.editor.wrappingInfo.wrappingIndent) || revealPreviousCenteredModelRange; revealPreviousCenteredModelRange = this._onWrappingColumnChange(eventsCollector, this.configuration.editor.wrappingInfo.wrappingColumn, this.configuration.editor.fontInfo.typicalFullwidthCharacterWidth / this.configuration.editor.fontInfo.typicalHalfwidthCharacterWidth) || revealPreviousCenteredModelRange; diff --git a/src/vs/editor/contrib/codelens/browser/codelens.ts b/src/vs/editor/contrib/codelens/browser/codelens.ts index 14929587abe..0cd476fe498 100644 --- a/src/vs/editor/contrib/codelens/browser/codelens.ts +++ b/src/vs/editor/contrib/codelens/browser/codelens.ts @@ -21,6 +21,7 @@ import { CodeLensProviderRegistry, CodeLensProvider, ICodeLensSymbol, Command } import * as editorBrowser from 'vs/editor/browser/editorBrowser'; import { editorContribution } from 'vs/editor/browser/editorBrowserExtensions'; import { ICodeLensData, getCodeLensData } from '../common/codelens'; +import { IConfigurationChangedEvent } from "vs/editor/common/config/editorOptions"; class CodeLensViewZone implements editorBrowser.IViewZone { @@ -352,7 +353,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution { this._globalToDispose.push(this._editor.onDidChangeModel(() => this.onModelChange())); this._globalToDispose.push(this._editor.onDidChangeModelLanguage(() => this.onModelChange())); - this._globalToDispose.push(this._editor.onDidChangeConfiguration((e: editorCommon.IConfigurationChangedEvent) => { + this._globalToDispose.push(this._editor.onDidChangeConfiguration((e: IConfigurationChangedEvent) => { let prevIsEnabled = this._isEnabled; this._isEnabled = this._editor.getConfiguration().contribInfo.codeLens; if (prevIsEnabled !== this._isEnabled) { diff --git a/src/vs/editor/contrib/find/browser/findWidget.ts b/src/vs/editor/contrib/find/browser/findWidget.ts index 17f4e4e6538..5cb6324391e 100644 --- a/src/vs/editor/contrib/find/browser/findWidget.ts +++ b/src/vs/editor/contrib/find/browser/findWidget.ts @@ -17,7 +17,6 @@ import { FindInput } from 'vs/base/browser/ui/findinput/findInput'; import { IMessage as InputBoxMessage, InputBox } from 'vs/base/browser/ui/inputbox/inputBox'; import { Widget } from 'vs/base/browser/ui/widget'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { IConfigurationChangedEvent } from 'vs/editor/common/editorCommon'; import { ICodeEditor, IOverlayWidget, IOverlayWidgetPosition, OverlayWidgetPositionPreference } from 'vs/editor/browser/editorBrowser'; import { FIND_IDS, MATCHES_LIMIT } from 'vs/editor/contrib/find/common/findModel'; import { FindReplaceState, FindReplaceStateChangedEvent } from 'vs/editor/contrib/find/common/findState'; @@ -27,6 +26,7 @@ import { CONTEXT_FIND_INPUT_FOCUSSED } from 'vs/editor/contrib/find/common/findC import { ITheme, registerThemingParticipant, IThemeService } from 'vs/platform/theme/common/themeService'; import { Color } from 'vs/base/common/color'; import { editorFindRangeHighlight, editorFindMatch, editorFindMatchHighlight, highContrastOutline, highContrastBorder, inputBackground as findInputBackground, editorWidgetBackground, inputActiveOptionBorder, editorWidgetShadow } from "vs/platform/theme/common/colorRegistry"; +import { IConfigurationChangedEvent } from "vs/editor/common/config/editorOptions"; export interface IFindController { replace(): void; diff --git a/src/vs/editor/contrib/folding/browser/folding.ts b/src/vs/editor/contrib/folding/browser/folding.ts index 9c96879117c..6a5c72cbd1b 100644 --- a/src/vs/editor/contrib/folding/browser/folding.ts +++ b/src/vs/editor/contrib/folding/browser/folding.ts @@ -23,6 +23,7 @@ import { IFoldingController, ID } from 'vs/editor/contrib/folding/common/folding import { Selection } from 'vs/editor/common/core/selection'; import EditorContextKeys = editorCommon.EditorContextKeys; +import { IConfigurationChangedEvent } from "vs/editor/common/config/editorOptions"; @editorContribution export class FoldingController implements IFoldingController { @@ -54,7 +55,7 @@ export class FoldingController implements IFoldingController { this.computeToken = 0; this.globalToDispose.push(this.editor.onDidChangeModel(() => this.onModelChanged())); - this.globalToDispose.push(this.editor.onDidChangeConfiguration((e: editorCommon.IConfigurationChangedEvent) => { + this.globalToDispose.push(this.editor.onDidChangeConfiguration((e: IConfigurationChangedEvent) => { let oldIsEnabled = this._isEnabled; this._isEnabled = this.editor.getConfiguration().contribInfo.folding; if (oldIsEnabled !== this._isEnabled) { diff --git a/src/vs/editor/contrib/hover/browser/hoverWidgets.ts b/src/vs/editor/contrib/hover/browser/hoverWidgets.ts index 4442bbe2e09..8f82e34f098 100644 --- a/src/vs/editor/contrib/hover/browser/hoverWidgets.ts +++ b/src/vs/editor/contrib/hover/browser/hoverWidgets.ts @@ -8,11 +8,12 @@ import { KeyCode } from 'vs/base/common/keyCodes'; import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { toggleClass } from 'vs/base/browser/dom'; import { Position } from 'vs/editor/common/core/position'; -import { IPosition, IConfigurationChangedEvent } from 'vs/editor/common/editorCommon'; +import { IPosition } from 'vs/editor/common/editorCommon'; import * as editorBrowser from 'vs/editor/browser/editorBrowser'; import { Widget } from 'vs/base/browser/ui/widget'; import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; +import { IConfigurationChangedEvent } from "vs/editor/common/config/editorOptions"; export class ContentHoverWidget extends Widget implements editorBrowser.IContentWidget { diff --git a/src/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.ts b/src/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.ts index 48ece853a55..8969cabc4bf 100644 --- a/src/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.ts +++ b/src/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.ts @@ -17,11 +17,12 @@ import { RunOnceScheduler } from 'vs/base/common/async'; import { onUnexpectedError } from 'vs/base/common/errors'; import Event, { Emitter, chain } from 'vs/base/common/event'; import { domEvent, stop } from 'vs/base/browser/event'; -import { ICommonCodeEditor, ICursorSelectionChangedEvent, IConfigurationChangedEvent } from 'vs/editor/common/editorCommon'; +import { ICommonCodeEditor, ICursorSelectionChangedEvent } from 'vs/editor/common/editorCommon'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { Context, provideSignatureHelp } from '../common/parameterHints'; import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement'; import { CharacterSet } from 'vs/editor/common/core/characterClassifier'; +import { IConfigurationChangedEvent } from "vs/editor/common/config/editorOptions"; const $ = dom.$; diff --git a/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts b/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts index b42dd362732..51ba98bd4e1 100644 --- a/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts +++ b/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts @@ -43,6 +43,7 @@ import { registerThemingParticipant, ITheme, IThemeService } from 'vs/platform/t import { attachListStyler } from "vs/platform/theme/common/styler"; import { alert } from 'vs/base/browser/ui/aria/aria'; import { IModelDecorationsChangedEvent } from 'vs/editor/common/model/textModelEvents'; +import { IEditorOptions } from "vs/editor/common/config/editorOptions"; class DecorationsManager implements IDisposable { @@ -594,7 +595,7 @@ export class ReferenceWidget extends PeekViewWidget { // editor container.div({ 'class': 'preview inline' }, (div: Builder) => { - var options: editorCommon.IEditorOptions = { + var options: IEditorOptions = { scrollBeyondLastLine: false, scrollbar: DefaultConfig.editor.scrollbar, overviewRulerLanes: 2, diff --git a/src/vs/editor/contrib/selectionClipboard/electron-browser/selectionClipboard.ts b/src/vs/editor/contrib/selectionClipboard/electron-browser/selectionClipboard.ts index 85db4d3f950..28f309c9f90 100644 --- a/src/vs/editor/contrib/selectionClipboard/electron-browser/selectionClipboard.ts +++ b/src/vs/editor/contrib/selectionClipboard/electron-browser/selectionClipboard.ts @@ -9,11 +9,12 @@ import { clipboard } from 'electron'; import * as platform from 'vs/base/common/platform'; import { ICodeEditor, IEditorMouseEvent } from 'vs/editor/browser/editorBrowser'; import { Disposable } from 'vs/base/common/lifecycle'; -import { EndOfLinePreference, IEditorContribution, ICursorSelectionChangedEvent, IConfigurationChangedEvent } from 'vs/editor/common/editorCommon'; +import { EndOfLinePreference, IEditorContribution, ICursorSelectionChangedEvent } from 'vs/editor/common/editorCommon'; import { editorContribution } from 'vs/editor/browser/editorBrowserExtensions'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { RunOnceScheduler } from 'vs/base/common/async'; import { Range } from 'vs/editor/common/core/range'; +import { IConfigurationChangedEvent } from "vs/editor/common/config/editorOptions"; @editorContribution export class SelectionClipboard extends Disposable implements IEditorContribution { diff --git a/src/vs/editor/contrib/suggest/browser/suggestWidget.ts b/src/vs/editor/contrib/suggest/browser/suggestWidget.ts index a78580621ba..4630952c6ed 100644 --- a/src/vs/editor/contrib/suggest/browser/suggestWidget.ts +++ b/src/vs/editor/contrib/suggest/browser/suggestWidget.ts @@ -21,7 +21,7 @@ import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableEle import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { IConfigurationChangedEvent } from 'vs/editor/common/editorCommon'; +import { IConfigurationChangedEvent } from 'vs/editor/common/config/editorOptions'; import { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition } from 'vs/editor/browser/editorBrowser'; import { Context as SuggestContext } from './suggest'; import { ICompletionItem, CompletionModel } from './completionModel'; diff --git a/src/vs/editor/contrib/zoneWidget/browser/zoneWidget.ts b/src/vs/editor/contrib/zoneWidget/browser/zoneWidget.ts index 53e525c043f..0af829a0250 100644 --- a/src/vs/editor/contrib/zoneWidget/browser/zoneWidget.ts +++ b/src/vs/editor/contrib/zoneWidget/browser/zoneWidget.ts @@ -11,10 +11,11 @@ import { Widget } from 'vs/base/browser/ui/widget'; import * as objects from 'vs/base/common/objects'; import * as dom from 'vs/base/browser/dom'; import { Sash, Orientation, IHorizontalSashLayoutProvider, ISashEvent } from 'vs/base/browser/ui/sash/sash'; -import { EditorLayoutInfo, IPosition, IRange } from 'vs/editor/common/editorCommon'; +import { IPosition, IRange } from 'vs/editor/common/editorCommon'; import { Range } from 'vs/editor/common/core/range'; import { ICodeEditor, IOverlayWidget, IOverlayWidgetPosition, IViewZone, IViewZoneChangeAccessor } from 'vs/editor/browser/editorBrowser'; import { Color, RGBA } from "vs/base/common/color"; +import { EditorLayoutInfo } from "vs/editor/common/config/editorOptions"; export interface IOptions { showFrame?: boolean; diff --git a/src/vs/editor/test/common/controller/cursor.test.ts b/src/vs/editor/test/common/controller/cursor.test.ts index 8a9e11a2271..e58754a64b1 100644 --- a/src/vs/editor/test/common/controller/cursor.test.ts +++ b/src/vs/editor/test/common/controller/cursor.test.ts @@ -11,7 +11,7 @@ import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; import { - EndOfLinePreference, Handler, IEditorOptions, + EndOfLinePreference, Handler, DefaultEndOfLine, ITextModelCreationOptions, ICommand, ITokenizedModel, IEditOperationBuilder, ICursorStateComputerData, ICursorPositionChangedEvent, ICursorSelectionChangedEvent @@ -23,6 +23,7 @@ import { TestConfiguration } from 'vs/editor/test/common/mocks/testConfiguration import { MockMode } from 'vs/editor/test/common/mocks/mockMode'; import { LanguageIdentifier } from 'vs/editor/common/modes'; import { viewModelHelper } from 'vs/editor/test/common/editorTestUtils'; +import { IEditorOptions } from "vs/editor/common/config/editorOptions"; let H = Handler; diff --git a/src/vs/editor/test/common/controller/cursorMoveCommand.test.ts b/src/vs/editor/test/common/controller/cursorMoveCommand.test.ts index ac4a73baed7..28287cb515e 100644 --- a/src/vs/editor/test/common/controller/cursorMoveCommand.test.ts +++ b/src/vs/editor/test/common/controller/cursorMoveCommand.test.ts @@ -7,13 +7,14 @@ import * as assert from 'assert'; import { Cursor } from 'vs/editor/common/controller/cursor'; import { Position } from 'vs/editor/common/core/position'; -import { Handler, IEditorOptions, ITextModelCreationOptions, CursorMovePosition, CursorMoveByUnit, ISelection } from 'vs/editor/common/editorCommon'; +import { Handler, ITextModelCreationOptions, CursorMovePosition, CursorMoveByUnit, ISelection } from 'vs/editor/common/editorCommon'; import { Model } from 'vs/editor/common/model/model'; import { IMode } from 'vs/editor/common/modes'; import { TestConfiguration } from 'vs/editor/test/common/mocks/testConfiguration'; import { viewModelHelper as aViewModelHelper } from 'vs/editor/test/common/editorTestUtils'; import { IViewModelHelper } from 'vs/editor/common/controller/oneCursor'; import { Range } from 'vs/editor/common/core/range'; +import { IEditorOptions } from "vs/editor/common/config/editorOptions"; let H = Handler; diff --git a/src/vs/editor/test/common/mocks/testConfiguration.ts b/src/vs/editor/test/common/mocks/testConfiguration.ts index 1cd3ce6d717..d8cede0b45b 100644 --- a/src/vs/editor/test/common/mocks/testConfiguration.ts +++ b/src/vs/editor/test/common/mocks/testConfiguration.ts @@ -5,7 +5,7 @@ 'use strict'; import { CommonEditorConfiguration } from 'vs/editor/common/config/commonEditorConfig'; -import { IEditorOptions } from 'vs/editor/common/editorCommon'; +import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { FontInfo, BareFontInfo } from 'vs/editor/common/config/fontInfo'; export class TestConfiguration extends CommonEditorConfiguration { diff --git a/src/vs/editor/test/common/viewLayout/editorLayoutProvider.test.ts b/src/vs/editor/test/common/viewLayout/editorLayoutProvider.test.ts index 36d204b68c9..28cd57513c8 100644 --- a/src/vs/editor/test/common/viewLayout/editorLayoutProvider.test.ts +++ b/src/vs/editor/test/common/viewLayout/editorLayoutProvider.test.ts @@ -5,7 +5,7 @@ 'use strict'; import * as assert from 'assert'; -import { RenderMinimap, EditorLayoutInfo, OverviewRulerPosition } from 'vs/editor/common/editorCommon'; +import { RenderMinimap, EditorLayoutInfo, OverviewRulerPosition } from 'vs/editor/common/config/editorOptions'; import { EditorLayoutProvider, IEditorLayoutProviderOpts } from 'vs/editor/common/viewLayout/editorLayoutProvider'; suite('Editor ViewLayout - EditorLayoutProvider', () => { diff --git a/src/vs/editor/test/common/viewModel/characterHardWrappingLineMapper.test.ts b/src/vs/editor/test/common/viewModel/characterHardWrappingLineMapper.test.ts index 47e7de315d4..54c7b2b28a6 100644 --- a/src/vs/editor/test/common/viewModel/characterHardWrappingLineMapper.test.ts +++ b/src/vs/editor/test/common/viewModel/characterHardWrappingLineMapper.test.ts @@ -5,7 +5,7 @@ 'use strict'; import * as assert from 'assert'; -import { WrappingIndent } from 'vs/editor/common/editorCommon'; +import { WrappingIndent } from 'vs/editor/common/config/editorOptions'; import { CharacterHardWrappingLineMapperFactory } from 'vs/editor/common/viewModel/characterHardWrappingLineMapper'; import { ILineMapperFactory } from 'vs/editor/common/viewModel/splitLinesCollection'; diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 38807bc0d4a..4a445632abc 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -1010,670 +1010,6 @@ declare module monaco.editor { Visible = 3, } - /** - * Configuration options for editor scrollbars - */ - export interface IEditorScrollbarOptions { - /** - * The size of arrows (if displayed). - * Defaults to 11. - */ - arrowSize?: number; - /** - * Render vertical scrollbar. - * Accepted values: 'auto', 'visible', 'hidden'. - * Defaults to 'auto'. - */ - vertical?: string; - /** - * Render horizontal scrollbar. - * Accepted values: 'auto', 'visible', 'hidden'. - * Defaults to 'auto'. - */ - horizontal?: string; - /** - * Cast horizontal and vertical shadows when the content is scrolled. - * Defaults to true. - */ - useShadows?: boolean; - /** - * Render arrows at the top and bottom of the vertical scrollbar. - * Defaults to false. - */ - verticalHasArrows?: boolean; - /** - * Render arrows at the left and right of the horizontal scrollbar. - * Defaults to false. - */ - horizontalHasArrows?: boolean; - /** - * Listen to mouse wheel events and react to them by scrolling. - * Defaults to true. - */ - handleMouseWheel?: boolean; - /** - * Height in pixels for the horizontal scrollbar. - * Defaults to 10 (px). - */ - horizontalScrollbarSize?: number; - /** - * Width in pixels for the vertical scrollbar. - * Defaults to 10 (px). - */ - verticalScrollbarSize?: number; - /** - * Width in pixels for the vertical slider. - * Defaults to `verticalScrollbarSize`. - */ - verticalSliderSize?: number; - /** - * Height in pixels for the horizontal slider. - * Defaults to `horizontalScrollbarSize`. - */ - horizontalSliderSize?: number; - } - - /** - * Configuration options for editor minimap - */ - export interface IEditorMinimapOptions { - /** - * Enable the rendering of the minimap. - * Defaults to false. - */ - enabled?: boolean; - /** - * Render the actual text on a line (as opposed to color blocks). - * Defaults to true. - */ - renderCharacters?: boolean; - /** - * Limit the width of the minimap to render at most a certain number of columns. - * Defaults to 120. - */ - maxColumn?: number; - } - - /** - * Describes how to indent wrapped lines. - */ - export enum WrappingIndent { - /** - * No indentation => wrapped lines begin at column 1. - */ - None = 0, - /** - * Same => wrapped lines get the same indentation as the parent. - */ - Same = 1, - /** - * Indent => wrapped lines get +1 indentation as the parent. - */ - Indent = 2, - } - - export type LineNumbersOption = 'on' | 'off' | 'relative' | ((lineNumber: number) => string); - - /** - * Configuration options for the editor. - */ - export interface IEditorOptions { - /** - * Enable experimental screen reader support. - * Defaults to `true`. - */ - experimentalScreenReader?: boolean; - /** - * The aria label for the editor's textarea (when it is focused). - */ - ariaLabel?: string; - /** - * Render vertical lines at the specified columns. - * Defaults to empty array. - */ - rulers?: number[]; - /** - * A string containing the word separators used when doing word navigation. - * Defaults to `~!@#$%^&*()-=+[{]}\\|;:\'",.<>/? - */ - wordSeparators?: string; - /** - * Enable Linux primary clipboard. - * Defaults to true. - */ - selectionClipboard?: boolean; - /** - * Control the rendering of line numbers. - * If it is a function, it will be invoked when rendering a line number and the return value will be rendered. - * Otherwise, if it is a truey, line numbers will be rendered normally (equivalent of using an identity function). - * Otherwise, line numbers will not be rendered. - * Defaults to true. - */ - lineNumbers?: LineNumbersOption; - /** - * Should the corresponding line be selected when clicking on the line number? - * Defaults to true. - */ - selectOnLineNumbers?: boolean; - /** - * Control the width of line numbers, by reserving horizontal space for rendering at least an amount of digits. - * Defaults to 5. - */ - lineNumbersMinChars?: number; - /** - * Enable the rendering of the glyph margin. - * Defaults to true in vscode and to false in monaco-editor. - */ - glyphMargin?: boolean; - /** - * The width reserved for line decorations (in px). - * Line decorations are placed between line numbers and the editor content. - * You can pass in a string in the format floating point followed by "ch". e.g. 1.3ch. - * Defaults to 10. - */ - lineDecorationsWidth?: number | string; - /** - * When revealing the cursor, a virtual padding (px) is added to the cursor, turning it into a rectangle. - * This virtual padding ensures that the cursor gets revealed before hitting the edge of the viewport. - * Defaults to 30 (px). - */ - revealHorizontalRightPadding?: number; - /** - * Render the editor selection with rounded borders. - * Defaults to true. - */ - roundedSelection?: boolean; - /** - * Theme to be used for rendering. - * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'. - * You can create custom themes via `monaco.editor.defineTheme`. - */ - theme?: string; - /** - * Should the editor be read only. - * Defaults to false. - */ - readOnly?: boolean; - /** - * Control the behavior and rendering of the scrollbars. - */ - scrollbar?: IEditorScrollbarOptions; - /** - * Control the behavior and rendering of the minimap. - */ - minimap?: IEditorMinimapOptions; - /** - * Display overflow widgets as `fixed`. - * Defaults to `false`. - */ - fixedOverflowWidgets?: boolean; - /** - * The number of vertical lanes the overview ruler should render. - * Defaults to 2. - */ - overviewRulerLanes?: number; - /** - * Controls if a border should be drawn around the overview ruler. - * Defaults to `true`. - */ - overviewRulerBorder?: boolean; - /** - * Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'. - * Defaults to 'blink'. - */ - cursorBlinking?: string; - /** - * Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl. - * Defaults to false. - */ - mouseWheelZoom?: boolean; - /** - * Control the cursor style, either 'block' or 'line'. - * Defaults to 'line'. - */ - cursorStyle?: string; - /** - * Enable font ligatures. - * Defaults to false. - */ - fontLigatures?: boolean; - /** - * Disable the use of `translate3d`. - * Defaults to false. - */ - disableTranslate3d?: boolean; - /** - * Disable the optimizations for monospace fonts. - * Defaults to false. - */ - disableMonospaceOptimizations?: boolean; - /** - * Should the cursor be hidden in the overview ruler. - * Defaults to false. - */ - hideCursorInOverviewRuler?: boolean; - /** - * Enable that scrolling can go one screen size after the last line. - * Defaults to true. - */ - scrollBeyondLastLine?: boolean; - /** - * Enable that the editor will install an interval to check if its container dom node size has changed. - * Enabling this might have a severe performance impact. - * Defaults to false. - */ - automaticLayout?: boolean; - /** - * Control the wrapping of the editor. - * When `wordWrap` = "off", the lines will never wrap. - * When `wordWrap` = "on", the lines will wrap at the viewport width. - * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`. - * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn). - * Defaults to "off". - */ - wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded'; - /** - * Control the wrapping of the editor. - * When `wordWrap` = "off", the lines will never wrap. - * When `wordWrap` = "on", the lines will wrap at the viewport width. - * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`. - * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn). - * Defaults to 80. - */ - wordWrapColumn?: number; - /** - * Force word wrapping when the text appears to be of a minified/generated file. - * Defaults to true. - */ - wordWrapMinified?: boolean; - /** - * Control indentation of wrapped lines. Can be: 'none', 'same' or 'indent'. - * Defaults to 'same' in vscode and to 'none' in monaco-editor. - */ - wrappingIndent?: string; - /** - * Configure word wrapping characters. A break will be introduced before these characters. - * Defaults to '{([+'. - */ - wordWrapBreakBeforeCharacters?: string; - /** - * Configure word wrapping characters. A break will be introduced after these characters. - * Defaults to ' \t})]?|&,;'. - */ - wordWrapBreakAfterCharacters?: string; - /** - * Configure word wrapping characters. A break will be introduced after these characters only if no `wordWrapBreakBeforeCharacters` or `wordWrapBreakAfterCharacters` were found. - * Defaults to '.'. - */ - wordWrapBreakObtrusiveCharacters?: string; - /** - * Performance guard: Stop rendering a line after x characters. - * Defaults to 10000. - * Use -1 to never stop rendering - */ - stopRenderingLineAfter?: number; - /** - * Enable hover. - * Defaults to true. - */ - hover?: boolean; - /** - * Enable custom contextmenu. - * Defaults to true. - */ - contextmenu?: boolean; - /** - * A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events. - * Defaults to 1. - */ - mouseWheelScrollSensitivity?: number; - /** - * Enable quick suggestions (shadow suggestions) - * Defaults to true. - */ - quickSuggestions?: boolean | { - other: boolean; - comments: boolean; - strings: boolean; - }; - /** - * Quick suggestions show delay (in ms) - * Defaults to 500 (ms) - */ - quickSuggestionsDelay?: number; - /** - * Enables parameter hints - */ - parameterHints?: boolean; - /** - * Render icons in suggestions box. - * Defaults to true. - */ - iconsInSuggestions?: boolean; - /** - * Enable auto closing brackets. - * Defaults to true. - */ - autoClosingBrackets?: boolean; - /** - * Enable format on type. - * Defaults to false. - */ - formatOnType?: boolean; - /** - * Enable format on paste. - * Defaults to false. - */ - formatOnPaste?: boolean; - /** - * Controls if the editor should allow to move selections via drag and drop. - * Defaults to false. - */ - dragAndDrop?: boolean; - /** - * Enable the suggestion box to pop-up on trigger characters. - * Defaults to true. - */ - suggestOnTriggerCharacters?: boolean; - /** - * Accept suggestions on ENTER. - * Defaults to true. - */ - acceptSuggestionOnEnter?: boolean; - /** - * Accept suggestions on provider defined characters. - * Defaults to true. - */ - acceptSuggestionOnCommitCharacter?: boolean; - /** - * Enable snippet suggestions. Default to 'true'. - */ - snippetSuggestions?: 'top' | 'bottom' | 'inline' | 'none'; - /** - * Copying without a selection copies the current line. - */ - emptySelectionClipboard?: boolean; - /** - * Enable word based suggestions. Defaults to 'true' - */ - wordBasedSuggestions?: boolean; - /** - * The font size for the suggest widget. - * Defaults to the editor font size. - */ - suggestFontSize?: number; - /** - * The line height for the suggest widget. - * Defaults to the editor line height. - */ - suggestLineHeight?: number; - /** - * Enable selection highlight. - * Defaults to true. - */ - selectionHighlight?: boolean; - /** - * Enable semantic occurrences highlight. - * Defaults to true. - */ - occurrencesHighlight?: boolean; - /** - * Show code lens - * Defaults to true. - */ - codeLens?: boolean; - /** - * Enable code folding - * Defaults to true in vscode and to false in monaco-editor. - */ - folding?: boolean; - /** - * Enable highlighting of matching brackets. - * Defaults to true. - */ - matchBrackets?: boolean; - /** - * Enable rendering of whitespace. - * Defaults to none. - */ - renderWhitespace?: 'none' | 'boundary' | 'all'; - /** - * Enable rendering of control characters. - * Defaults to false. - */ - renderControlCharacters?: boolean; - /** - * Enable rendering of indent guides. - * Defaults to false. - */ - renderIndentGuides?: boolean; - /** - * Enable rendering of current line highlight. - * Defaults to all. - */ - renderLineHighlight?: 'none' | 'gutter' | 'line' | 'all'; - /** - * Inserting and deleting whitespace follows tab stops. - */ - useTabStops?: boolean; - /** - * The font family - */ - fontFamily?: string; - /** - * The font weight - */ - fontWeight?: 'normal' | 'bold' | 'bolder' | 'lighter' | 'initial' | 'inherit' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'; - /** - * The font size - */ - fontSize?: number; - /** - * The line height - */ - lineHeight?: number; - } - - /** - * Configuration options for the diff editor. - */ - export interface IDiffEditorOptions extends IEditorOptions { - /** - * Allow the user to resize the diff editor split view. - * Defaults to true. - */ - enableSplitViewResizing?: boolean; - /** - * Render the differences in two side-by-side editors. - * Defaults to true. - */ - renderSideBySide?: boolean; - /** - * Compute the diff by ignoring leading/trailing whitespace - * Defaults to true. - */ - ignoreTrimWhitespace?: boolean; - /** - * Render +/- indicators for added/deleted changes. - * Defaults to true. - */ - renderIndicators?: boolean; - /** - * Original model should be editable? - * Defaults to false. - */ - originalEditable?: boolean; - } - - export class InternalEditorScrollbarOptions { - readonly _internalEditorScrollbarOptionsBrand: void; - readonly arrowSize: number; - readonly vertical: ScrollbarVisibility; - readonly horizontal: ScrollbarVisibility; - readonly useShadows: boolean; - readonly verticalHasArrows: boolean; - readonly horizontalHasArrows: boolean; - readonly handleMouseWheel: boolean; - readonly horizontalScrollbarSize: number; - readonly horizontalSliderSize: number; - readonly verticalScrollbarSize: number; - readonly verticalSliderSize: number; - readonly mouseWheelScrollSensitivity: number; - } - - export class InternalEditorMinimapOptions { - readonly _internalEditorMinimapOptionsBrand: void; - readonly enabled: boolean; - readonly renderCharacters: boolean; - readonly maxColumn: number; - } - - export class EditorWrappingInfo { - readonly _editorWrappingInfoBrand: void; - readonly inDiffEditor: boolean; - readonly isDominatedByLongLines: boolean; - readonly isWordWrapMinified: boolean; - readonly isViewportWrapping: boolean; - readonly wrappingColumn: number; - readonly wrappingIndent: WrappingIndent; - readonly wordWrapBreakBeforeCharacters: string; - readonly wordWrapBreakAfterCharacters: string; - readonly wordWrapBreakObtrusiveCharacters: string; - } - - export class InternalEditorViewOptions { - readonly _internalEditorViewOptionsBrand: void; - readonly theme: string; - readonly canUseTranslate3d: boolean; - readonly disableMonospaceOptimizations: boolean; - readonly experimentalScreenReader: boolean; - readonly rulers: number[]; - readonly ariaLabel: string; - readonly renderLineNumbers: boolean; - readonly renderCustomLineNumbers: (lineNumber: number) => string; - readonly renderRelativeLineNumbers: boolean; - readonly selectOnLineNumbers: boolean; - readonly glyphMargin: boolean; - readonly revealHorizontalRightPadding: number; - readonly roundedSelection: boolean; - readonly overviewRulerLanes: number; - readonly overviewRulerBorder: boolean; - readonly cursorBlinking: TextEditorCursorBlinkingStyle; - readonly mouseWheelZoom: boolean; - readonly cursorStyle: TextEditorCursorStyle; - readonly hideCursorInOverviewRuler: boolean; - readonly scrollBeyondLastLine: boolean; - readonly editorClassName: string; - readonly stopRenderingLineAfter: number; - readonly renderWhitespace: 'none' | 'boundary' | 'all'; - readonly renderControlCharacters: boolean; - readonly fontLigatures: boolean; - readonly renderIndentGuides: boolean; - readonly renderLineHighlight: 'none' | 'gutter' | 'line' | 'all'; - readonly scrollbar: InternalEditorScrollbarOptions; - readonly minimap: InternalEditorMinimapOptions; - readonly fixedOverflowWidgets: boolean; - } - - export interface IViewConfigurationChangedEvent { - readonly theme: boolean; - readonly canUseTranslate3d: boolean; - readonly disableMonospaceOptimizations: boolean; - readonly experimentalScreenReader: boolean; - readonly rulers: boolean; - readonly ariaLabel: boolean; - readonly renderLineNumbers: boolean; - readonly renderCustomLineNumbers: boolean; - readonly renderRelativeLineNumbers: boolean; - readonly selectOnLineNumbers: boolean; - readonly glyphMargin: boolean; - readonly revealHorizontalRightPadding: boolean; - readonly roundedSelection: boolean; - readonly overviewRulerLanes: boolean; - readonly overviewRulerBorder: boolean; - readonly cursorBlinking: boolean; - readonly mouseWheelZoom: boolean; - readonly cursorStyle: boolean; - readonly hideCursorInOverviewRuler: boolean; - readonly scrollBeyondLastLine: boolean; - readonly editorClassName: boolean; - readonly stopRenderingLineAfter: boolean; - readonly renderWhitespace: boolean; - readonly renderControlCharacters: boolean; - readonly fontLigatures: boolean; - readonly renderIndentGuides: boolean; - readonly renderLineHighlight: boolean; - readonly scrollbar: boolean; - readonly minimap: boolean; - readonly fixedOverflowWidgets: boolean; - } - - export class EditorContribOptions { - readonly selectionClipboard: boolean; - readonly hover: boolean; - readonly contextmenu: boolean; - readonly quickSuggestions: boolean | { - other: boolean; - comments: boolean; - strings: boolean; - }; - readonly quickSuggestionsDelay: number; - readonly parameterHints: boolean; - readonly iconsInSuggestions: boolean; - readonly formatOnType: boolean; - readonly formatOnPaste: boolean; - readonly suggestOnTriggerCharacters: boolean; - readonly acceptSuggestionOnEnter: boolean; - readonly acceptSuggestionOnCommitCharacter: boolean; - readonly snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none'; - readonly emptySelectionClipboard: boolean; - readonly wordBasedSuggestions: boolean; - readonly suggestFontSize: number; - readonly suggestLineHeight: number; - readonly selectionHighlight: boolean; - readonly occurrencesHighlight: boolean; - readonly codeLens: boolean; - readonly folding: boolean; - readonly matchBrackets: boolean; - } - - /** - * Internal configuration options (transformed or computed) for the editor. - */ - export class InternalEditorOptions { - readonly _internalEditorOptionsBrand: void; - readonly lineHeight: number; - readonly readOnly: boolean; - readonly wordSeparators: string; - readonly autoClosingBrackets: boolean; - readonly useTabStops: boolean; - readonly tabFocusMode: boolean; - readonly dragAndDrop: boolean; - readonly layoutInfo: EditorLayoutInfo; - readonly fontInfo: FontInfo; - readonly viewInfo: InternalEditorViewOptions; - readonly wrappingInfo: EditorWrappingInfo; - readonly contribInfo: EditorContribOptions; - } - - /** - * An event describing that the configuration of the editor has changed. - */ - export interface IConfigurationChangedEvent { - readonly lineHeight: boolean; - readonly readOnly: boolean; - readonly wordSeparators: boolean; - readonly autoClosingBrackets: boolean; - readonly useTabStops: boolean; - readonly tabFocusMode: boolean; - readonly dragAndDrop: boolean; - readonly layoutInfo: boolean; - readonly fontInfo: boolean; - readonly viewInfo: IViewConfigurationChangedEvent; - readonly wrappingInfo: boolean; - readonly contribInfo: boolean; - } - /** * Vertical Lane in the overview ruler of the editor. */ @@ -2520,124 +1856,6 @@ declare module monaco.editor { readonly newModelUrl: Uri; } - /** - * A description for the overview ruler position. - */ - export class OverviewRulerPosition { - readonly _overviewRulerPositionBrand: void; - /** - * Width of the overview ruler - */ - readonly width: number; - /** - * Height of the overview ruler - */ - readonly height: number; - /** - * Top position for the overview ruler - */ - readonly top: number; - /** - * Right position for the overview ruler - */ - readonly right: number; - } - - export enum RenderMinimap { - None = 0, - Small = 1, - Large = 2, - SmallBlocks = 3, - LargeBlocks = 4, - } - - /** - * The internal layout details of the editor. - */ - export class EditorLayoutInfo { - readonly _editorLayoutInfoBrand: void; - /** - * Full editor width. - */ - readonly width: number; - /** - * Full editor height. - */ - readonly height: number; - /** - * Left position for the glyph margin. - */ - readonly glyphMarginLeft: number; - /** - * The width of the glyph margin. - */ - readonly glyphMarginWidth: number; - /** - * The height of the glyph margin. - */ - readonly glyphMarginHeight: number; - /** - * Left position for the line numbers. - */ - readonly lineNumbersLeft: number; - /** - * The width of the line numbers. - */ - readonly lineNumbersWidth: number; - /** - * The height of the line numbers. - */ - readonly lineNumbersHeight: number; - /** - * Left position for the line decorations. - */ - readonly decorationsLeft: number; - /** - * The width of the line decorations. - */ - readonly decorationsWidth: number; - /** - * The height of the line decorations. - */ - readonly decorationsHeight: number; - /** - * Left position for the content (actual text) - */ - readonly contentLeft: number; - /** - * The width of the content (actual text) - */ - readonly contentWidth: number; - /** - * The height of the content (actual height) - */ - readonly contentHeight: number; - /** - * The width of the minimap - */ - readonly minimapWidth: number; - /** - * Minimap render type - */ - readonly renderMinimap: RenderMinimap; - /** - * The number of columns (of typical characters) fitting on a viewport line. - */ - readonly viewportColumn: number; - /** - * The width of the vertical scrollbar. - */ - readonly verticalScrollbarWidth: number; - /** - * The height of the horizontal scrollbar. - */ - readonly horizontalScrollbarHeight: number; - /** - * The position of the overview ruler. - */ - readonly overviewRuler: OverviewRulerPosition; - } - /** * Options for creating the editor. */ @@ -3440,66 +2658,6 @@ declare module monaco.editor { RevealLine: string; }; - /** - * The style in which the editor's cursor should be rendered. - */ - export enum TextEditorCursorStyle { - /** - * As a vertical line (sitting between two characters). - */ - Line = 1, - /** - * As a block (sitting on top of a character). - */ - Block = 2, - /** - * As a horizontal line (sitting under a character). - */ - Underline = 3, - /** - * As a thin vertical line (sitting between two characters). - */ - LineThin = 4, - /** - * As an outlined block (sitting on top of a character). - */ - BlockOutline = 5, - /** - * As a thin horizontal line (sitting under a character). - */ - UnderlineThin = 6, - } - - /** - * The kind of animation in which the editor's cursor should be rendered. - */ - export enum TextEditorCursorBlinkingStyle { - /** - * Hidden - */ - Hidden = 0, - /** - * Blinking - */ - Blink = 1, - /** - * Blinking with smooth fading - */ - Smooth = 2, - /** - * Blinking with prolonged filled state and smooth fading - */ - Phase = 3, - /** - * Expand collapse animation on the y axis - */ - Expand = 4, - /** - * No-Blinking - */ - Solid = 5, - } - /** * An event describing that the current mode associated with a model has changed. */ @@ -3597,6 +2755,848 @@ declare module monaco.editor { readonly trimAutoWhitespace: boolean; } + /** + * Configuration options for editor scrollbars + */ + export interface IEditorScrollbarOptions { + /** + * The size of arrows (if displayed). + * Defaults to 11. + */ + arrowSize?: number; + /** + * Render vertical scrollbar. + * Accepted values: 'auto', 'visible', 'hidden'. + * Defaults to 'auto'. + */ + vertical?: string; + /** + * Render horizontal scrollbar. + * Accepted values: 'auto', 'visible', 'hidden'. + * Defaults to 'auto'. + */ + horizontal?: string; + /** + * Cast horizontal and vertical shadows when the content is scrolled. + * Defaults to true. + */ + useShadows?: boolean; + /** + * Render arrows at the top and bottom of the vertical scrollbar. + * Defaults to false. + */ + verticalHasArrows?: boolean; + /** + * Render arrows at the left and right of the horizontal scrollbar. + * Defaults to false. + */ + horizontalHasArrows?: boolean; + /** + * Listen to mouse wheel events and react to them by scrolling. + * Defaults to true. + */ + handleMouseWheel?: boolean; + /** + * Height in pixels for the horizontal scrollbar. + * Defaults to 10 (px). + */ + horizontalScrollbarSize?: number; + /** + * Width in pixels for the vertical scrollbar. + * Defaults to 10 (px). + */ + verticalScrollbarSize?: number; + /** + * Width in pixels for the vertical slider. + * Defaults to `verticalScrollbarSize`. + */ + verticalSliderSize?: number; + /** + * Height in pixels for the horizontal slider. + * Defaults to `horizontalScrollbarSize`. + */ + horizontalSliderSize?: number; + } + + /** + * Configuration options for editor minimap + */ + export interface IEditorMinimapOptions { + /** + * Enable the rendering of the minimap. + * Defaults to false. + */ + enabled?: boolean; + /** + * Render the actual text on a line (as opposed to color blocks). + * Defaults to true. + */ + renderCharacters?: boolean; + /** + * Limit the width of the minimap to render at most a certain number of columns. + * Defaults to 120. + */ + maxColumn?: number; + } + + export type LineNumbersOption = 'on' | 'off' | 'relative' | ((lineNumber: number) => string); + + /** + * Configuration options for the editor. + */ + export interface IEditorOptions { + /** + * Enable experimental screen reader support. + * Defaults to `true`. + */ + experimentalScreenReader?: boolean; + /** + * The aria label for the editor's textarea (when it is focused). + */ + ariaLabel?: string; + /** + * Render vertical lines at the specified columns. + * Defaults to empty array. + */ + rulers?: number[]; + /** + * A string containing the word separators used when doing word navigation. + * Defaults to `~!@#$%^&*()-=+[{]}\\|;:\'",.<>/? + */ + wordSeparators?: string; + /** + * Enable Linux primary clipboard. + * Defaults to true. + */ + selectionClipboard?: boolean; + /** + * Control the rendering of line numbers. + * If it is a function, it will be invoked when rendering a line number and the return value will be rendered. + * Otherwise, if it is a truey, line numbers will be rendered normally (equivalent of using an identity function). + * Otherwise, line numbers will not be rendered. + * Defaults to true. + */ + lineNumbers?: LineNumbersOption; + /** + * Should the corresponding line be selected when clicking on the line number? + * Defaults to true. + */ + selectOnLineNumbers?: boolean; + /** + * Control the width of line numbers, by reserving horizontal space for rendering at least an amount of digits. + * Defaults to 5. + */ + lineNumbersMinChars?: number; + /** + * Enable the rendering of the glyph margin. + * Defaults to true in vscode and to false in monaco-editor. + */ + glyphMargin?: boolean; + /** + * The width reserved for line decorations (in px). + * Line decorations are placed between line numbers and the editor content. + * You can pass in a string in the format floating point followed by "ch". e.g. 1.3ch. + * Defaults to 10. + */ + lineDecorationsWidth?: number | string; + /** + * When revealing the cursor, a virtual padding (px) is added to the cursor, turning it into a rectangle. + * This virtual padding ensures that the cursor gets revealed before hitting the edge of the viewport. + * Defaults to 30 (px). + */ + revealHorizontalRightPadding?: number; + /** + * Render the editor selection with rounded borders. + * Defaults to true. + */ + roundedSelection?: boolean; + /** + * Theme to be used for rendering. + * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'. + * You can create custom themes via `monaco.editor.defineTheme`. + */ + theme?: string; + /** + * Should the editor be read only. + * Defaults to false. + */ + readOnly?: boolean; + /** + * Control the behavior and rendering of the scrollbars. + */ + scrollbar?: IEditorScrollbarOptions; + /** + * Control the behavior and rendering of the minimap. + */ + minimap?: IEditorMinimapOptions; + /** + * Display overflow widgets as `fixed`. + * Defaults to `false`. + */ + fixedOverflowWidgets?: boolean; + /** + * The number of vertical lanes the overview ruler should render. + * Defaults to 2. + */ + overviewRulerLanes?: number; + /** + * Controls if a border should be drawn around the overview ruler. + * Defaults to `true`. + */ + overviewRulerBorder?: boolean; + /** + * Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'. + * Defaults to 'blink'. + */ + cursorBlinking?: string; + /** + * Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl. + * Defaults to false. + */ + mouseWheelZoom?: boolean; + /** + * Control the cursor style, either 'block' or 'line'. + * Defaults to 'line'. + */ + cursorStyle?: string; + /** + * Enable font ligatures. + * Defaults to false. + */ + fontLigatures?: boolean; + /** + * Disable the use of `translate3d`. + * Defaults to false. + */ + disableTranslate3d?: boolean; + /** + * Disable the optimizations for monospace fonts. + * Defaults to false. + */ + disableMonospaceOptimizations?: boolean; + /** + * Should the cursor be hidden in the overview ruler. + * Defaults to false. + */ + hideCursorInOverviewRuler?: boolean; + /** + * Enable that scrolling can go one screen size after the last line. + * Defaults to true. + */ + scrollBeyondLastLine?: boolean; + /** + * Enable that the editor will install an interval to check if its container dom node size has changed. + * Enabling this might have a severe performance impact. + * Defaults to false. + */ + automaticLayout?: boolean; + /** + * Control the wrapping of the editor. + * When `wordWrap` = "off", the lines will never wrap. + * When `wordWrap` = "on", the lines will wrap at the viewport width. + * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`. + * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn). + * Defaults to "off". + */ + wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded'; + /** + * Control the wrapping of the editor. + * When `wordWrap` = "off", the lines will never wrap. + * When `wordWrap` = "on", the lines will wrap at the viewport width. + * When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`. + * When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn). + * Defaults to 80. + */ + wordWrapColumn?: number; + /** + * Force word wrapping when the text appears to be of a minified/generated file. + * Defaults to true. + */ + wordWrapMinified?: boolean; + /** + * Control indentation of wrapped lines. Can be: 'none', 'same' or 'indent'. + * Defaults to 'same' in vscode and to 'none' in monaco-editor. + */ + wrappingIndent?: string; + /** + * Configure word wrapping characters. A break will be introduced before these characters. + * Defaults to '{([+'. + */ + wordWrapBreakBeforeCharacters?: string; + /** + * Configure word wrapping characters. A break will be introduced after these characters. + * Defaults to ' \t})]?|&,;'. + */ + wordWrapBreakAfterCharacters?: string; + /** + * Configure word wrapping characters. A break will be introduced after these characters only if no `wordWrapBreakBeforeCharacters` or `wordWrapBreakAfterCharacters` were found. + * Defaults to '.'. + */ + wordWrapBreakObtrusiveCharacters?: string; + /** + * Performance guard: Stop rendering a line after x characters. + * Defaults to 10000. + * Use -1 to never stop rendering + */ + stopRenderingLineAfter?: number; + /** + * Enable hover. + * Defaults to true. + */ + hover?: boolean; + /** + * Enable custom contextmenu. + * Defaults to true. + */ + contextmenu?: boolean; + /** + * A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events. + * Defaults to 1. + */ + mouseWheelScrollSensitivity?: number; + /** + * Enable quick suggestions (shadow suggestions) + * Defaults to true. + */ + quickSuggestions?: boolean | { + other: boolean; + comments: boolean; + strings: boolean; + }; + /** + * Quick suggestions show delay (in ms) + * Defaults to 500 (ms) + */ + quickSuggestionsDelay?: number; + /** + * Enables parameter hints + */ + parameterHints?: boolean; + /** + * Render icons in suggestions box. + * Defaults to true. + */ + iconsInSuggestions?: boolean; + /** + * Enable auto closing brackets. + * Defaults to true. + */ + autoClosingBrackets?: boolean; + /** + * Enable format on type. + * Defaults to false. + */ + formatOnType?: boolean; + /** + * Enable format on paste. + * Defaults to false. + */ + formatOnPaste?: boolean; + /** + * Controls if the editor should allow to move selections via drag and drop. + * Defaults to false. + */ + dragAndDrop?: boolean; + /** + * Enable the suggestion box to pop-up on trigger characters. + * Defaults to true. + */ + suggestOnTriggerCharacters?: boolean; + /** + * Accept suggestions on ENTER. + * Defaults to true. + */ + acceptSuggestionOnEnter?: boolean; + /** + * Accept suggestions on provider defined characters. + * Defaults to true. + */ + acceptSuggestionOnCommitCharacter?: boolean; + /** + * Enable snippet suggestions. Default to 'true'. + */ + snippetSuggestions?: 'top' | 'bottom' | 'inline' | 'none'; + /** + * Copying without a selection copies the current line. + */ + emptySelectionClipboard?: boolean; + /** + * Enable word based suggestions. Defaults to 'true' + */ + wordBasedSuggestions?: boolean; + /** + * The font size for the suggest widget. + * Defaults to the editor font size. + */ + suggestFontSize?: number; + /** + * The line height for the suggest widget. + * Defaults to the editor line height. + */ + suggestLineHeight?: number; + /** + * Enable selection highlight. + * Defaults to true. + */ + selectionHighlight?: boolean; + /** + * Enable semantic occurrences highlight. + * Defaults to true. + */ + occurrencesHighlight?: boolean; + /** + * Show code lens + * Defaults to true. + */ + codeLens?: boolean; + /** + * Enable code folding + * Defaults to true in vscode and to false in monaco-editor. + */ + folding?: boolean; + /** + * Enable highlighting of matching brackets. + * Defaults to true. + */ + matchBrackets?: boolean; + /** + * Enable rendering of whitespace. + * Defaults to none. + */ + renderWhitespace?: 'none' | 'boundary' | 'all'; + /** + * Enable rendering of control characters. + * Defaults to false. + */ + renderControlCharacters?: boolean; + /** + * Enable rendering of indent guides. + * Defaults to false. + */ + renderIndentGuides?: boolean; + /** + * Enable rendering of current line highlight. + * Defaults to all. + */ + renderLineHighlight?: 'none' | 'gutter' | 'line' | 'all'; + /** + * Inserting and deleting whitespace follows tab stops. + */ + useTabStops?: boolean; + /** + * The font family + */ + fontFamily?: string; + /** + * The font weight + */ + fontWeight?: 'normal' | 'bold' | 'bolder' | 'lighter' | 'initial' | 'inherit' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'; + /** + * The font size + */ + fontSize?: number; + /** + * The line height + */ + lineHeight?: number; + } + + /** + * Configuration options for the diff editor. + */ + export interface IDiffEditorOptions extends IEditorOptions { + /** + * Allow the user to resize the diff editor split view. + * Defaults to true. + */ + enableSplitViewResizing?: boolean; + /** + * Render the differences in two side-by-side editors. + * Defaults to true. + */ + renderSideBySide?: boolean; + /** + * Compute the diff by ignoring leading/trailing whitespace + * Defaults to true. + */ + ignoreTrimWhitespace?: boolean; + /** + * Render +/- indicators for added/deleted changes. + * Defaults to true. + */ + renderIndicators?: boolean; + /** + * Original model should be editable? + * Defaults to false. + */ + originalEditable?: boolean; + } + + export enum RenderMinimap { + None = 0, + Small = 1, + Large = 2, + SmallBlocks = 3, + LargeBlocks = 4, + } + + /** + * Describes how to indent wrapped lines. + */ + export enum WrappingIndent { + /** + * No indentation => wrapped lines begin at column 1. + */ + None = 0, + /** + * Same => wrapped lines get the same indentation as the parent. + */ + Same = 1, + /** + * Indent => wrapped lines get +1 indentation as the parent. + */ + Indent = 2, + } + + /** + * The kind of animation in which the editor's cursor should be rendered. + */ + export enum TextEditorCursorBlinkingStyle { + /** + * Hidden + */ + Hidden = 0, + /** + * Blinking + */ + Blink = 1, + /** + * Blinking with smooth fading + */ + Smooth = 2, + /** + * Blinking with prolonged filled state and smooth fading + */ + Phase = 3, + /** + * Expand collapse animation on the y axis + */ + Expand = 4, + /** + * No-Blinking + */ + Solid = 5, + } + + /** + * The style in which the editor's cursor should be rendered. + */ + export enum TextEditorCursorStyle { + /** + * As a vertical line (sitting between two characters). + */ + Line = 1, + /** + * As a block (sitting on top of a character). + */ + Block = 2, + /** + * As a horizontal line (sitting under a character). + */ + Underline = 3, + /** + * As a thin vertical line (sitting between two characters). + */ + LineThin = 4, + /** + * As an outlined block (sitting on top of a character). + */ + BlockOutline = 5, + /** + * As a thin horizontal line (sitting under a character). + */ + UnderlineThin = 6, + } + + export class InternalEditorScrollbarOptions { + readonly _internalEditorScrollbarOptionsBrand: void; + readonly arrowSize: number; + readonly vertical: ScrollbarVisibility; + readonly horizontal: ScrollbarVisibility; + readonly useShadows: boolean; + readonly verticalHasArrows: boolean; + readonly horizontalHasArrows: boolean; + readonly handleMouseWheel: boolean; + readonly horizontalScrollbarSize: number; + readonly horizontalSliderSize: number; + readonly verticalScrollbarSize: number; + readonly verticalSliderSize: number; + readonly mouseWheelScrollSensitivity: number; + } + + export class InternalEditorMinimapOptions { + readonly _internalEditorMinimapOptionsBrand: void; + readonly enabled: boolean; + readonly renderCharacters: boolean; + readonly maxColumn: number; + } + + export class EditorWrappingInfo { + readonly _editorWrappingInfoBrand: void; + readonly inDiffEditor: boolean; + readonly isDominatedByLongLines: boolean; + readonly isWordWrapMinified: boolean; + readonly isViewportWrapping: boolean; + readonly wrappingColumn: number; + readonly wrappingIndent: WrappingIndent; + readonly wordWrapBreakBeforeCharacters: string; + readonly wordWrapBreakAfterCharacters: string; + readonly wordWrapBreakObtrusiveCharacters: string; + } + + export class InternalEditorViewOptions { + readonly _internalEditorViewOptionsBrand: void; + readonly theme: string; + readonly canUseTranslate3d: boolean; + readonly disableMonospaceOptimizations: boolean; + readonly experimentalScreenReader: boolean; + readonly rulers: number[]; + readonly ariaLabel: string; + readonly renderLineNumbers: boolean; + readonly renderCustomLineNumbers: (lineNumber: number) => string; + readonly renderRelativeLineNumbers: boolean; + readonly selectOnLineNumbers: boolean; + readonly glyphMargin: boolean; + readonly revealHorizontalRightPadding: number; + readonly roundedSelection: boolean; + readonly overviewRulerLanes: number; + readonly overviewRulerBorder: boolean; + readonly cursorBlinking: TextEditorCursorBlinkingStyle; + readonly mouseWheelZoom: boolean; + readonly cursorStyle: TextEditorCursorStyle; + readonly hideCursorInOverviewRuler: boolean; + readonly scrollBeyondLastLine: boolean; + readonly editorClassName: string; + readonly stopRenderingLineAfter: number; + readonly renderWhitespace: 'none' | 'boundary' | 'all'; + readonly renderControlCharacters: boolean; + readonly fontLigatures: boolean; + readonly renderIndentGuides: boolean; + readonly renderLineHighlight: 'none' | 'gutter' | 'line' | 'all'; + readonly scrollbar: InternalEditorScrollbarOptions; + readonly minimap: InternalEditorMinimapOptions; + readonly fixedOverflowWidgets: boolean; + } + + export class EditorContribOptions { + readonly selectionClipboard: boolean; + readonly hover: boolean; + readonly contextmenu: boolean; + readonly quickSuggestions: boolean | { + other: boolean; + comments: boolean; + strings: boolean; + }; + readonly quickSuggestionsDelay: number; + readonly parameterHints: boolean; + readonly iconsInSuggestions: boolean; + readonly formatOnType: boolean; + readonly formatOnPaste: boolean; + readonly suggestOnTriggerCharacters: boolean; + readonly acceptSuggestionOnEnter: boolean; + readonly acceptSuggestionOnCommitCharacter: boolean; + readonly snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none'; + readonly emptySelectionClipboard: boolean; + readonly wordBasedSuggestions: boolean; + readonly suggestFontSize: number; + readonly suggestLineHeight: number; + readonly selectionHighlight: boolean; + readonly occurrencesHighlight: boolean; + readonly codeLens: boolean; + readonly folding: boolean; + readonly matchBrackets: boolean; + } + + /** + * Internal configuration options (transformed or computed) for the editor. + */ + export class InternalEditorOptions { + readonly _internalEditorOptionsBrand: void; + readonly lineHeight: number; + readonly readOnly: boolean; + readonly wordSeparators: string; + readonly autoClosingBrackets: boolean; + readonly useTabStops: boolean; + readonly tabFocusMode: boolean; + readonly dragAndDrop: boolean; + readonly layoutInfo: EditorLayoutInfo; + readonly fontInfo: FontInfo; + readonly viewInfo: InternalEditorViewOptions; + readonly wrappingInfo: EditorWrappingInfo; + readonly contribInfo: EditorContribOptions; + } + + /** + * A description for the overview ruler position. + */ + export class OverviewRulerPosition { + readonly _overviewRulerPositionBrand: void; + /** + * Width of the overview ruler + */ + readonly width: number; + /** + * Height of the overview ruler + */ + readonly height: number; + /** + * Top position for the overview ruler + */ + readonly top: number; + /** + * Right position for the overview ruler + */ + readonly right: number; + } + + /** + * The internal layout details of the editor. + */ + export class EditorLayoutInfo { + readonly _editorLayoutInfoBrand: void; + /** + * Full editor width. + */ + readonly width: number; + /** + * Full editor height. + */ + readonly height: number; + /** + * Left position for the glyph margin. + */ + readonly glyphMarginLeft: number; + /** + * The width of the glyph margin. + */ + readonly glyphMarginWidth: number; + /** + * The height of the glyph margin. + */ + readonly glyphMarginHeight: number; + /** + * Left position for the line numbers. + */ + readonly lineNumbersLeft: number; + /** + * The width of the line numbers. + */ + readonly lineNumbersWidth: number; + /** + * The height of the line numbers. + */ + readonly lineNumbersHeight: number; + /** + * Left position for the line decorations. + */ + readonly decorationsLeft: number; + /** + * The width of the line decorations. + */ + readonly decorationsWidth: number; + /** + * The height of the line decorations. + */ + readonly decorationsHeight: number; + /** + * Left position for the content (actual text) + */ + readonly contentLeft: number; + /** + * The width of the content (actual text) + */ + readonly contentWidth: number; + /** + * The height of the content (actual height) + */ + readonly contentHeight: number; + /** + * The width of the minimap + */ + readonly minimapWidth: number; + /** + * Minimap render type + */ + readonly renderMinimap: RenderMinimap; + /** + * The number of columns (of typical characters) fitting on a viewport line. + */ + readonly viewportColumn: number; + /** + * The width of the vertical scrollbar. + */ + readonly verticalScrollbarWidth: number; + /** + * The height of the horizontal scrollbar. + */ + readonly horizontalScrollbarHeight: number; + /** + * The position of the overview ruler. + */ + readonly overviewRuler: OverviewRulerPosition; + } + + export interface IViewConfigurationChangedEvent { + readonly theme: boolean; + readonly canUseTranslate3d: boolean; + readonly disableMonospaceOptimizations: boolean; + readonly experimentalScreenReader: boolean; + readonly rulers: boolean; + readonly ariaLabel: boolean; + readonly renderLineNumbers: boolean; + readonly renderCustomLineNumbers: boolean; + readonly renderRelativeLineNumbers: boolean; + readonly selectOnLineNumbers: boolean; + readonly glyphMargin: boolean; + readonly revealHorizontalRightPadding: boolean; + readonly roundedSelection: boolean; + readonly overviewRulerLanes: boolean; + readonly overviewRulerBorder: boolean; + readonly cursorBlinking: boolean; + readonly mouseWheelZoom: boolean; + readonly cursorStyle: boolean; + readonly hideCursorInOverviewRuler: boolean; + readonly scrollBeyondLastLine: boolean; + readonly editorClassName: boolean; + readonly stopRenderingLineAfter: boolean; + readonly renderWhitespace: boolean; + readonly renderControlCharacters: boolean; + readonly fontLigatures: boolean; + readonly renderIndentGuides: boolean; + readonly renderLineHighlight: boolean; + readonly scrollbar: boolean; + readonly minimap: boolean; + readonly fixedOverflowWidgets: boolean; + } + + /** + * An event describing that the configuration of the editor has changed. + */ + export interface IConfigurationChangedEvent { + readonly lineHeight: boolean; + readonly readOnly: boolean; + readonly wordSeparators: boolean; + readonly autoClosingBrackets: boolean; + readonly useTabStops: boolean; + readonly tabFocusMode: boolean; + readonly dragAndDrop: boolean; + readonly layoutInfo: boolean; + readonly fontInfo: boolean; + readonly viewInfo: IViewConfigurationChangedEvent; + readonly wrappingInfo: boolean; + readonly contribInfo: boolean; + } + /** * A view zone is a full horizontal rectangle that 'pushes' text down. * The editor reserves space for view zones when rendering. diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index df75d66cc0a..cd604730034 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -49,6 +49,7 @@ import * as paths from 'vs/base/common/paths'; import { realpath } from 'fs'; import { MainContext, ExtHostContext, InstanceCollection, IInitData } from './extHost.protocol'; import * as languageConfiguration from 'vs/editor/common/modes/languageConfiguration'; +import { TextEditorCursorStyle } from "vs/editor/common/config/editorOptions"; export interface IExtensionApiFactory { (extension: IExtensionDescription): typeof vscode; @@ -518,7 +519,7 @@ export function createApiFactory( SymbolKind: extHostTypes.SymbolKind, TextDocumentSaveReason: extHostTypes.TextDocumentSaveReason, TextEdit: extHostTypes.TextEdit, - TextEditorCursorStyle: EditorCommon.TextEditorCursorStyle, + TextEditorCursorStyle: TextEditorCursorStyle, TextEditorLineNumbersStyle: extHostTypes.TextEditorLineNumbersStyle, TextEditorRevealType: extHostTypes.TextEditorRevealType, TextEditorSelectionChangeKind: extHostTypes.TextEditorSelectionChangeKind, diff --git a/src/vs/workbench/api/node/extHostTextEditor.ts b/src/vs/workbench/api/node/extHostTextEditor.ts index b0f0ec172e6..4837b5f7855 100644 --- a/src/vs/workbench/api/node/extHostTextEditor.ts +++ b/src/vs/workbench/api/node/extHostTextEditor.ts @@ -11,11 +11,12 @@ import { IdGenerator } from 'vs/base/common/idGenerator'; import { TPromise } from 'vs/base/common/winjs.base'; import { ExtHostDocumentData } from 'vs/workbench/api/node/extHostDocumentData'; import { Selection, Range, Position, EndOfLine, TextEditorRevealType, TextEditorLineNumbersStyle, SnippetString } from './extHostTypes'; -import { ISingleEditOperation, TextEditorCursorStyle, IRange } from 'vs/editor/common/editorCommon'; +import { ISingleEditOperation, IRange } from 'vs/editor/common/editorCommon'; import { IResolvedTextEditorConfiguration, ITextEditorConfigurationUpdate } from 'vs/workbench/api/node/mainThreadEditor'; import * as TypeConverters from './extHostTypeConverters'; import { MainThreadEditorsShape } from './extHost.protocol'; import * as vscode from 'vscode'; +import { TextEditorCursorStyle } from "vs/editor/common/config/editorOptions"; export class TextEditorDecorationType implements vscode.TextEditorDecorationType { diff --git a/src/vs/workbench/api/node/mainThreadEditor.ts b/src/vs/workbench/api/node/mainThreadEditor.ts index 7d1548572bf..a4eb9cc4bc0 100644 --- a/src/vs/workbench/api/node/mainThreadEditor.ts +++ b/src/vs/workbench/api/node/mainThreadEditor.ts @@ -13,17 +13,18 @@ import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; import { SnippetController } from 'vs/editor/contrib/snippet/common/snippetController'; import { EndOfLine, TextEditorLineNumbersStyle } from 'vs/workbench/api/node/extHostTypes'; +import { TextEditorCursorStyle, cursorStyleToString } from "vs/editor/common/config/editorOptions"; export interface ITextEditorConfigurationUpdate { tabSize?: number | 'auto'; insertSpaces?: boolean | 'auto'; - cursorStyle?: EditorCommon.TextEditorCursorStyle; + cursorStyle?: TextEditorCursorStyle; lineNumbers?: TextEditorLineNumbersStyle; } export interface IResolvedTextEditorConfiguration { tabSize: number; insertSpaces: boolean; - cursorStyle: EditorCommon.TextEditorCursorStyle; + cursorStyle: TextEditorCursorStyle; lineNumbers: TextEditorLineNumbersStyle; } @@ -244,7 +245,7 @@ export class MainThreadTextEditor { } if (newConfiguration.cursorStyle) { - let newCursorStyle = EditorCommon.cursorStyleToString(newConfiguration.cursorStyle); + let newCursorStyle = cursorStyleToString(newConfiguration.cursorStyle); this._codeEditor.updateOptions({ cursorStyle: newCursorStyle }); @@ -303,7 +304,7 @@ export class MainThreadTextEditor { // shutdown time return this._configuration; } - let cursorStyle = this._configuration ? this._configuration.cursorStyle : EditorCommon.TextEditorCursorStyle.Line; + let cursorStyle = this._configuration ? this._configuration.cursorStyle : TextEditorCursorStyle.Line; let lineNumbers: TextEditorLineNumbersStyle = this._configuration ? this._configuration.lineNumbers : TextEditorLineNumbersStyle.On; if (codeEditor) { let codeEditorOpts = codeEditor.getConfiguration(); diff --git a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts index c225df963e1..3cc0c4b20a8 100644 --- a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts +++ b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts @@ -14,7 +14,7 @@ import { Action, IAction } from 'vs/base/common/actions'; import { onUnexpectedError } from 'vs/base/common/errors'; import types = require('vs/base/common/types'); import { IDiffEditor } from 'vs/editor/browser/editorBrowser'; -import { IDiffEditorOptions, IEditorOptions } from 'vs/editor/common/editorCommon'; +import { IDiffEditorOptions, IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { BaseTextEditor, IEditorConfiguration } from 'vs/workbench/browser/parts/editor/textEditor'; import { TextEditorOptions, TextDiffEditorOptions, EditorInput, EditorOptions, TEXT_DIFF_EDITOR_ID, IFileEditorInput } from 'vs/workbench/common/editor'; import { StringEditorInput } from 'vs/workbench/common/editor/stringEditorInput'; diff --git a/src/vs/workbench/browser/parts/editor/textEditor.ts b/src/vs/workbench/browser/parts/editor/textEditor.ts index fb592a73248..5573f11d3c0 100644 --- a/src/vs/workbench/browser/parts/editor/textEditor.ts +++ b/src/vs/workbench/browser/parts/editor/textEditor.ts @@ -15,7 +15,7 @@ import DOM = require('vs/base/browser/dom'); import { CodeEditor } from 'vs/editor/browser/codeEditor'; import { EditorInput, EditorOptions, toResource } from 'vs/workbench/common/editor'; import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; -import { IEditorViewState, IEditor, IEditorOptions, isCommonCodeEditor, isCommonDiffEditor } from 'vs/editor/common/editorCommon'; +import { IEditorViewState, IEditor, isCommonCodeEditor, isCommonDiffEditor } from 'vs/editor/common/editorCommon'; import { Position } from 'vs/platform/editor/common/editor'; import { IStorageService } from 'vs/platform/storage/common/storage'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -27,6 +27,7 @@ import { getCodeEditor } from 'vs/editor/common/services/codeEditorService'; import { IModeService } from 'vs/editor/common/services/modeService'; import { ITextFileService, SaveReason, AutoSaveMode } from 'vs/workbench/services/textfile/common/textfiles'; import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService'; +import { IEditorOptions } from "vs/editor/common/config/editorOptions"; const TEXT_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'textEditorViewState'; diff --git a/src/vs/workbench/browser/parts/editor/textResourceEditor.ts b/src/vs/workbench/browser/parts/editor/textResourceEditor.ts index 78693265c82..96b76b50418 100644 --- a/src/vs/workbench/browser/parts/editor/textResourceEditor.ts +++ b/src/vs/workbench/browser/parts/editor/textResourceEditor.ts @@ -8,7 +8,7 @@ import { TPromise } from 'vs/base/common/winjs.base'; import nls = require('vs/nls'); import types = require('vs/base/common/types'); import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; -import { IEditorOptions } from 'vs/editor/common/editorCommon'; +import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { TextEditorOptions, EditorModel, EditorInput, EditorOptions } from 'vs/workbench/common/editor'; import { BaseTextEditorModel } from 'vs/workbench/common/editor/textEditorModel'; import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput'; diff --git a/src/vs/workbench/common/editor.ts b/src/vs/workbench/common/editor.ts index 5a451963e10..c979d58c498 100644 --- a/src/vs/workbench/common/editor.ts +++ b/src/vs/workbench/common/editor.ts @@ -10,13 +10,14 @@ import * as objects from 'vs/base/common/objects'; import types = require('vs/base/common/types'); import URI from 'vs/base/common/uri'; import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle'; -import { IEditor, ICommonCodeEditor, IEditorViewState, IEditorOptions as ICodeEditorOptions, IModel } from 'vs/editor/common/editorCommon'; +import { IEditor, ICommonCodeEditor, IEditorViewState, IModel } from 'vs/editor/common/editorCommon'; import { IEditorInput, IEditorModel, IEditorOptions, ITextEditorOptions, IBaseResourceInput, Position, Verbosity } from 'vs/platform/editor/common/editor'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { IInstantiationService, IConstructorSignature0 } from 'vs/platform/instantiation/common/instantiation'; import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; +import * as editorOptions from "vs/editor/common/config/editorOptions"; export const TextCompareEditorVisible = new RawContextKey('textCompareEditorVisible', false); @@ -580,7 +581,7 @@ export class TextEditorOptions extends EditorOptions { private revealInCenterIfOutsideViewport: boolean; private editorViewState: IEditorViewState; - private editorOptions: ICodeEditorOptions; + private editorOptions: editorOptions.IEditorOptions; public static from(input: IBaseResourceInput): TextEditorOptions { let options: TextEditorOptions = null; diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts b/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts index 5d5b4a12d64..c19b55403cd 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts @@ -7,7 +7,7 @@ import 'vs/css!./media/codeEditor'; import * as nls from 'vs/nls'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; -import { ICommonCodeEditor, IEditorContribution, InternalEditorOptions, IModel } from 'vs/editor/common/editorCommon'; +import { ICommonCodeEditor, IEditorContribution, IModel } from 'vs/editor/common/editorCommon'; import { editorAction, ServicesAccessor, EditorAction, commonEditorContribution } from 'vs/editor/common/editorCommonExtensions'; import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -18,6 +18,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { IMessageService } from 'vs/platform/message/common/message'; import Severity from 'vs/base/common/severity'; import URI from 'vs/base/common/uri'; +import { InternalEditorOptions } from "vs/editor/common/config/editorOptions"; const transientWordWrapState = 'transientWordWrapState'; const isWordWrapMinifiedKey = 'isWordWrapMinified'; diff --git a/src/vs/workbench/parts/debug/electron-browser/debugHover.ts b/src/vs/workbench/parts/debug/electron-browser/debugHover.ts index 7f9be997f6b..dd789f7e8fc 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugHover.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugHover.ts @@ -12,7 +12,7 @@ import { ITree } from 'vs/base/parts/tree/browser/tree'; import { Tree } from 'vs/base/parts/tree/browser/treeImpl'; import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { DefaultController, ICancelableEvent, ClickBehavior } from 'vs/base/parts/tree/browser/treeDefaults'; -import { IConfigurationChangedEvent } from 'vs/editor/common/editorCommon'; +import { IConfigurationChangedEvent } from 'vs/editor/common/config/editorOptions'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { IContentWidget, ICodeEditor, IContentWidgetPosition, ContentWidgetPositionPreference } from 'vs/editor/browser/editorBrowser'; diff --git a/src/vs/workbench/parts/debug/electron-browser/repl.ts b/src/vs/workbench/parts/debug/electron-browser/repl.ts index 3bbffa5fa8e..42bdf9dcd2b 100644 --- a/src/vs/workbench/parts/debug/electron-browser/repl.ts +++ b/src/vs/workbench/parts/debug/electron-browser/repl.ts @@ -20,7 +20,7 @@ import { ITree, ITreeOptions } from 'vs/base/parts/tree/browser/tree'; import { Tree } from 'vs/base/parts/tree/browser/treeImpl'; import { Context as SuggestContext } from 'vs/editor/contrib/suggest/browser/suggest'; import { SuggestController } from 'vs/editor/contrib/suggest/browser/suggestController'; -import { IEditorOptions, IReadOnlyModel, EditorContextKeys, ICommonCodeEditor } from 'vs/editor/common/editorCommon'; +import { IReadOnlyModel, EditorContextKeys, ICommonCodeEditor } from 'vs/editor/common/editorCommon'; import { Position } from 'vs/editor/common/core/position'; import * as modes from 'vs/editor/common/modes'; import { editorAction, ServicesAccessor, EditorAction, EditorCommand, CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions'; @@ -41,6 +41,7 @@ import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/work import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { IListService } from 'vs/platform/list/browser/listService'; import { attachListStyler } from "vs/platform/theme/common/styler"; +import { IEditorOptions } from "vs/editor/common/config/editorOptions"; const $ = dom.$; diff --git a/src/vs/workbench/parts/debug/electron-browser/replEditor.ts b/src/vs/workbench/parts/debug/electron-browser/replEditor.ts index 851f1156925..3e607802ab3 100644 --- a/src/vs/workbench/parts/debug/electron-browser/replEditor.ts +++ b/src/vs/workbench/parts/debug/electron-browser/replEditor.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IEditorOptions } from 'vs/editor/common/editorCommon'; +import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { EditorAction, CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions'; import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'; import { IEditorContributionCtor } from 'vs/editor/browser/editorBrowser'; diff --git a/src/vs/workbench/parts/files/common/files.ts b/src/vs/workbench/parts/files/common/files.ts index 7374f803522..dc8cd834b61 100644 --- a/src/vs/workbench/parts/files/common/files.ts +++ b/src/vs/workbench/parts/files/common/files.ts @@ -5,7 +5,7 @@ 'use strict'; import URI from 'vs/base/common/uri'; -import { IEditorOptions } from 'vs/editor/common/editorCommon'; +import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { IWorkbenchEditorConfiguration } from 'vs/workbench/common/editor'; import { IFilesConfiguration } from 'vs/platform/files/common/files'; import { FileStat, OpenEditor } from 'vs/workbench/parts/files/common/explorerViewModel'; diff --git a/src/vs/workbench/parts/output/browser/outputPanel.ts b/src/vs/workbench/parts/output/browser/outputPanel.ts index 8d28289fa52..da6f5e9ff4c 100644 --- a/src/vs/workbench/parts/output/browser/outputPanel.ts +++ b/src/vs/workbench/parts/output/browser/outputPanel.ts @@ -10,7 +10,7 @@ import { TPromise } from 'vs/base/common/winjs.base'; import { Action, IAction } from 'vs/base/common/actions'; import { Builder } from 'vs/base/browser/builder'; import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar'; -import { IEditorOptions } from 'vs/editor/common/editorCommon'; +import { IEditorOptions } from 'vs/editor/common/config/editorOptions'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IStorageService } from 'vs/platform/storage/common/storage'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; diff --git a/src/vs/workbench/parts/preferences/browser/preferencesEditor.ts b/src/vs/workbench/parts/preferences/browser/preferencesEditor.ts index bd8b2f6da05..111dce246ee 100644 --- a/src/vs/workbench/parts/preferences/browser/preferencesEditor.ts +++ b/src/vs/workbench/parts/preferences/browser/preferencesEditor.ts @@ -51,6 +51,7 @@ import { IEditorGroupService } from 'vs/workbench/services/group/common/groupSer import { FoldingController } from 'vs/editor/contrib/folding/browser/folding'; import { FindController } from 'vs/editor/contrib/find/browser/find'; import { SelectionHighlighter } from 'vs/editor/contrib/find/common/findController'; +import { IEditorOptions } from "vs/editor/common/config/editorOptions"; export class PreferencesEditorInput extends SideBySideEditorInput { public static ID: string = 'workbench.editorinputs.preferencesEditorInput'; @@ -469,11 +470,11 @@ export class DefaultPreferencesEditor extends BaseTextEditor { super(DefaultPreferencesEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, modeService, textFileService, editorGroupService); } - public createEditorControl(parent: Builder, configuration: editorCommon.IEditorOptions): editorCommon.IEditor { + public createEditorControl(parent: Builder, configuration: IEditorOptions): editorCommon.IEditor { return this.instantiationService.createInstance(DefaultPreferencesCodeEditor, parent.getHTMLElement(), configuration); } - protected getConfigurationOverrides(): editorCommon.IEditorOptions { + protected getConfigurationOverrides(): IEditorOptions { const options = super.getConfigurationOverrides(); options.readOnly = true; if (this.input) { diff --git a/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart.ts b/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart.ts index 154325f4e27..7e6dd6e11e1 100644 --- a/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart.ts +++ b/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart.ts @@ -12,7 +12,7 @@ import * as strings from 'vs/base/common/strings'; import URI from 'vs/base/common/uri'; import { TPromise } from 'vs/base/common/winjs.base'; import { DefaultConfig } from 'vs/editor/common/config/defaultConfig'; -import { IEditorOptions, IEditorViewState } from 'vs/editor/common/editorCommon'; +import { IEditorViewState } from 'vs/editor/common/editorCommon'; import { $, Dimension, Builder } from 'vs/base/browser/builder'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { EditorOptions } from 'vs/workbench/common/editor'; @@ -39,6 +39,7 @@ import { isObject } from 'vs/base/common/types'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'; import { Parts, IPartService } from "vs/workbench/services/part/common/partService"; +import { IEditorOptions } from "vs/editor/common/config/editorOptions"; export const WALK_THROUGH_FOCUS = new RawContextKey('interactivePlaygroundFocus', false); diff --git a/src/vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts b/src/vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts index fdb5aedf62c..7fc02336299 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts @@ -7,7 +7,7 @@ import * as assert from 'assert'; import { TPromise } from 'vs/base/common/winjs.base'; import { TextEditorLineNumbersStyle } from 'vs/workbench/api/node/extHostTypes'; -import { TextEditorCursorStyle } from 'vs/editor/common/editorCommon'; +import { TextEditorCursorStyle } from 'vs/editor/common/config/editorOptions'; import { IResolvedTextEditorConfiguration, ITextEditorConfigurationUpdate } from 'vs/workbench/api/node/mainThreadEditor'; import { MainThreadEditorsShape } from 'vs/workbench/api/node/extHost.protocol'; import { ExtHostTextEditorOptions, ExtHostTextEditor } from 'vs/workbench/api/node/extHostTextEditor';