Path: blob/main/extensions/copilot/test/simulation/fixtures/gen/4080.ts
13399 views
/**1* Represents a gap (before the first child, between two children, or after the last child) in a `LinkedOverlayNode`.2*/3class LinkedOverlayNodeGap {45constructor(6private readonly _originalText: string,7private readonly _parent: LinkedOverlayNode,8public readonly startIndex: number,9public readonly endIndex: number,10public readonly gapIndex: number,11) { }12public get range(): OffsetRange {13return new OffsetRange(this.startIndex, this.endIndex);14}15public get isFirstGapInParent(): boolean {16return this.gapIndex === 0;17}18public get isLastGapInParent(): boolean {19return this.gapIndex === this._parent.children.length;20}21public toString(): string {22return `NodeGap (${this.startIndex}-${this.endIndex} :: ${this._originalText.substring(this.startIndex, this.endIndex)})`;23}24public get text(): string {25return this._originalText.substring(this.startIndex, this.endIndex);26}27public get firstNonWhitespaceIndex(): number {28let index = this.startIndex;29while (index < this.endIndex) {30const charCode = this._originalText.charCodeAt(index);31if (charCode !== CharCode.Tab && charCode !== CharCode.Space && charCode !== CharCode.LineFeed) {32return index;33}34index++;35}36return this.endIndex;37}3839public get lastNonWhitespaceIndex(): number {4041}4243public get nextLeaf(): LinkedOverlayNode | null {44const nextSibling = this._parent.childAt(this.gapIndex);45return nextSibling ? nextSibling.leftMostLeafChild : this._parent.nextLeaf;46}47}48495051