import { FileContents } from "../types.js"; import { EditState, EditorType, EditorViewState, RetainedDiffSessionSnapshot } from "./types.js"; import { TextDocument } from "./textDocument.js"; import { Editor } from "./editor.js"; //#region src/editor/EditStateManager.d.ts interface ManagedEditSessionBase { document?: TextDocument; fileInfo?: Pick; editor?: EditorViewState; } interface ManagedFileEditSession extends ManagedEditSessionBase<'file', LAnnotation> { type: 'file'; diffSession?: never; } interface ManagedFileDiffEditSession extends ManagedEditSessionBase<'file-diff', LAnnotation> { type: 'file-diff'; diffSession?: RetainedDiffSessionSnapshot; } type ManagedEditSession = ManagedEditSessionBase & (EType extends 'file' ? Pick : Pick); /** Keeps file and diff edit state in independent persistence domains. */ declare class EditStateManagerClass { #private; /** Mark a keyed session as active and return its initial or stored state. */ activate(type: EType, editStateKey: string, owner: Editor, initialState?: ManagedEditSession): ManagedEditSession; /** * Stop tracking this file session as active and store its current state, * unless `discard` is true. */ releaseFile(editStateKey: string, owner: Editor<'file', LAnnotation, Caret>, discard?: boolean): void; /** * Stop tracking this diff session as active and store its current state, * unless `discard` is true. */ releaseFileDiff(editStateKey: string, owner: Editor<'file-diff', LAnnotation, Caret>, discard?: boolean): void; /** Return current state for an active or dormant editing session. */ get(type: EType, editStateKey: string): EditState | undefined; /** Clear a dormant session, returning false when it is active or missing. */ clear(type: EditorType, editStateKey: string, parts?: ClearEditStateOptions): boolean; /** Clear all dormant sessions without affecting active editors. */ clearAll(): void; setCapacity(capacity: number): void; } interface ClearEditStateOptions { document?: boolean; history?: boolean; editor?: boolean; selections?: boolean; view?: boolean; } declare function cloneEditorViewState(state: EditorViewState): EditorViewState; declare function toManagedEditState(session: ManagedEditSession): EditState | undefined; declare const EditStateManager: EditStateManagerClass; //#endregion export { ClearEditStateOptions, EditStateManager, ManagedEditSession, ManagedFileDiffEditSession, ManagedFileEditSession, cloneEditorViewState, toManagedEditState }; //# sourceMappingURL=EditStateManager.d.ts.map