Files
Language-Server/docs/roadmap/03-documents-positions.md
T
faumaray ca04975d54 bootstrap
Signed-off-by: faumaray <faumaray@gmail.com>
2026-11-25 02:11:19 +03:00

2.8 KiB

03 — Versioned documents, positions and overlays

Status: PLANNED; no implementation claim Requirements: R-006,R-011 Dependencies: 02; shared revision identity with05 and09 before semantic integration.

Ownership and boundaries

Proposed Sol package: NEW include/vls/documents/, src/documents/, tests/documents/. Root owns shared revision schema. Future assignments must verify the then-current baseline and exact disjoint paths; these proposed scopes do not authorize work in another repository.

Contracts and data flow

DocumentSnapshot contains URI, immutable bytes, version/content identity and line/encoding map. DocumentStore accepts open/change/close and returns snapshots. UTF-16 is the LSP default; negotiated UTF-8 is explicit. A snapshot's positions and text never refer to different revisions.

Implementation sequence

  1. Normalize URI identity without confusing encoded separators, symlinks or platform path spelling; retain display URI separately. Establish workspace ownership from04.
  2. Implement ordered incremental edits against the exact preceding version, including multiple edits in one notification; keep old snapshots alive for outstanding requests.
  3. Maintain line indexes and UTF-8/UTF-16 conversion with Void Unicode primitives; validate boundaries, CRLF and non-BMP characters without splitting scalars.
  4. Expose overlay reads to compiler workers and dependency snapshots. Close releases the live overlay but does not invalidate references to immutable completed snapshots.

Failure behavior and constraints

Reject impossible ranges and nonmonotonic changes; mark the document desynchronized until full replacement or reopen instead of guessing content. Do not fabricate a standard LSP request for resynchronization. Missing disk data and invalid encoding remain typed readiness failures.

Acceptance scenarios

  1. Round-trip positions across ASCII, combining characters, astral code points, CRLF, empty final lines and mixed edits.
  2. Race edits/close with snapshot acquisition and prove every consumer sees a coherent revision.
  3. Test malformed ranges, stale notifications, URI aliases, reopen and full-text recovery; benchmark large-file edit/index updates.

Verification and integration

Proposed NEW CTest label: documents. Once implemented, register a nonzero suite and run:

dev cpp-gcc -c ctest --test-dir build/bootstrap -L documents --output-on-failure

This future command is not evidence that the label/tests exist now. Before dispatch, bind the fixtures above to actual targets and record prerequisites/side effects. Require fresh independent review of the implemented contract and affected integrations. Keep version/store changes behind the document interface. Invalidate derived caches on encoding/identity policy changes; never overwrite user buffers to repair state.