Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 165 to 318

Compare

+70 −3 in 5 places
Lines 1–5 at 318 (were 1–6 at 165)
11import { startNode } from "../keys.ts";
22import { StableSet } from "../state-source.ts";
3−import { joinLines } from "../text.ts";
43import type { FileAttrs, ReadView, SeqLine, VisibleLine } from "../view.ts";
54import type { ExperimentalMarkerProjection, MarkerState } from "./projection-marker.ts";
65
Lines 73–86 at 318 (were 74–80 at 165)
7473 }
7574 lineNumber(path: string, line: string): number {
7675 this.#assertLive();
77− return this.lines(path).findIndex((item) => item.id === line);
76+ let index = 0;
77+ for (const id of this.#adapter.lineIds(this.#state, path)) {
78+ this.#assertLive();
79+ if (id === line) return index;
80+ index++;
81+ }
82+ this.#assertLive();
83+ return -1;
7884 }
7985 sameText(path: string, other: ReadView): boolean {
8086 this.#assertLive();
Lines 110–139 at 318 (were 104–109 at 165)
104110 for (const id of this.graph.movers()) if (this.set.has(id)) return true;
105111 return false;
106112 }
113+ *#textChunks(n: number): IterableIterator<string> {
114+ this.#assertLive();
115+ const iterator = this.graph.textChunks(n);
116+ while (true) {
117+ this.#assertLive();
118+ const next = iterator.next();
119+ this.#assertLive();
120+ if (next.done) return;
121+ yield next.value;
122+ }
123+ }
124+ *lineChunks(path: string): IterableIterator<() => Iterable<string>> {
125+ this.#assertLive();
126+ const iterator = this.#adapter.lineIds(this.#state, path);
127+ while (true) {
128+ this.#assertLive();
129+ const next = iterator.next();
130+ this.#assertLive();
131+ if (next.done) return;
132+ const n = this.graph.lineN(next.value);
133+ yield () => this.#textChunks(n);
134+ }
135+ }
107137 *visibleLines(path: string): IterableIterator<VisibleLine> {
108138 this.#assertLive();
109139 const graph = this.#adapter.graph;
Lines 152–185 at 318 (were 122–127 at 165)
122152 this.#assertLive();
123153 return [...this.visibleLines(path)];
124154 }
155+ *#buildingLines(path: string): IterableIterator<VisibleLine> {
156+ this.#assertLive();
157+ const graph = this.#adapter.graph;
158+ const iterator = this.#adapter.lineIds(this.#state, path);
159+ while (true) {
160+ this.#assertLive();
161+ const next = iterator.next();
162+ this.#assertLive();
163+ if (next.done) return;
164+ const id = next.value;
165+ const n = graph.lineN(id);
166+ const assertLive = () => this.#assertLive();
167+ yield {
168+ id,
169+ textChunks: () => this.#textChunks(n),
170+ get text() {
171+ assertLive();
172+ return graph.textOf(n);
173+ },
174+ atom: graph.idOfSeq(graph.writerSeqOf(n)),
175+ };
176+ }
177+ }
178+ buildLines(path: string): readonly VisibleLine[] {
179+ this.#assertLive();
180+ return [...this.#buildingLines(path)];
181+ }
125183 sequence(path: string): readonly SeqLine[] {
126184 this.#assertLive();
127185 const adapter = this.#adapter,
Lines 251–266 at 318 (were 193–199 at 165)
193251 }
194252 text(path: string): string {
195253 this.#assertLive();
196− return joinLines([...this.visibleLines(path)].map((line) => line.text));
254+ let text = "",
255+ part = "";
256+ for (const line of this.visibleLines(path)) {
257+ part += `${line.text}\n`;
258+ if (part.length >= 16384) {
259+ text += part;
260+ part = "";
261+ }
262+ }
263+ return text + part;
197264 }
198265 hasFile(path: string): boolean {
199266 this.#assertLive();
MCP
compare on this site's /mcp
CLI
abso diff 165 318 src/engine/experimental/projection-reader.ts --json
JSON
/christopher/abso-core/compare/165..318?file=src%2Fengine%2Fexperimental%2Fprojection-reader.ts&format=json