From 9ecc8107209172217c749dda4ab06b46c97f5f56 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 5 May 2020 18:12:00 +0200 Subject: [PATCH] Add a memory storage space for layout computation --- src/vs/editor/common/config/commonEditorConfig.ts | 5 ++++- src/vs/editor/common/config/editorOptions.ts | 9 +++++++++ .../test/common/viewLayout/editorLayoutProvider.test.ts | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index ee224f1f6fd..b1682623e6b 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -8,7 +8,7 @@ import { Emitter, Event } from 'vs/base/common/event'; import { Disposable } from 'vs/base/common/lifecycle'; import * as objects from 'vs/base/common/objects'; import * as arrays from 'vs/base/common/arrays'; -import { IEditorOptions, editorOptionsRegistry, ValidatedEditorOptions, IEnvironmentalOptions, IComputedEditorOptions, ConfigurationChangedEvent, EDITOR_MODEL_DEFAULTS, EditorOption, FindComputedEditorOptionValueById } from 'vs/editor/common/config/editorOptions'; +import { IEditorOptions, editorOptionsRegistry, ValidatedEditorOptions, IEnvironmentalOptions, IComputedEditorOptions, ConfigurationChangedEvent, EDITOR_MODEL_DEFAULTS, EditorOption, FindComputedEditorOptionValueById, IComputeOptionsMemory } from 'vs/editor/common/config/editorOptions'; import { EditorZoom } from 'vs/editor/common/config/editorZoom'; import { BareFontInfo, FontInfo } from 'vs/editor/common/config/fontInfo'; import { IConfiguration, IDimension } from 'vs/editor/common/editorCommon'; @@ -284,6 +284,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements IC public readonly onDidChange: Event = this._onDidChange.event; public readonly isSimpleWidget: boolean; + private _computeOptionsMemory: IComputeOptionsMemory; public options!: ComputedEditorOptions; private _isDominatedByLongLines: boolean; @@ -299,6 +300,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements IC this.isSimpleWidget = isSimpleWidget; this._isDominatedByLongLines = false; + this._computeOptionsMemory = {}; this._viewLineCount = 1; this._lineNumbersDigitCount = 1; @@ -344,6 +346,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements IC const partialEnv = this._getEnvConfiguration(); const bareFontInfo = BareFontInfo.createFromValidatedSettings(this._validatedOptions, partialEnv.zoomLevel, this.isSimpleWidget); const env: IEnvironmentalOptions = { + memory: this._computeOptionsMemory, outerWidth: partialEnv.outerWidth, outerHeight: partialEnv.outerHeight, fontInfo: this.readConfiguration(bareFontInfo), diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 11fadefd614..913ac0ecb95 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -687,6 +687,7 @@ export interface IComputedEditorOptions { * @internal */ export interface IEnvironmentalOptions { + readonly memory: IComputeOptionsMemory | null; readonly outerWidth: number; readonly outerHeight: number; readonly fontInfo: FontInfo; @@ -700,6 +701,12 @@ export interface IEnvironmentalOptions { readonly accessibilitySupport: AccessibilitySupport; } +/** + * @internal + */ +export interface IComputeOptionsMemory { +} + export interface IEditorOption { readonly id: K1; readonly name: string; @@ -1756,6 +1763,7 @@ export interface EditorLayoutInfo { * @internal */ export interface EditorLayoutInfoComputerEnv { + memory: IComputeOptionsMemory | null; outerWidth: number; outerHeight: number; lineHeight: number; @@ -1780,6 +1788,7 @@ export class EditorLayoutInfoComputer extends ComputedEditorOption { options._write(EditorOption.lineNumbers, lineNumbersOptions); const actual = EditorLayoutInfoComputer.computeLayout(options, { + memory: null, outerWidth: input.outerWidth, outerHeight: input.outerHeight, lineHeight: input.lineHeight, -- GitLab