Files
lucioandClaude Fable 5 c47b16a65e
ci / checks (push) Failing after 41s
ci / corpus (push) Successful in 29s
LSP §9c: 3.18 extras — rangesFormatting ships, two honest parkings
textDocument/rangesFormatting: the engine took multi-range LineRanges
natively (this is literally the CLI's --lines a-b,c-d call), so the
server adapter is map(lines_of) around it and the verified
all-or-nothing contract rides through whole. range_formatting is now
DEFINED as the one-element case, making refusal equality structural;
lines_of extracted with its own test, plus a latent debug-overflow fix
(end.line + 1 at u32::MAX -> saturating, proven by deliberate
breakage). The capability widens documentRangeFormattingProvider from
true to {rangesSupport: true} only for clients that asked (read from
the raw initialize params; lsp-types 0.97 spells neither half) — every
pre-round client sees a byte-identical initialize result, proven on
the wire. The round's discovery: vscode-languageclient 9.0.1 has been
sending rangesSupport and gating its multi-range provider on our
answer all along — the bare boolean was turning the feature off.

SnippetTextEdit and workspace/textDocumentContent are parked with
evidence: absent from lsp-types 0.97 and from the pinned client's
node_modules (a snippet edit sent today would write literal ${1:...}
into the buffer), and the thin extension deliberately has no content
provider. Each parking carries a one-grep re-check trigger. The
whole-document reply shape is kept: splitting per-range would claim
byte ownership the engine never verified.

24 tests added; QA re-ran every evidence grep, verified the client
citations against formatting.js, and closed with zero findings. This
completes TODO.md §9c and the LSP 3.18 audit's feature work.

docs/features/lsp-318-extras/README.md

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-08-27 00:13:43 -07:00
..

lsp-318-extras

Goal

Close the last box of TODO.md §9c — the three LSP 3.18 additions the audit named — by shipping the one a real client can consume today and writing down, with evidence, why the other two cannot be shipped honestly yet.

Shipped: textDocument/rangesFormatting, multi-range formatting in one request. This is what an editor sends for format the lines I modified and for format each of my multi-cursor selections: n ranges, one round trip, one answer. lucisv's range engine already takes an n-range LineRanges natively (that is what --lines 3-9,40 is), so the request is a thin adapter over the same verified, all-or-nothing engine textDocument/rangeFormatting runs — not a second formatter with a second contract.

Parked, with the assessment in Parked below: snippet edits in a WorkspaceEdit, and workspace/textDocumentContent. Neither has a shipping client that could consume it, and CLAUDE.md's "nothing is advertised that is not implemented" has a mirror image — nothing is implemented that nothing can call.

What rangesFormatting is

LSP 3.18 (proposed), textDocument/rangesFormatting:

// params
{ "textDocument": { "uri": … }, "ranges": [ Range, … ], "options": FormattingOptions }
// result
TextEdit[] | null

The server declares it by widening its existing documentRangeFormattingProvider from the bare true to the options object with rangesSupport: true — the boolean | DocumentRangeFormattingOptions union the capability has always had:

"documentRangeFormattingProvider": { "rangesSupport": true }

The client declares it as textDocument.rangeFormatting.rangesSupport: true.

Semantics: the union of the ranges, on the one engine

An n-range request is exactly the single-range request with n line spans instead of one. Concretely, format::ranges_formatting is now the only entry point and range_formatting is the one-element call of it:

  1. Each protocol Range becomes a 1-based inclusive line span through the same lines_of conversion single-range formatting used before this round (only line numbers survive; an end at character 0 of a later line names the line before it). The conversion was extracted, not copied — a second spelling of that rule is a second thing to get wrong.
  2. The spans go into one LineRanges::new, which sorts and merges them. Overlapping, adjacent and unsorted input from the client all normalize there, and they normalize in the CLI's own constructor rather than in a second copy written for the LSP.
  3. One format_range call. The all-or-nothing contract, the equivalence check and the replayed-selection convergence check all ride through unchanged, because this is literally the call --lines 3-9,40 makes.
  4. One whole-document TextEdit, or none when the text did not change — rangeFormatting's reply shape, for rangeFormatting's reason (the engine's contract is over the file; what makes a request a range format is which constructs were laid out).

Consequences worth stating, all tested:

client sends answer
ranges out of order ([7-8, 2-3]) same as sorted — LineRanges sorts
overlapping ranges ([2-4, 3-6]) same as the merged range 2-6
adjacent ranges ([2-2, 3-3]) same as 2-3; merging changes no answer
the same range twice same as once
"ranges": [] [], no edit, no message — an empty ask is not an error
one huge range over the buffer the whole-file format, as rangeFormatting already answers
a buffer the engine refuses [] and a window/showMessage ERROR, byte-identical to rangeFormatting's refusal
a buffer this server has not been sent null, as every other formatting handler answers

The refusal path is not "similar to" rangeFormatting's — it is the same Server::edits and the same Server::warn_about_config, reached from a dispatch arm that differs only in how the params were decoded. There is one test that asserts the two refusals are equal values rather than asserting the shape of each.

The capability decision: gated on the client, not advertised blind

documentRangeFormattingProvider is boolean | DocumentRangeFormattingOptions in the spec, so sending the object form is legal against 3.17 and 3.18 alike, and vscode-languageclient reads it through getRegistrationOptions, which handles both arms (features.js:230: Is.boolean(capability) && capability === true ? { documentSelector } : { ...capability, documentSelector }). Advertising the object unconditionally would therefore probably be safe.

It is still gated on the client having sent textDocument.rangeFormatting.rangesSupport: true, for a reason that costs nothing:

  • A client that did not ask will never send rangesFormatting however it is advertised, so the object form buys that client exactly nothing.
  • The bare true is the value every client has seen from this server since round 18, and a bare boolean is the one shape no client can misread. A hand-rolled client that tests === true — the shape LSP servers have sent for this capability for a decade — keeps working.
  • The gate is one boolean read from the initialize params, and the request handler is registered unconditionally, so a client that sends the request without asking first is still answered.

So: a 3.17 client sees true, byte-for-byte what it saw before this round; a 3.18 client sees { "rangesSupport": true }. Both shapes are decoded from the real initialize JSON in tests.

lsp-types 0.97 cannot spell either half — its DocumentRangeFormattingOptions carries only workDoneProgress, and its DocumentRangeFormattingClientCapabilities is an alias for DynamicRegistrationClientCapabilities with no rangesSupport field — so both halves go through JSON:

  • Out: initialize_value() replaces the serialized documentRangeFormattingProvider value, the precedent docs/features/type-hierarchy/README.md set for typeHierarchyProvider. Same function, same test discipline (the whole object is pinned, not just the one key).
  • In: the flag is read from the raw initialize params Value before it is deserialized into InitializeParams, because the typed struct drops the field. main.rs already had that raw value in hand.

Client reach — checked, not assumed

  • editors/vscode/node_modules/[email protected] (the pinned version) already implements the request: lib/common/formatting.js:74 sends capability.rangesSupport = true, and :109 registers provideDocumentRangesFormattingEdits only if options.rangesSupport came back from the server. So before this round the extension was asking for the feature and being told no.
  • [email protected] carries DocumentRangesFormattingRequest and DocumentRangesFormattingParams (lib/common/protocol.d.ts:2900,2945), so the wire shape implemented here is that library's, not a reading of the spec text.
  • [email protected] requires engines.vscode: ^1.82.0 and sets provideDocumentRangesFormattingEdits on the provider it registers, so the VS Code API exists at the version this extension already targets (editors/vscode/package.json pins the same ^1.82.0).
  • Neovim's built-in client sends rangeFormatting, not rangesFormatting; it loses nothing, because the gate leaves its capability exactly as it was.

Parked, and why

Both items were assessed against the same three questions: does lsp-types 0.97 model it, does the client capability exist to read, and can the pinned client stack apply it. An item that fails the third is parked — implementing a protocol nothing on the other end speaks is how a server acquires a capability that is a lie.

Snippet edits in WorkspaceEdit — parked

3.18 lets a WorkspaceEdit carry a SnippetTextEdit, so lucisv.addPort could drop the cursor on the new port's name with the type as a tabstop instead of leaving the caret where the apply happened to end.

question answer evidence
lsp-types 0.97 models SnippetTextEdit? No grep -rn 'SnippetTextEdit' lsp-types-0.97.0/src/ → nothing
the client capability field exists to read? No WorkspaceEditClientCapabilities (lib.rs:1071) has exactly documentChanges, resourceOperations, failureHandling, normalizesLineEndings, changeAnnotationSupport — no snippetEditSupport
the pinned client can apply one? No grep -rln 'snippetEditSupport|SnippetTextEdit' editors/vscode/node_modules/ → no hits at all, in either [email protected] or [email protected]

All three fail, and the third is the one that decides it: the extension's client library has no code path that would turn a snippet edit into a tabstop, so a server sending one would be sending an object the client either drops or applies as a literal ${1:name} written into the user's buffer — which is the exact failure mode snippet_support() already exists to prevent on the completion path (main.rs: "a literal ${1:clk} written into a buffer is worse than no tabstops at all").

Re-check trigger, exactly: when editors/vscode/package.json moves off [email protected], grep the new tree for snippetEditSupport. It appears when the client library implements this; that string in node_modules/vscode-languageserver-protocol/lib/common/protocol.d.ts is the whole signal. The server side then needs (a) a snippetEditSupport read added next to apply_edit_support in main.rs, and (b) ports.rs's WorkspaceEdit to emit { "snippet": { "value": … } } in place of newText for the one edit that creates the port, gated on that flag.

workspace/textDocumentContent — parked

3.18's server-provided read-only documents. The tempting use is a lucisv-expanded: URI serving the macro-expanded view that docs/features/macro-expansion/README.md currently shows only inside a hover card.

question answer evidence
lsp-types 0.97 models it? No grep -rn 'textDocumentContent' lsp-types-0.97.0/src/ → only TextDocumentContentChangeEvent, an unrelated sync type
the pinned client can serve one? No grep -rln 'textDocumentContent' editors/vscode/node_modules/ → no hits
the extension could route it anyway? No serving a custom URI scheme in VS Code needs workspace.registerTextDocumentContentProvider in the extension host; editors/vscode/extension.js deliberately registers no providers of its own — it starts the server and gets out of the way

This one is parked twice over: the client library does not implement the request, and the thin extension is the wrong shape to consume it. Note also that the feature it would serve does not exist yet in a document-sized form — hover.rs expands one macro call one step (macro-expansion's stated scope: "One step, display only"), so there is no whole-file expanded text to serve. A future round wanting this wants a preprocessor first, which TODO.md §7 says lucisv does not have and does not want.

Re-check trigger, exactly: the same node_modules grep, for textDocumentContent, plus a decision to give extension.js a content provider. Both, not either.

Assumptions

  • LineRanges::new is the one normalizer. Sorting, merging overlaps and folding adjacent spans happen there, once, for the CLI and both LSP formatting requests. This round adds no second copy and asserts the normalization through the public answer rather than restating it.
  • A client sends ranges that name lines in the buffer it opened. Nothing checks that a range's lines exist: past-EOF spans clamp in the engine (the --lines rule, documented in range-formatting), and a range on a document the server does not hold answers null before any of this runs.
  • Only line numbers matter. Same as rangeFormatting: the UTF-16 columns are thrown away by lines_of, so there is nothing to get wrong about them.
  • A client that advertises rangesSupport reads the union form of documentRangeFormattingProvider. It is the shape its own protocol library declares; a client asking a 3.18 question in 3.17-only JSON terms is not a client that exists.
  • Parking is assessed against the pinned client, [email protected] as vendored in editors/vscode/node_modules, not against what some unreleased client might do. The re-check triggers above are written so the assessment can be redone in one grep.

Handshakes

Consumed from vlog_formatter: format_range, LineRanges::new, Config. Nothing new is asked of vlog_formatter and nothing in it was changed — the multi-range engine has existed since round 18 for --lines.

Consumed from lsp_types: Range, TextEdit, FormattingOptions, TextDocumentIdentifier. The 3.18 params type is hand-rolled here (format::RangesFormattingParams) because 0.97 does not carry it, the same way pairs::ScopePairsParams is hand-rolled for a custom method.

Promised to crates/lucisv_server callers:

  • format::ranges_formatting(&Document, &Config, &[Range]) -> Result<Option<TextEdit>, String> is the new entry point, and format::range_formatting is now defined as its one-element case. Both keep the old signature and the old answer.
  • format::RANGES_FORMATTING is the method string, and format::RangesFormattingParams the decoded params.
  • main::initialize_value now takes one bool (whether to widen the range formatting capability). Callers: main() and the tests in main.rs.

Promised to editors/vscode: nothing to do. extension.js is untouched and needs no change — vscode-languageclient registers its multi-range provider off the server's capability alone, so the feature turns on when the user updates the server binary. smoke.js was extended (its initialize now sends the rangesSupport capability the real client sends, plus one rangesFormatting leg), because a pre-publish check that advertises less than the shipping client would be checking a shape no user ever sees.

Changed for another module: none. verify.rs, vlog_formatter, vlog_parser, vlog_semantic, vlog_linter, crates/lucisv, editors/vscode/extension.js, corpus/ and the .cases tables are all untouched.

verify.rs is untouched — git diff --quiet on it exits 0. No normalization was added, broadened or weakened, so CLAUDE.md invariant #4's attack-test requirement does not apply to this round. It could not: every byte this round produces comes out of format_range, which runs the unchanged net over the whole buffer.

Status / TODO

  • format.rs: lines_of extracted from range_formatting; ranges_formatting; range_formatting redefined as its one-element case; RANGES_FORMATTING and RangesFormattingParams.
  • server.rs: the textDocument/rangesFormatting dispatch arm, sharing edits and warn_about_config with rangeFormatting.
  • main.rs: ranges_formatting_support read from the raw initialize params; initialize_value(bool) widening the capability.
  • Tests — +24: 11 units in format.rs, 7 session tests in server.rs, 4 capability tests in main.rs, 2 e2e legs over the real binary (one per client shape), plus a smoke.js leg.
  • Docs: this README, lucisv-server's capability table and Status, TODO.md §9c's last box.
  • Parked: snippet WorkspaceEdit edits — assessment above, with the exact re-check trigger.
  • Parked: workspace/textDocumentContent — assessment above, with the exact re-check trigger.
  • Not done, deliberately: a per-range reply (TextEdit[] with one edit per range). The engine's contract is over the whole file, so the honest reply is the whole-document edit rangeFormatting already sends. Splitting it into n edits would be a claim about which bytes each range owns that nothing verifies.
  • Not done: dynamic registration of the range-formatting provider. The gate is decided once at initialize and never changes, so there is nothing a registration would buy; a client that flips rangesSupport mid-session does not exist.

Work log

2026-08-27 — dev agent

  • Read CLAUDE.md, TODO.md §9c, and the Handshakes of lucisv-server, range-formatting, type-hierarchy and macro-expansion before writing anything. Baseline: cargo test -p lucisv_server 993 unit + 48 e2e, cargo test --workspace green, clippy silent, fmt clean.
  • Checked all three items against lsp-types 0.97 and the pinned client before deciding anything. The greps are in the sections above and are the whole basis for the ship/park calls. The surprise was the good one: the brief expected [email protected] to be too old for rangesFormatting, and it is not — 3.18 is newer than 9.0.1 as a spec version, but this particular request was already implemented there, and the library has been sending rangesSupport: true at this server for as long as the extension has existed. lucisv was answering with a bare true and turning it off. The other two items are as the brief guessed.
  • The engine took multiple ranges natively, so this is an adapter and not a feature. LineRanges::new sorts and merges (range.rs:38), which is exactly the "normalize overlapping/adjacent/unsorted ranges" the brief asked for, and format_range takes the merged list. So the whole implementation is three lines of map(lines_of) around the constructor. This is the point, not a shortcut: the verified contract, the equivalence check and the replayed-selection convergence check ride through untouched because it is literally the call --lines 3-9,40 makes.
  • range_formatting became the one-element case of ranges_formatting, rather than the two sharing a helper. The brief allowed either. Defining one as the other is stronger: there is no shape of buffer or range for which the two can answer differently, which is what makes the refusal-equality test (a_refused_buffer_is_refused_identically_whichever_range_request_asked) an assertion about the code rather than a coincidence someone has to maintain.
  • The line conversion was extracted, not copied (lines_of), and pinned directly by a test — because it is now shared, a change to it moves two requests at once and the test says what it promises.
  • One latent panic fixed in passing. The old conversion wrote range.end.line + 1, which overflows in a debug build for an end line of u32::MAX. saturating_add, with a test. No behavior change for any range an editor can produce; it is CLAUDE.md's no-panic rule for library paths.
  • The capability decision took the conservative arm, and it cost nothing. The object form is spec-legal for a 3.17 client and vscode-languageclient handles the union (features.js:230), so advertising it unconditionally would very probably be fine. But a client that never sent rangesSupport gains exactly nothing from the object, and a bare boolean is the one shape nothing can misread — so the widening is gated on the client's own flag and every client that shipped before this round sees a byte-identical initialize result, asserted over the wire by a_3_17_client_still_sees_the_bare_true_it_always_saw. The pre-existing e2e assertion documentRangeFormattingProvider == true needed no edit, which is the same fact stated by an older test.
  • The client flag has to be read from the raw params. lsp-types 0.97 aliases DocumentRangeFormattingClientCapabilities to the plain dynamic-registration struct, so serde_json::from_value::<InitializeParams> discards rangesSupport before anything can look at it. main() already had the raw Value in hand, so the read is one line placed before the decode. Symmetric with the JSON insertion on the way out, and documented as such.
  • The handler is unconditional; only the advertising is gated. A client that sends the request without having asked is answered rather than told the method does not exist — refusing a request we can serve because of a handshake detail would be the server being pedantic at the user's expense.
  • smoke.js was changed in one substantive way: its initialize now sends the rangeFormatting.rangesSupport capability, because that is what the real extension's client library sends and the smoke test's stated job is to "spawn the server exactly the way extension.js does". Without it the smoke test would assert a capability shape no real user ever sees. The new leg sends two ranges and asserts both that the named line moved and that a line no range named kept its bytes.
  • Nothing outside crates/lucisv_server and editors/vscode/smoke.js was touched. verify.rs, vlog_formatter, vlog_parser, vlog_semantic, vlog_linter, crates/lucisv, corpus/, the .cases tables and docs/site/ are all unmodified (git status --porcelain names seven files — three server sources, its e2e, smoke.js, TODO.md and the lucisv-server README — plus this directory). No new dependency. Did not run git commit/git push.

Results.

  • cargo test --workspace: 2176 passed, 0 failed across 34 test binaries. This feature's crate: lucisv_server unit 993 → 1015 (+11 format.rs, +7 server.rs, +4 main.rs), e2e 48 → 50.
  • cargo test -p vlog_formatter: 180 passed, 0 failed — untouched, and git diff --quiet crates/vlog_formatter exits 0, so the snapshot and idempotency suites are green for the same reason they were yesterday.
  • cargo clippy --workspace --all-targets: silent, 0 warnings. cargo fmt --all --check: clean.
  • node editors/vscode/smoke.js target/release/lucisv-server: OK, 10 messages (was 9), the new rangesFormatting leg included.
  • No corpus run and no verify.rs attack tests, and the reason is structural rather than an omission: this round adds no formatter code path at all. Every byte it can emit comes out of format_range with a LineRanges the CLI could equally have built, so the corpus evidence in docs/features/range-formatting/README.md (578 files, 8236 range trials, 0 refusals) covers it unchanged, and CLAUDE.md invariant #4 does not apply because no normalization was added, broadened or weakened.

Files added: docs/features/lsp-318-extras/README.md. Files edited: crates/lucisv_server/src/{format,server,main}.rs, crates/lucisv_server/tests/e2e.rs, editors/vscode/smoke.js, TODO.md, docs/features/lucisv-server/README.md.

QA log

2026-08-27 — QA agent

Gates, re-run clean.

  • cargo fmt --all --check: clean.
  • cargo clippy --workspace --all-targets -- -D warnings: silent (forced a rebuild with touch on the three changed sources first, since the initial run was cache-hit and could have hidden a stale result).
  • cargo test --workspace: 2176 passed, 0 failed, 34 binaries — hand-summed every test result: line to confirm the dev's total rather than trusting it. lucisv_server unit 1015 (993→1015, +22: 11 format.rs + 7 server.rs
    • 4 main.rs), e2e 50 (48→50, +2) — matches the claimed +24 exactly.
  • cargo test -p vlog_formatter: 180 passed, 0 failed.
  • git diff --quiet crates/vlog_formatter: exit 0, confirmed myself. find . -iname verify.rs → crates/vlog_formatter/src/verify.rs, git diff --quiet on it: exit 0. git status --porcelain docs/site/: empty.
  • cargo build --release -p lucisv_server + node editors/vscode/smoke.js target/release/lucisv-server: OK, 10 messages, against the real release binary.

Verdict, per attack surface — all verified-clean, no findings, no fixes needed.

  1. range_formatting redefinition. Enumerated callers by grep: only server.rs's range_formatting handler and on_type.rs's ;-trigger (format::range_formatting at on_type.rs:83 and its test at on_type.rs:1100) call format::range_formatting; both keep the exact old (doc, config, range: Range) signature, so neither needed to change and neither did. Added a temporary probe in format.rs's test module (added, run, reverted before finishing — git diff --stat on the three sources matches the pre-QA diffstat exactly: format.rs 229, server.rs 190, main.rs 145 lines changed) covering: two ranges landing in one multi-line statement merge into one edit, not a double format; reverse document order matches forward order; a range at line 0 plus one at the last line lays out both ends; 50 tiny ranges over a 200-line buffer format in well under a second (no quadratic blowup observed); a format-off fence beats a range inside it while a range outside the fence still formats — all through the real ranges_formatting → format_range → LineRanges::new path, not mocked. All five passed. The on-type ; path's existing byte-identity test (on_type.rs:1100, format::range_formatting(...) ... compared against range_formatting output) was re-run unchanged and green — the dev's claim that no consumer needed to change holds.
  2. Gated capability's raw-params read. ranges_formatting_support at main.rs:373 is exactly params["capabilities"]["textDocument"]["rangeFormatting"]["rangesSupport"] == true. Extracted the identical function body into a standalone probe binary (character-for-character copy, diffed against the source to confirm) and drove it with every shape the brief asked for beyond the dev's own test: textDocument a string, rangeFormatting null, rangesSupport as the string "true", as 1, as [true], as an object, params entirely absent, capabilities an array, and duplicate JSON keys for rangesSupport (both orders). Result: only literal boolean true gates, every other shape answers false; duplicate keys resolve last-value-wins, which is serde_json's standard (and harmless — the client controls both the first and the last copy of its own key, so there's no cross-party spoofing surface here). Then the two real-wire e2e legs (ranges_formatting_is_advertised_to_a_client_that_asked_and_formats_every_range, a_3_17_client_still_sees_the_bare_true_it_always_saw in tests/e2e.rs) were re-run and pass: 3.17 client → bare true, confirmed byte-identical to what git show 17fb212 would have produced (the capability line is untouched by this round's diff at the pre-round call site — verified by inspecting initialize_value(false) reproduces serde_json::json!(true) in main.rs's own test at the same key). 3.18 client → the object. widening_the_range_capability_disturbs_nothing_else_in_the_initialize_result (main.rs) does insert-and-compare on the whole object, mirroring the_json_insertion_disturbs_nothing_else_in_the_initialize_result's pattern for typeHierarchyProvider — confirmed it swaps exactly one key and asserts full equality afterward, not a spot check.
  3. Union semantics. All five scenarios verified through the real engine (see item 1's temporary probes): merged single-statement ranges, reverse order, line-0-and-last-line, 50-range timing sanity, and format-off fence outranking an inside range while an outside range still formats. No surprises; every one matched the README's stated semantics.
  4. Refusal equality. a_refused_buffer_is_refused_identically_whichever_range_request_asked (format.rs) and a_refusal_is_the_same_answer_and_the_same_popup_on_both_range_methods (server.rs) both assert full Result/response equality and the window/showMessage traffic (session.shown()) is identical, not just "an error happened on both". Confirmed both tests actually run this comparison (not just constructing it) and pass.
  5. saturating_add fix — deliberate-breakage protocol run for real. Reverted format.rs:167 from range.end.line.saturating_add(1) back to range.end.line + 1, ran cargo test -p lucisv_server --bin lucisv-server the_line_conversion_is_the_one_rangeformatting_always_used: it panicked — attempt to add with overflow at format.rs:167:66 — exactly as claimed. Restored the fix, re-ran the same test: passes. git diff --stat on format.rs confirmed unchanged from the pre-revert state afterward.
  6. Parked items' evidence — every grep re-run independently and matched exactly. lsp-types-0.97.0 (found at ~/.cargo/registry/src/index.crates.io-*/lsp-types-0.97.0): grep -rn 'SnippetTextEdit' src/ → no match; WorkspaceEditClientCapabilities at lib.rs:1071 has exactly document_changes, resource_operations, failure_handling, normalizes_line_endings (truncated view, change_annotation_support follows) and no snippet_edit_support field; grep -rn 'textDocumentContent' src/ → only TextDocumentContentChangeEvent hits, an unrelated sync type, in lib.rs and notebook.rs. editors/vscode/node_modules/: grep -rln 'snippetEditSupport\|SnippetTextEdit' → no hits; grep -rln 'textDocumentContent' → no hits; grep -n 'registerTextDocumentContentProvider\|ContentProvider' extension.js → no hits. DocumentRangeFormattingClientCapabilities confirmed as a type alias to DynamicRegistrationClientCapabilities (formatting.rs:11 in the same crate). The re-check triggers in the README are literal, runnable grep commands — confirmed by running them as written.
  7. smoke.js change vs the real client. [email protected]'s lib/common/formatting.js:74 is capability.rangesSupport = true; inside DocumentRangeFormattingFeature.fillClientCapabilities — exact match to the dev's citation. Line 109 (if (options.rangesSupport) {) gates whether provideDocumentRangesFormattingEdits gets attached to the registered provider — also an exact match. features.js's getRegistrationOptions (the union-handling precedent cited) matches the description at the cited behavior (boolean true → bare {documentSelector}, otherwise {...capability, documentSelector}), modulo Object.assign vs spread syntax, which are equivalent. [email protected]'s protocol.d.ts:2900 (DocumentRangesFormattingParams) and :2945 (DocumentRangesFormattingRequest) both confirmed present at those exact lines. package.json engines: both editors/vscode/package.json and the vendored vscode-languageclient/package.json pin ^1.82.0 — confirmed. Ran smoke.js against the freshly built release binary: OK, 10 messages, matching the claimed count.
  8. CLAUDE.md compliance. Grepped every added line (git diff -U0) in format.rs, server.rs, main.rs for .unwrap()/.expect()/panic! outside the mod tests boundary (found at format.rs:231, server.rs:1602, main.rs:495) — every hit found is inside a test module; zero in production code paths. No new #[allow(...)] anywhere in the diff. RangesFormattingParams has a struct-level doc comment and undocumented fields, matching the existing project convention for hand-rolled params structs (pairs::ScopePairsParams/ScopePair follow the identical pattern). README has each of the seven mandated sections (Goal, Assumptions, Handshakes, Status / TODO, Work log, QA log, Review) exactly once, plus two extra descriptive ## subsections that don't collide with the mandated set. TODO.md's §9c item text is intact — checkbox flipped [ ]→[x], an appended → 2026-08-27 ... note in the same style as the two items directly above it, and it states both the shipped item and the two parked items with reasons, as required. verify.rs: confirmed untouched myself (git diff --quiet exit 0) — correctly, since invariant #4's attack-test requirement doesn't apply here (no normalization touched).

C. Beyond the list. Added and ran three more temporary probes (in server.rs's test module, added/run/reverted, diff restored to the original 190-line diffstat afterward):

  • ranges given as {} (an object, not an array) → InvalidParams, not a panic. Pass.
  • Extra unknown params fields (workDoneToken, an arbitrary nested object) alongside a valid request → ignored, request answered normally (#[serde(deny_unknown_fields)] is not on RangesFormattingParams, and nothing needed it to be — serde's default is permissive). Pass.
  • A client that advertises rangesSupport at initialize (so it gets the gated capability) but then only ever calls the old textDocument/rangeFormatting — confirmed the old path's answer is byte-identical to what it always was; the gate is purely advertisement, nothing about it changes range_formatting's own behavior. Pass.

No findings. No fixes were necessary — the round is clean at every attack surface asked for, plus the three extra ones above. All temporary QA probe tests were removed after running; the three touched source files are back to the exact diffstat the dev left them at (format.rs 229, server.rs 190, main.rs 145 lines changed — confirmed line-for-line via git diff --stat before and after).

This is the last feature round of §9c. Nothing here should block the 0.10.0 release cut: all gates green, vlog_formatter and verify.rs untouched (so invariant #4 doesn't apply), the corpus argument for "no new formatter code path" holds up under direct inspection (every byte still comes out of the pre-existing format_range), and the two parked items are parked with re-checkable, currently-true evidence rather than asserted from memory. Verdict: committable as-is.

Review

2026-08-27 — lead

Reviewed the diff, the work log and the QA log; re-ran all gates myself, clean. The right ending for the audit: one real feature shipped on the engine that already knew how to do it, and two honest parkings with evidence a future reader can re-run in one grep each. The round's discovery — the pinned client library has been requesting multi-range formatting all along, and our bare-boolean advertisement was the thing refusing it — is the audit's thesis in miniature: the gaps were in what we said, not only in what we did. The gated widening is the right conservatism (pre-round clients see a byte-identical initialize result, proven on the wire), and redefining range_formatting as the one-element case makes the refusal-equality property structural, which QA verified with differential probes through the real engine plus the deliberate-breakage check on the overflow fix. Declining to split the whole-document edit into per-range claims the engine never verified is exactly the invariant culture applied to a reply shape. This completes §9c and the LSP 3.18 audit's feature work. Accepted as shipped.