import { EditHistoryEntry, EditHistoryState, EditorLineAnnotation, EditorSelection, EditorType, ResolvedTextEdit } from "./types.js"; import { TextDocument } from "./textDocument.js"; //#region src/editor/editStack.d.ts type EditStackEntry = EditHistoryEntry; /** Options for the edit stack. */ interface EditStackOptions { /** The maximum number of entries to keep in the undo stack. */ maxEntries?: number; } /** A stack of edit entries. */ declare class EditStack { #private; constructor(options?: EditStackOptions); get canUndo(): boolean; get canRedo(): boolean; /** Return an independent, developer-editable history snapshot. */ getState(): EditHistoryState; /** Return a live view over this stack without copying its entries. */ getLiveState(): EditHistoryState; /** Transfer developer-owned history into an edit stack. */ static fromState(state: EditHistoryState): EditStack; /** Clears both the undo and redo stacks. */ clear(): void; /** Clears the redo stack. */ clearRedo(): void; /** Pushes a new entry onto the undo stack. */ push(entry: EditStackEntry): void; /** Sets the selections after the last undo entry. */ setLastUndoSelectionsAfter(selections: EditorSelection[]): void; /** Sets the line annotations after the last undo entry. */ setLastUndoLineAnnotations(lineAnnotationsBefore: EditorLineAnnotation[], lineAnnotationsAfter: EditorLineAnnotation[]): void; /** Returns the last undo entry, or `undefined` if empty. */ peekUndo(): EditStackEntry | undefined; /** Returns the last undo entry only while its coalescing group is open. */ peekUndoForCoalescing(): EditStackEntry | undefined; /** Replaces the last undo entry with the given entry. */ replaceLastUndo(entry: EditStackEntry): void; /** Moves the latest undo entry to the redo stack and returns it, or `undefined` if empty. */ popUndoToRedo(): EditStackEntry | void; /** Moves the latest redo entry back to the undo stack and returns it, or `undefined` if empty. */ popRedoToUndo(): EditStackEntry | void; } declare function createEditStackEntry(textDocument: TextDocument, resolvedEdits: ResolvedTextEdit[], versionBefore: number, versionAfter: number, selectionsBefore?: EditorSelection[], selectionsAfter?: EditorSelection[], lineAnnotationsBefore?: EditorLineAnnotation[], lineAnnotationsAfter?: EditorLineAnnotation[]): EditStackEntry; /** Determines if the change matches following modes: * - 'insert': simple typing * - 'backspace': backward delete * - 'delete': forward delete */ declare function shouldCoalesceEditStackEntry(previousEntry: EditStackEntry | undefined, nextEntry: EditStackEntry): boolean; /** Coalesce edit stack entries for simple typing and single-character deletes. */ declare function coalesceEditStackEntries(previousEntry: EditStackEntry, nextEntry: EditStackEntry): EditStackEntry; //#endregion export { EditStack, EditStackEntry, EditStackOptions, coalesceEditStackEntries, createEditStackEntry, shouldCoalesceEditStackEntry }; //# sourceMappingURL=editStack.d.ts.map