import { StringEdit } from "../../core/edits/stringEdit.js"; import { OffsetRange } from "../../core/ranges/offsetRange.js"; export interface IAnnotation { range: OffsetRange; annotation: T; } export interface IAnnotatedString { /** * Set annotations for a specific line. * Annotations should be sorted and non-overlapping. */ setAnnotations(annotations: AnnotationsUpdate): void; /** * Return annotations intersecting with the given offset range. */ getAnnotationsIntersecting(range: OffsetRange): IAnnotation[]; /** * Get all the annotations. Method is used for testing. */ getAllAnnotations(): IAnnotation[]; /** * Apply a string edit to the annotated string. * @returns The annotations that were deleted (became empty) as a result of the edit. */ applyEdit(edit: StringEdit): IAnnotation[]; /** * Clone the annotated string. */ clone(): IAnnotatedString; } export declare class AnnotatedString implements IAnnotatedString { /** * Annotations are non intersecting and contiguous in the array. */ private _annotations; constructor(annotations?: IAnnotation[]); /** * Set annotations for a specific range. * Annotations should be sorted and non-overlapping. * If the annotation value is undefined, the annotation is removed. */ setAnnotations(annotations: AnnotationsUpdate): void; /** * Returns all annotations that intersect with the given offset range. */ getAnnotationsIntersecting(range: OffsetRange): IAnnotation[]; private _getStartIndexOfIntersectingAnnotation; private _getEndIndexOfIntersectingAnnotation; /** * Returns a copy of all annotations. */ getAllAnnotations(): IAnnotation[]; /** * Applies a string edit to the annotated string, updating annotation ranges accordingly. * @param edit The string edit to apply. * @returns The annotations that were deleted (became empty) as a result of the edit. */ applyEdit(edit: StringEdit): IAnnotation[]; /** * Creates a shallow clone of this annotated string. */ clone(): IAnnotatedString; } export interface IAnnotationUpdate { range: OffsetRange; annotation: T | undefined; } type DefinedValue = object | string | number | boolean; export type ISerializedAnnotation = { range: { start: number; endExclusive: number; }; annotation: TSerializedProperty | undefined; }; export declare class AnnotationsUpdate { static create(annotations: IAnnotationUpdate[]): AnnotationsUpdate; private _annotations; private constructor(); get annotations(): IAnnotationUpdate[]; rebase(edit: StringEdit): void; serialize(serializingFunc: (annotation: T) => TSerializedProperty): ISerializedAnnotation[]; static deserialize(serializedAnnotations: ISerializedAnnotation[], deserializingFunc: (annotation: TSerializedProperty) => T): AnnotationsUpdate; } export {};