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]>
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:
- Each protocol
Rangebecomes a 1-based inclusive line span through the samelines_ofconversion 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. - 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. - One
format_rangecall. 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,40makes. - One whole-document
TextEdit, or none when the text did not change —rangeFormatting's reply shape, forrangeFormatting'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
rangesFormattinghowever it is advertised, so the object form buys that client exactly nothing. - The bare
trueis 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 serializeddocumentRangeFormattingProvidervalue, the precedentdocs/features/type-hierarchy/README.mdset fortypeHierarchyProvider. Same function, same test discipline (the whole object is pinned, not just the one key). - In: the flag is read from the raw
initializeparamsValuebefore it is deserialized intoInitializeParams, because the typed struct drops the field.main.rsalready 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:74sendscapability.rangesSupport = true, and:109registersprovideDocumentRangesFormattingEditsonly ifoptions.rangesSupportcame back from the server. So before this round the extension was asking for the feature and being told no.[email protected]carriesDocumentRangesFormattingRequestandDocumentRangesFormattingParams(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]requiresengines.vscode: ^1.82.0and setsprovideDocumentRangesFormattingEditson the provider it registers, so the VS Code API exists at the version this extension already targets (editors/vscode/package.jsonpins the same^1.82.0).- Neovim's built-in client sends
rangeFormatting, notrangesFormatting; 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::newis 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
--linesrule, documented inrange-formatting), and a range on a document the server does not hold answersnullbefore any of this runs. - Only line numbers matter. Same as
rangeFormatting: the UTF-16 columns are thrown away bylines_of, so there is nothing to get wrong about them. - A client that advertises
rangesSupportreads the union form ofdocumentRangeFormattingProvider. 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 ineditors/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, andformat::range_formattingis now defined as its one-element case. Both keep the old signature and the old answer.format::RANGES_FORMATTINGis the method string, andformat::RangesFormattingParamsthe decoded params.main::initialize_valuenow takes onebool(whether to widen the range formatting capability). Callers:main()and the tests inmain.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_ofextracted fromrange_formatting;ranges_formatting;range_formattingredefined as its one-element case;RANGES_FORMATTINGandRangesFormattingParams.server.rs: thetextDocument/rangesFormattingdispatch arm, sharingeditsandwarn_about_configwithrangeFormatting.main.rs:ranges_formatting_supportread from the raw initialize params;initialize_value(bool)widening the capability.- Tests — +24: 11 units in
format.rs, 7 session tests inserver.rs, 4 capability tests inmain.rs, 2 e2e legs over the real binary (one per client shape), plus asmoke.jsleg. - Docs: this README,
lucisv-server's capability table and Status, TODO.md §9c's last box. - Parked: snippet
WorkspaceEditedits — 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 editrangeFormattingalready sends. Splitting it intonedits 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
initializeand never changes, so there is nothing a registration would buy; a client that flipsrangesSupportmid-session does not exist.
Work log
2026-08-27 — dev agent
- Read
CLAUDE.md, TODO.md §9c, and the Handshakes oflucisv-server,range-formatting,type-hierarchyandmacro-expansionbefore writing anything. Baseline:cargo test -p lucisv_server993 unit + 48 e2e,cargo test --workspacegreen, clippy silent, fmt clean. - Checked all three items against
lsp-types0.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 forrangesFormatting, 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 sendingrangesSupport: trueat this server for as long as the extension has existed. lucisv was answering with a baretrueand 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::newsorts and merges (range.rs:38), which is exactly the "normalize overlapping/adjacent/unsorted ranges" the brief asked for, andformat_rangetakes the merged list. So the whole implementation is three lines ofmap(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,40makes. range_formattingbecame the one-element case ofranges_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 ofu32::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-languageclienthandles the union (features.js:230), so advertising it unconditionally would very probably be fine. But a client that never sentrangesSupportgains 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-identicalinitializeresult, asserted over the wire bya_3_17_client_still_sees_the_bare_true_it_always_saw. The pre-existing e2e assertiondocumentRangeFormattingProvider == trueneeded no edit, which is the same fact stated by an older test. - The client flag has to be read from the raw params.
lsp-types0.97 aliasesDocumentRangeFormattingClientCapabilitiesto the plain dynamic-registration struct, soserde_json::from_value::<InitializeParams>discardsrangesSupportbefore anything can look at it.main()already had the rawValuein 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.jswas changed in one substantive way: itsinitializenow sends therangeFormatting.rangesSupportcapability, 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_serverandeditors/vscode/smoke.jswas touched.verify.rs,vlog_formatter,vlog_parser,vlog_semantic,vlog_linter,crates/lucisv,corpus/, the.casestables anddocs/site/are all unmodified (git status --porcelainnames seven files — three server sources, its e2e,smoke.js,TODO.mdand thelucisv-serverREADME — plus this directory). No new dependency. Did not rungit commit/git push.
Results.
cargo test --workspace: 2176 passed, 0 failed across 34 test binaries. This feature's crate:lucisv_serverunit 993 → 1015 (+11format.rs, +7server.rs, +4main.rs), e2e 48 → 50.cargo test -p vlog_formatter: 180 passed, 0 failed — untouched, andgit diff --quiet crates/vlog_formatterexits 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 newrangesFormattingleg included.- No corpus run and no
verify.rsattack 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 offormat_rangewith aLineRangesthe CLI could equally have built, so the corpus evidence indocs/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 withtouchon 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 everytest result:line to confirm the dev's total rather than trusting it.lucisv_serverunit 1015 (993→1015, +22: 11format.rs+ 7server.rs- 4
main.rs), e2e 50 (48→50, +2) — matches the claimed +24 exactly.
- 4
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 --quieton 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.
range_formattingredefinition. Enumerated callers by grep: onlyserver.rs'srange_formattinghandler andon_type.rs's;-trigger (format::range_formattingaton_type.rs:83and its test aton_type.rs:1100) callformat::range_formatting; both keep the exact old(doc, config, range: Range)signature, so neither needed to change and neither did. Added a temporary probe informat.rs's test module (added, run, reverted before finishing —git diff --staton 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 realranges_formatting→format_range→LineRanges::newpath, not mocked. All five passed. The on-type;path's existing byte-identity test (on_type.rs:1100,format::range_formatting(...) ...compared againstrange_formattingoutput) was re-run unchanged and green — the dev's claim that no consumer needed to change holds.- Gated capability's raw-params read.
ranges_formatting_supportatmain.rs:373is exactlyparams["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:textDocumenta string,rangeFormattingnull,rangesSupportas the string"true", as1, as[true], as an object, params entirely absent,capabilitiesan array, and duplicate JSON keys forrangesSupport(both orders). Result: only literal booleantruegates, every other shape answersfalse; duplicate keys resolve last-value-wins, which isserde_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_sawintests/e2e.rs) were re-run and pass: 3.17 client → baretrue, confirmed byte-identical to whatgit show 17fb212would have produced (the capability line is untouched by this round's diff at the pre-round call site — verified by inspectinginitialize_value(false)reproducesserde_json::json!(true)inmain.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, mirroringthe_json_insertion_disturbs_nothing_else_in_the_initialize_result's pattern fortypeHierarchyProvider— confirmed it swaps exactly one key and asserts full equality afterward, not a spot check. - 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.
- Refusal equality.
a_refused_buffer_is_refused_identically_whichever_range_request_asked(format.rs) anda_refusal_is_the_same_answer_and_the_same_popup_on_both_range_methods(server.rs) both assert fullResult/response equality and thewindow/showMessagetraffic (session.shown()) is identical, not just "an error happened on both". Confirmed both tests actually run this comparison (not just constructing it) and pass. saturating_addfix — deliberate-breakage protocol run for real. Revertedformat.rs:167fromrange.end.line.saturating_add(1)back torange.end.line + 1, rancargo test -p lucisv_server --bin lucisv-server the_line_conversion_is_the_one_rangeformatting_always_used: it panicked —attempt to add with overflowatformat.rs:167:66— exactly as claimed. Restored the fix, re-ran the same test: passes.git diff --statonformat.rsconfirmed unchanged from the pre-revert state afterward.- 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;WorkspaceEditClientCapabilitiesatlib.rs:1071has exactlydocument_changes,resource_operations,failure_handling,normalizes_line_endings(truncated view,change_annotation_supportfollows) and nosnippet_edit_supportfield;grep -rn 'textDocumentContent' src/→ onlyTextDocumentContentChangeEventhits, an unrelated sync type, inlib.rsandnotebook.rs.editors/vscode/node_modules/:grep -rln 'snippetEditSupport\|SnippetTextEdit'→ no hits;grep -rln 'textDocumentContent'→ no hits;grep -n 'registerTextDocumentContentProvider\|ContentProvider' extension.js→ no hits.DocumentRangeFormattingClientCapabilitiesconfirmed as a type alias toDynamicRegistrationClientCapabilities(formatting.rs:11in the same crate). The re-check triggers in the README are literal, runnable grep commands — confirmed by running them as written. smoke.jschange vs the real client.[email protected]'slib/common/formatting.js:74iscapability.rangesSupport = true;insideDocumentRangeFormattingFeature.fillClientCapabilities— exact match to the dev's citation. Line 109 (if (options.rangesSupport) {) gates whetherprovideDocumentRangesFormattingEditsgets attached to the registered provider — also an exact match.features.js'sgetRegistrationOptions(the union-handling precedent cited) matches the description at the cited behavior (booleantrue→ bare{documentSelector}, otherwise{...capability, documentSelector}), moduloObject.assignvs spread syntax, which are equivalent.[email protected]'sprotocol.d.ts:2900(DocumentRangesFormattingParams) and:2945(DocumentRangesFormattingRequest) both confirmed present at those exact lines.package.jsonengines: botheditors/vscode/package.jsonand the vendoredvscode-languageclient/package.jsonpin^1.82.0— confirmed. Ransmoke.jsagainst the freshly built release binary: OK, 10 messages, matching the claimed count.- CLAUDE.md compliance. Grepped every added line (
git diff -U0) informat.rs,server.rs,main.rsfor.unwrap()/.expect()/panic!outside themod testsboundary (found atformat.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.RangesFormattingParamshas a struct-level doc comment and undocumented fields, matching the existing project convention for hand-rolled params structs (pairs::ScopePairsParams/ScopePairfollow 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 --quietexit 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):
rangesgiven 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 onRangesFormattingParams, and nothing needed it to be — serde's default is permissive). Pass. - A client that advertises
rangesSupportatinitialize(so it gets the gated capability) but then only ever calls the oldtextDocument/rangeFormatting— confirmed the old path's answer is byte-identical to what it always was; the gate is purely advertisement, nothing about it changesrange_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.