import { LineMap } from "@mpt/line-map"; import { Source } from "./source.js"; import { SourceBase } from "./source-base.js"; export class TextSource extends SourceBase { readonly content: string; #lineMap: LineMap | undefined = undefined; constructor(content: string) { super(); this.content = content; } /** * A line map for this source that can be used * for converting between line/character positions and offsets. */ get lineMap(): LineMap { if (this.#lineMap === undefined) { this.#lineMap = new LineMap(this.content); } return this.#lineMap; } }