Inline templates round 2: aligned snippets, the designer trigger set
User report: accepted ghost text left `end` deeper than its opener. Root cause proven from VS Code source: SnippetSession.adjustWhitespace (default on, no opt-out on the inline-accept path) prepends the trigger line's indent to snippet lines 2+, and the server baked it in too — double indent. Fix is asymmetric because the protocols differ: ghost bodies now emit relative indentation (one \t per step, editor settings place it); the completion popup — latently double-indented since 0.4.0 — keeps its absolute layout and sends insertTextMode: asIs, the opt-out only that path has. QA modeled the normalization independently from the same source; closer-lands-level is pinned per trigger, depth and tab/space config. Trigger table grows to the RTL set: case/casez/casex -> endcase (paren+ scope gate), for ( dialect-split, while (, always_ff @( (SV), always @( offering posedge then *) as two cycleable items, fork -> join, generate -> endgenerate, module -> named endmodule. Openers are token sequences now; hygiene tests generalized (accepted-text-parses models the editor's insertion; scope-balance and gate-matches-body derived tests). 1644 tests green. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
df53ecea2c
commit
765cd010c2
7 files changed
+1562
-161
No files matched your search
@@ -58,7 +58,9 @@ templates used to live. Those are gone; see *Reconciliation* below.
|
||||
added without an escape.
|
||||
- **`vfmt.indent` (default 2) is the indent step**, and the line's own leading
|
||||
whitespace is the base — the same `Layout` M4's skeletons use, resolved the
|
||||
same way and with the same deviation from `vfmt.toml` recorded there.
|
||||
same way and with the same deviation from `vfmt.toml` recorded there. Because
|
||||
the base is baked in, the item must tell the client not to indent it again:
|
||||
see *The indentation contract* below.
|
||||
- **A template is offered on prefix, not on fuzzy match.** The server filters
|
||||
with `starts_with_ignore_case` on the template's prefix exactly as the other
|
||||
tiers filter on a name, so `alw` finds every `always*` template and `wh`
|
||||
@@ -258,6 +260,49 @@ snippets)` — so they cannot drift, and
|
||||
`the_two_spellings_of_a_body_are_the_same_text` asserts that stripping the
|
||||
tabstops out of the snippet gives the plain text back.
|
||||
|
||||
## The indentation contract
|
||||
|
||||
**Added 2026-08-25, fixing a bug that had been in the popup since 0.4.0 and
|
||||
was found while fixing its twin in `inline-templates`.**
|
||||
|
||||
Every multi-line body here already carries the site's indentation: `Layout`'s
|
||||
`base` is the trigger line's leading whitespace and every line after the first
|
||||
starts with it. VS Code then indents it *again*. `suggestController.ts`'s
|
||||
`_insertSuggestion` calls
|
||||
|
||||
```ts
|
||||
snippetController.insert(insertText, {
|
||||
…,
|
||||
adjustWhitespace: !(item.completion.insertTextRules! & CompletionItemInsertTextRule.KeepWhitespace),
|
||||
…
|
||||
});
|
||||
```
|
||||
|
||||
and `SnippetSession.adjustWhitespace` prepends the insertion line's own
|
||||
leading whitespace to every line after the first, then re-spells the run with
|
||||
`TextModel.normalizeIndentation`. So `if` accepted four spaces in wrote its
|
||||
body at twelve and its `end` at eight — one level right of the `if`.
|
||||
|
||||
The escape hatch is LSP's `insertTextMode`. `asIs` says "the string is taken
|
||||
as it is… the client will not apply any kind of adjustments". The vendored
|
||||
`vscode-languageclient` 9.0.1 advertises support for it
|
||||
(`completion.js:59`), turns it into `keepWhitespace: true`
|
||||
(`protocolConverter.js:342-346`), and `extHostLanguageFeatures.ts` turns
|
||||
*that* into the `KeepWhitespace` rule that clears `adjustWhitespace`.
|
||||
|
||||
So `completion.rs` sends `insertTextMode: asIs` (the `KEEP_MY_INDENTATION`
|
||||
constant) on the two item builders that write more than one line: the template
|
||||
tier and the module-instantiation skeleton. Single-line items neither need it
|
||||
nor are harmed by it, so they do not send it. It is the right answer for the
|
||||
plain-text spelling as well — that text is absolutely positioned too — which
|
||||
is why this path did **not** switch to relative indentation the way ghost text
|
||||
had to. An inline completion has no `insertTextMode` field at all; see
|
||||
`docs/features/inline-templates/README.md`'s *The indentation contract*.
|
||||
|
||||
Pinned by `tests/e2e.rs` (`insertTextMode == 1` on both the template item and
|
||||
the module skeleton), over the wire, beside the `newText` each already
|
||||
asserted.
|
||||
|
||||
## Reconciliation with the static VS Code snippets
|
||||
|
||||
Nine snippets were deleted from `editors/vscode/snippets/*.json` because the
|
||||
@@ -391,6 +436,24 @@ in the feature READMEs that record what happened at those versions.
|
||||
`smoke: OK`; `npx --no-install @vscode/vsce ls` still lists both snippet
|
||||
files. No new dependency.
|
||||
|
||||
- **2026-08-25 (dev, inline-templates round 2)** — one field, one latent bug.
|
||||
|
||||
While fixing the same double-indentation bug in ghost text I read
|
||||
`suggestController.ts` and found the popup had it too: every multi-line item
|
||||
this tier sends was being re-indented by the editor on accept, since 0.4.0.
|
||||
Fixed with `insertTextMode: asIs` on `Items::template` and on `item` (the
|
||||
module-instantiation skeleton), behind the `KEEP_MY_INDENTATION` constant so
|
||||
the reasoning sits with the value. Full derivation and sources in *The
|
||||
indentation contract* above; the inline half is in
|
||||
`docs/features/inline-templates/README.md`.
|
||||
|
||||
**Flagged for the lead:** the module-skeleton item belongs to
|
||||
`refactor-instantiate`, not to this feature — the code is in
|
||||
`completion.rs`, it is the identical bug, and leaving it broken beside the
|
||||
fixed template item would have been the odd choice. `templates.rs` itself is
|
||||
untouched: no body, no label, no gate, no renderer changed. Two `e2e.rs`
|
||||
assertions added; nothing else.
|
||||
|
||||
## QA log
|
||||
|
||||
**2026-08-24 — QA agent.**
|
||||
@@ -599,6 +662,58 @@ The one finding (CHANGELOG miscount) was cosmetic, unambiguous, and fixed
|
||||
in place. No gate, attack, or reconciliation check turned up anything that
|
||||
needs dev rework.
|
||||
|
||||
**2026-08-25 — QA agent, round 2 (the `insertTextMode` popup fix).**
|
||||
|
||||
This feature's only change in round 2 is the four-line diff in
|
||||
*The indentation contract* above (`completion.rs`): `insert_text_mode:
|
||||
Some(KEEP_MY_INDENTATION)` on `Items::template`
|
||||
(`crates/vfmt_server/src/completion.rs:459`) and on `item`, the
|
||||
module-instantiation skeleton (`:612`); `layout_at`
|
||||
(`crates/vfmt_server/src/completion.rs:326-329`) re-privatized because
|
||||
`inline.rs` no longer names it. `templates.rs` is untouched, confirmed by
|
||||
`git diff --stat` (absent from the diff entirely). Full attack and gate
|
||||
detail — the trigger-table work is this round's real surface — is in
|
||||
`docs/features/inline-templates/README.md`'s 2026-08-25 round-2 QA entry;
|
||||
this entry covers only what round 2 touched here.
|
||||
|
||||
- **The wire value.** `crates/vfmt_server/src/completion.rs:156` in
|
||||
`lsp-types` 0.97.0 (registry source, read directly):
|
||||
`pub const AS_IS: InsertTextMode = InsertTextMode(1)`;
|
||||
`ADJUST_INDENTATION = InsertTextMode(2)`. So `KEEP_MY_INDENTATION` is `1`,
|
||||
matching LSP 3.17's `InsertTextMode` enum (`asIs = 1`). Both pins in
|
||||
`tests/e2e.rs` assert `insertTextMode == 1` — the template item at
|
||||
`crates/vfmt_server/tests/e2e.rs:1258` and the module skeleton at
|
||||
`:1625` — and both are correct. (The QA brief itself floated "`asIs` (2)"
|
||||
as a parenthetical; that would have been `AdjustIndentation`, not `AsIs`
|
||||
— checked against the source rather than trusted, and the shipped code is
|
||||
right.)
|
||||
- **No leak onto single-line items.** `grep -n "insert_text_mode"
|
||||
crates/vfmt_server/src/completion.rs` returns exactly the two call sites
|
||||
above. `Items::simple` (`completion.rs:412-430`, the keyword/word/index
|
||||
tiers' single-line items) builds its `CompletionItem` with
|
||||
`..Default::default()`, which leaves `insert_text_mode: None` — confirmed
|
||||
by reading the struct literal, not inferred. So plain keyword and word
|
||||
items are unaffected, as required.
|
||||
- **Client capability path.** `editors/vscode/node_modules/
|
||||
vscode-languageclient/lib/common/completion.js:59` advertises
|
||||
`insertTextModeSupport.valueSet: [asIs, adjustIndentation]` as part of the
|
||||
standard completion capabilities — no code in this repo has to opt into
|
||||
it, unlike `inlineCompletion`'s proposed-feature registration.
|
||||
`protocolConverter.js:342-346` turns `insertTextMode === asIs` into
|
||||
`result.keepWhitespace = true`, which `extHostLanguageFeatures.ts` turns
|
||||
into the `KeepWhitespace` insert-text rule `suggestController.ts` checks
|
||||
before calling `adjustWhitespace`. Traced end to end; matches the Work
|
||||
log's claim.
|
||||
- **Gates, re-run independently:** `cargo fmt --all -- --check` clean;
|
||||
`cargo clippy --all-targets --workspace` zero warnings; `cargo test
|
||||
--workspace` 1644 passed / 0 failed / 4 ignored (up from the round-2 dev's
|
||||
1633 — 11 new tests, all in `inline.rs`, none in this feature's own
|
||||
files); `node editors/vscode/smoke.js target/debug/vfmt-server` →
|
||||
`smoke: OK`; `node --check` on `smoke.js` and a `JSON.parse` of
|
||||
`package.json` both clean.
|
||||
|
||||
No findings against this feature's own round-2 diff. No commit, no push.
|
||||
|
||||
## Review
|
||||
|
||||
**2026-08-24 — lead.** Reviewed after QA's ship verdict — second clean
|
||||
@@ -616,3 +731,12 @@ accepted. Lead post-review fix: the extension README's relative link to
|
||||
this doc broke `vsce package` (no repository URL to resolve it against) —
|
||||
demoted to plain-text path. M6 checked off in the umbrella plan and
|
||||
TODO.md §8; ships as 0.4.0.
|
||||
|
||||
**2026-08-25 — lead review of the insertTextMode fix.** The popup's
|
||||
skeletons were latently double-indented in VS Code since 0.4.0 — same
|
||||
root cause as inline-templates round 2, different fix because the
|
||||
completion protocol has the opt-out the inline one lacks:
|
||||
`insertTextMode: asIs` (verified = 1 on the wire against lsp-types
|
||||
source, by QA) on the two multi-line tiers only. `templates.rs` and the
|
||||
plain-text fallback untouched, `vfmt.indent` still meaningful here.
|
||||
Approved; ships as 0.7.0.
|
||||
@@ -12,6 +12,11 @@ the VS Code extension. It is the completion-templates tier without the
|
||||
completion widget: the same skeletons, offered at the moment the user has
|
||||
already committed to the construct, so accepting one costs a single key.
|
||||
|
||||
Round 2 (2026-08-25) fixed the indentation of the accepted text — the body
|
||||
is now indented *relative* to the trigger line, because the editor supplies
|
||||
the absolute part — and widened the table from two triggers to the dozen
|
||||
constructs an RTL designer opens all day. See *The triggers* below.
|
||||
|
||||
## Assumptions
|
||||
|
||||
- **The client understands snippet inline completions.** LSP 3.18 gives no
|
||||
@@ -32,20 +37,133 @@ already committed to the construct, so accepting one costs a single key.
|
||||
Handshakes below for the exact rule and what it cannot see (`` `ifdef ``
|
||||
arms, macro bodies). Being wrong costs one unwanted grey suggestion the
|
||||
user ignores, never a buffer edit — nothing is inserted until Tab.
|
||||
- **The snippet is indented relative to the trigger line, and the editor
|
||||
supplies the rest.** One `\t` per indent step, no `base` — see *The
|
||||
indentation contract* below for the VS Code source this is read off, and
|
||||
for what it costs. Consequence worth naming twice: **`vfmt.indent` does
|
||||
not decide the width of an accepted ghost snippet.** The editor's own
|
||||
`editor.tabSize`/`editor.insertSpaces` do, because the editor rewrites
|
||||
the leading whitespace of every inserted line whatever the server sent.
|
||||
`vfmt.inlineTemplates`'s setting description says so.
|
||||
- **There is no position gate**, unlike the completion tier's
|
||||
`at_statement` / `at_item`. Having just typed `if (` or `begin` at the
|
||||
end of a line is already a far stronger signal than a two-letter prefix
|
||||
in a completion list, and both bodies are legal at *both* positions
|
||||
in a completion list, and most bodies are legal at *both* positions
|
||||
anyway: `if (…) begin … end` is a statement inside a procedural block
|
||||
and a conditional generate construct at module scope, and a bare
|
||||
`begin … end` is a block in either. Adding the gate would only cost
|
||||
correct suggestions in the places the heuristic misreads.
|
||||
correct suggestions in the places the heuristic misreads. The triggers
|
||||
that really do belong at one position only — `module`, `generate`,
|
||||
`always`, `always_ff` — are gated hard enough by their own keyword: an
|
||||
unmatched `module` keyword at statement position is a buffer that does
|
||||
not compile either way, and the ghost is the least of it.
|
||||
- **The dialect is the file extension**, resolved by
|
||||
`templates::dialect(doc.path)` — the same rule and the same
|
||||
Verilog-by-default answer for a pathless buffer that the completion
|
||||
tier documents. Two triggers use it: `for (` picks the SystemVerilog or
|
||||
the Verilog loop header, and `always_ff @(` is refused outright in a
|
||||
`.v` buffer, whose compiler would reject the keyword.
|
||||
- **`casex (` is offered here although `templates.rs` refuses to list it.**
|
||||
The popup's reason for leaving `casex` out is that an item nobody uses is
|
||||
noise in a list. Ghost text is not a list: it only ever appears once the
|
||||
user has typed `casex (` and committed to the construct, so there is no
|
||||
noise to make and refusing to finish it would just be unhelpful.
|
||||
- **`always @(` answers with two items, `always_ff @(` with one.** The
|
||||
response is a list and VS Code cycles it with `Alt+]`/`Alt+[`; order is
|
||||
offer priority, clocked first, because `always @(` is overwhelmingly a
|
||||
flop. Everything else answers with exactly one item, and that shape is
|
||||
pinned so a future trigger cannot quietly turn a single offer into a
|
||||
menu.
|
||||
- **`vfmt.inlineTemplates` unset means on.** Every other `vfmt.*` setting
|
||||
is "no opinion until a client says otherwise"; this one's absence
|
||||
resolves to `true`, which is what the VS Code default declares.
|
||||
- The indent step is `vfmt.indent`, falling back to 2 — exactly what the
|
||||
template tier of `completion.rs` uses. The server does not read
|
||||
`vfmt.toml` for this (it does not read it for completion either).
|
||||
|
||||
## The triggers
|
||||
|
||||
`(` and `@(` in the *Typed* column are token sequences, not text: `if(` and
|
||||
`if (` are the same two tokens, and a `// if (` is not a token at all.
|
||||
|
||||
| Typed | Dialect | Gate | Offered |
|
||||
|---|---|---|---|
|
||||
| `if (` | both | paren | `${1:cond}) begin` / `$0` / `end` |
|
||||
| `while (` | both | paren | `${1:cond}) begin` / `$0` / `end` |
|
||||
| `for (` | SV | paren | `int ${1:i} = 0; $1 < ${2:N}; $1++) begin` / `$0` / `end` |
|
||||
| `for (` | Verilog | paren | `${1:i} = 0; $1 < ${2:N}; $1 = $1 + 1) begin` / `$0` / `end` |
|
||||
| `case (` | both | paren + scope | `${1:sel})` / `${2:value}: $0;` / `default: ;` / `endcase` |
|
||||
| `casez (` | both | paren + scope | as `case` |
|
||||
| `casex (` | both | paren + scope | as `case` |
|
||||
| `always_ff @(` | SV | paren | `posedge ${1:clk}) begin` / `$0` / `end` |
|
||||
| `always @(` | both | paren | `posedge ${1:clk}) begin` / `$0` / `end`, **then** `*) begin` / `$0` / `end` |
|
||||
| `begin` | both | scope | *(nothing)* / `$0` / `end` |
|
||||
| `fork` | both | scope | *(nothing)* / `$0` / `join` |
|
||||
| `generate` | both | scope | *(nothing)* / `$0` / `endgenerate` |
|
||||
| `module` | both | scope | ` ${1:name};` / `$0` / `endmodule` |
|
||||
|
||||
Fourteen bodies over thirteen triggers. The bodies are the popup templates'
|
||||
with the text the user has already typed cut off the front, so the two tiers
|
||||
cannot offer different shapes for the same construct — `for` even keeps the
|
||||
popup's dialect split.
|
||||
|
||||
Two details worth naming. **`module`'s body starts with a space and writes a
|
||||
name**: `module` alone is not a parseable header, and no placeholder can be
|
||||
put in front of text the user already typed, so the body supplies
|
||||
` ${1:name};` and the parse test proves it. **The `case` arm keeps the
|
||||
popup's `$0`** — the brief's sketch wrote `${2:value}: ;` — because a
|
||||
tabstop the user lands on is worth more than one they have to go find, and
|
||||
because it is what `templates.rs` already writes.
|
||||
|
||||
Deliberately absent: **`function`/`task`**. Their headers need a name the
|
||||
user has not typed yet, in a position no placeholder can reach without
|
||||
editing backwards over the keyword, so no accepted text parses. If a clean
|
||||
shape turns up it can be one more row.
|
||||
|
||||
## The indentation contract
|
||||
|
||||
The 0.6.0 bug, and the reason the bodies here are spelled differently from
|
||||
`templates.rs`'s.
|
||||
|
||||
VS Code inserts an accepted inline completion by calling
|
||||
`SnippetController2.insert(snippet, { undoStopBefore: false })`
|
||||
(`inlineCompletionsModel.ts`'s `accept`). It passes no `adjustWhitespace`,
|
||||
and `snippetSession.ts`'s `_defaultOptions` sets it to **`true`**.
|
||||
`SnippetSession.adjustWhitespace` then walks the snippet's text markers and
|
||||
does two things:
|
||||
|
||||
```ts
|
||||
lines[0] = model.normalizeIndentation(lines[0]); // the snippet start
|
||||
…
|
||||
for (let i = 1; i < lines.length; i++) {
|
||||
lines[i] = model.normalizeIndentation(lineLeadingWhitespace + lines[i]);
|
||||
}
|
||||
```
|
||||
|
||||
`lineLeadingWhitespace` is `getLeadingWhitespace(line, 0, position.column - 1)`
|
||||
— the insertion line's own indentation. So **every line after the first gets
|
||||
the trigger line's indentation prepended**, and the whole leading run is then
|
||||
re-spelled by `TextModel.normalizeIndentation` in the editor's
|
||||
`tabSize`/`insertSpaces`.
|
||||
|
||||
A body that had already baked that indentation in — which is what `Layout`'s
|
||||
`base` is — therefore came out at *twice* it. `if (` inside a block indented
|
||||
four spaces wrote its body at twelve and its `end` at eight, one level right
|
||||
of the `if` it closes. That is the user's report, exactly.
|
||||
|
||||
The fix is to send only what the editor cannot know: **one `\t` per indent
|
||||
step, and nothing else.** `normalizeIndentation` counts a `\t` as one tab
|
||||
stop and re-emits the run in the user's own spelling, so `\t` is the one
|
||||
character that means "one more level, however you write levels". The `end`
|
||||
carries no `\t` at all and lands level with its opener.
|
||||
|
||||
**The preview is the one thing this makes slightly worse, knowingly.**
|
||||
`provideInlineCompletions.ts` builds the grey text from `snippet.toString()`
|
||||
and `ghostTextView.ts` renders those lines verbatim — no
|
||||
`adjustWhitespace` runs before the user presses Tab — so the ghost body is
|
||||
drawn one tab from column zero rather than at its final column. Correctness
|
||||
of the accepted text wins: the preview is a hint, the buffer is the product.
|
||||
|
||||
The **completion popup** has the same trap and a different escape hatch —
|
||||
see `docs/features/completion-templates/README.md`'s *The indentation
|
||||
contract*.
|
||||
|
||||
## Handshakes
|
||||
|
||||
@@ -61,17 +179,22 @@ already committed to the construct, so accepting one costs a single key.
|
||||
`unmatched_open`. That is stricter and more honest than a global count:
|
||||
`always_comb begin` / freshly typed `begin` / `end` leaves the *new*
|
||||
`begin` matched by the existing `end`, and no ghost appears.
|
||||
- `crate::completion::layout_at` — **new, exported for this module.** It is
|
||||
the body of what used to be `completion.rs`'s private `layout`, taken by
|
||||
offset instead of by `Word`, so the ghost body and the completion-list
|
||||
template are indented by one function and cannot drift. `completion.rs`
|
||||
now calls it too.
|
||||
- ~~`crate::completion::layout_at`~~ — **no longer consumed, as of
|
||||
2026-08-25.** It was exported for this module so that ghost text and the
|
||||
completion list could not indent the same body differently; ghost text now
|
||||
emits relative indentation and has no layout at all, so `layout_at` is
|
||||
private to `completion.rs` again. Nothing else consumed it, and the
|
||||
compiler confirmed it.
|
||||
- ~~`vlog_refactor::Layout`~~ — same, for the same reason. This module no
|
||||
longer names the type.
|
||||
- `crate::templates::{dialect, Dialect}` — **new**, the file-extension rule
|
||||
the completion tier already uses, read for the `for (` split and the
|
||||
`always_ff @(` refusal. Nothing in `templates.rs` changed for this.
|
||||
- `crate::settings::ClientSettings::inline_templates` — **new field**,
|
||||
`Option<bool>` from `vfmt.inlineTemplates`. Nothing else reads it;
|
||||
`Workspace::set_client_settings` does not treat it as a scope change, so
|
||||
toggling it rebuilds no index.
|
||||
- `vlog_refactor::Layout` — `{ base, step }`, rendered exactly as
|
||||
`templates.rs` renders a body.
|
||||
toggling it rebuilds no index. `ClientSettings::indent` is **no longer
|
||||
read here** (see *The indentation contract*).
|
||||
|
||||
**Promised**
|
||||
|
||||
@@ -84,6 +207,17 @@ already committed to the construct, so accepting one costs a single key.
|
||||
`the_wire_shape_is_what_the_client_reads` pins that JSON, so a future
|
||||
`lsp-types` bump that changes `InlineCompletionItem` cannot silently
|
||||
turn the snippet into plain text.
|
||||
- **The snippet's whitespace is the client's to finish.** Every line after
|
||||
the first is `\t`-per-step with no absolute component; a client that
|
||||
inserts an inline completion verbatim, without prepending the insertion
|
||||
line's indentation, will produce a flat body. That is the LSP 3.18
|
||||
inline-completion contract as VS Code implements it and there is no field
|
||||
to negotiate it, unlike `completionItem.insertTextMode`. Recorded here so a
|
||||
future non-VS-Code client's ticket lands on this paragraph.
|
||||
- **Request to `completion.rs` (made and applied, 2026-08-25):** the popup's
|
||||
multi-line items now send `insertTextMode: asIs`. See the QA/Review note in
|
||||
the work log — the change is one field on two item builders and is
|
||||
documented in `completion-templates`' README.
|
||||
- Root `Cargo.toml`: `lsp-types` gains `features = ["proposed"]`. That
|
||||
feature also adds `offset_encoding` fields to `ClientCapabilities`,
|
||||
`InitializeResult` and `TextDocumentClientCapabilities` — all
|
||||
@@ -109,6 +243,32 @@ already committed to the construct, so accepting one costs a single key.
|
||||
- [x] End-to-end test in `crates/vfmt_server/tests/e2e.rs`
|
||||
- [x] `cargo fmt` / `cargo clippy --all-targets` / `cargo test` green
|
||||
|
||||
### Round 2 — 2026-08-25
|
||||
|
||||
- [x] **Bug: `begin`/`end` misaligned after accepting.** Bodies are emitted
|
||||
relative (`\t` per step, no `base`); the VS Code source this is read
|
||||
off is quoted in *The indentation contract*.
|
||||
- [x] The same trap in the completion popup, fixed the other way it allows:
|
||||
`insertTextMode: asIs` on the template and module-skeleton items.
|
||||
- [x] `layout_at` un-exported; `Layout` no longer named by `inline.rs`.
|
||||
- [x] Trigger table generalised: opener is a token *sequence*, a trigger may
|
||||
be dialect-gated, a trigger may offer several bodies, and the gate can
|
||||
ask both questions.
|
||||
- [x] New triggers: `while (`, `for (` (both dialects), `case (`/`casez (`/
|
||||
`casex (`, `always @(` (two items), `always_ff @(` (SV), `fork`,
|
||||
`generate`, `module`.
|
||||
- [x] Hygiene tests generalised over the new table: every accepted body
|
||||
parses at *its own* position, every body is scope-balanced, every gate
|
||||
is derived from the body rather than restated, every hole is a tabstop,
|
||||
every trigger word is a keyword.
|
||||
- [x] Wire pins updated: `inline.rs` unit tests, `tests/e2e.rs` (including a
|
||||
new multi-item round trip and the popup's `insertTextMode`),
|
||||
`editors/vscode/smoke.js`.
|
||||
- [x] `vfmt.inlineTemplates`'s setting description names the new triggers and
|
||||
says the editor's indent settings, not `vfmt.indent`, size the result.
|
||||
- [ ] Not done, deliberately: no `function`/`task` triggers — see *The
|
||||
triggers*.
|
||||
|
||||
## Work log
|
||||
|
||||
**2026-08-25 — dev**
|
||||
@@ -170,6 +330,137 @@ already committed to the construct, so accepting one costs a single key.
|
||||
zero warnings, `cargo test` 1607 passed / 0 failed across the
|
||||
workspace.
|
||||
|
||||
**2026-08-25 — dev, round 2**
|
||||
|
||||
One bug report from real VS Code use ("the begin/end are not aligned — the
|
||||
`end` lands deeper than its opener") and one feature request (more triggers).
|
||||
|
||||
**The bug: read the client's source before writing a line.** The lead's
|
||||
diagnosis was right and is now verified against `microsoft/vscode` `main`
|
||||
rather than assumed. Everything quoted here I read directly:
|
||||
|
||||
- `src/vs/editor/contrib/snippet/browser/snippetSession.ts` —
|
||||
`static adjustWhitespace(model, position, adjustIndentation, snippet, filter?)`.
|
||||
`lineLeadingWhitespace = getLeadingWhitespace(line, 0, position.column - 1)`;
|
||||
the snippet's **first** line is only `model.normalizeIndentation(lines[0])`
|
||||
(no prepend, because `snippet.offset(marker) === 0`), a text marker that
|
||||
starts right after a line break gets the prepend too, and
|
||||
`for (let i = 1; i < lines.length; i++) lines[i] = model.normalizeIndentation(lineLeadingWhitespace + lines[i])`.
|
||||
In the same file, `_defaultOptions` is
|
||||
`{ overwriteBefore: 0, overwriteAfter: 0, adjustWhitespace: true, clipboardText: undefined, overtypingCapturer: undefined }`
|
||||
— **`adjustWhitespace` defaults to `true`.**
|
||||
- `src/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.ts`
|
||||
— the accept path is
|
||||
`SnippetController2.get(editor)?.insert(action.snippetInfo.snippet, { undoStopBefore: false })`.
|
||||
**No `adjustWhitespace` is passed**, so the default `true` applies and there
|
||||
is no LSP-side field that could switch it off: `InlineCompletionItem` has no
|
||||
`insertTextMode`, and `vscode-languageclient`'s `asInlineCompletionItem`
|
||||
reads only `insertText` (and `filterText`/`command` if truthy).
|
||||
`src/vs/editor/contrib/inlineCompletions/browser/controller/commands.ts` is
|
||||
only the action layer (`controller.model.get()?.accept(controller.editor)`).
|
||||
- `src/vs/editor/contrib/suggest/browser/suggestController.ts` — the popup
|
||||
path is
|
||||
`snippetController.insert(insertText, { …, adjustWhitespace: !(item.completion.insertTextRules! & CompletionItemInsertTextRule.KeepWhitespace), … })`.
|
||||
**Same adjustment, but with an opt-out**, and the opt-out is reachable from
|
||||
LSP: `protocolConverter.js:342-346` (vendored, 9.0.1) sets
|
||||
`result.keepWhitespace = true` when `insertTextMode === InsertTextMode.asIs`,
|
||||
`extHostLanguageFeatures.ts`'s `_convertCompletionItem` turns that into
|
||||
`CompletionItemInsertTextRule.KeepWhitespace`, and `completion.js:59` shows
|
||||
the client advertising `insertTextModeSupport.valueSet: [asIs, adjustIndentation]`,
|
||||
so the field is negotiated and honoured.
|
||||
- `.../model/provideInlineCompletions.ts` — the **preview** text is
|
||||
`snippet.toString()` (tabstops removed, defaults kept) with no adjustment,
|
||||
and `.../view/ghostText/ghostTextView.ts` renders those lines verbatim,
|
||||
expanding `\t` at the editor's `tabSize`.
|
||||
|
||||
So the popup was double-indenting too, silently, since 0.4.0 — nobody had
|
||||
reported it because the popup's templates are usually accepted at shallow
|
||||
indentation where twice a small number still looks plausible.
|
||||
|
||||
**Two different fixes, because the two paths offer different escapes.**
|
||||
|
||||
- **Inline** has no field, so the *text* has to change: `render` now emits
|
||||
one `\t` per indent step and no `base` at all, and no longer takes a
|
||||
`Layout`. `normalizeIndentation` re-spells the leading run in the user's own
|
||||
`tabSize`/`insertSpaces`, so `\t` is exactly "one more level, however you
|
||||
write levels". Deviation from the brief's sketch, recorded: the brief said
|
||||
"keep the absolute layout for the plain-text fallback" — there is no
|
||||
plain-text fallback on this path (an inline completion has no
|
||||
`snippetSupport` to negotiate), so nothing was kept.
|
||||
- **Popup** keeps its absolute layout and sends `insertTextMode: asIs`
|
||||
instead. **Deviation from the brief's expected shape, deliberately.** The
|
||||
brief expected relative bodies there too, but `asIs` is strictly better on
|
||||
that path: it fixes the snippet *and* the plain-text spelling with one
|
||||
field, it leaves `Template::render`'s single renderer for both spellings
|
||||
intact (`the_two_spellings_of_a_body_are_the_same_text` still holds), it
|
||||
keeps `vfmt.indent` meaningful for the popup, and it is the protocol saying
|
||||
what we mean — "this text is already positioned" — rather than a guess
|
||||
about what the client will do. The same field went on the module-instantiation
|
||||
skeleton (`completion.rs`'s `item`), which is laid out by the same `Layout`
|
||||
and had the identical latent bug; flagged for the lead because that skeleton
|
||||
belongs to `refactor-instantiate`, though the code is in `completion.rs`.
|
||||
- `completion::layout_at` is private again: this module was its only other
|
||||
caller.
|
||||
|
||||
**Consequence, documented in three places** (Assumptions here, the
|
||||
`vfmt.inlineTemplates` setting description, the module doc comment):
|
||||
`vfmt.indent` no longer sizes an accepted ghost snippet. The editor does.
|
||||
That is more correct — it matches whatever the user's tab settings are — but
|
||||
it is a visible behaviour change. The **preview** is now drawn one tab from
|
||||
column zero instead of at its final column, since no adjustment runs before
|
||||
Tab; correctness of the accepted text wins, and it is written down rather
|
||||
than discovered.
|
||||
|
||||
**The trigger table grew four capabilities, all data.** `opener` is a token
|
||||
*sequence* (`always @(` needs `@` then `(`); `dialect: Option<Dialect>` gates
|
||||
a body to `.sv` or to `.v` via `templates::dialect`; `bodies` is a slice, so
|
||||
one trigger can answer with a list; and `Unclosed` gained `ParenAndScope` for
|
||||
a body that writes both a `)` and a closer for the user's own keyword.
|
||||
|
||||
**Gates, one per construct, each documented in Assumptions.** The paren gate
|
||||
is the existing stack (`a_later_call_does_not_cancel_the_paren_just_typed`
|
||||
still pins it). The scope gate is `pairs::analyze` saying *this* keyword's own
|
||||
span is in `unmatched_open`, which is why `case (` typed above an already
|
||||
closed `case` still offers — that `case` really is unclosed — while `case (`
|
||||
typed above a bare `endcase` does not. Both are pinned
|
||||
(`a_case_that_already_has_its_endcase_offers_nothing`). `pairs.rs` already
|
||||
knows `disable fork;` and `wait fork;` open nothing, so the `fork` trigger
|
||||
inherits that for free; there is a test.
|
||||
|
||||
**Hygiene tests were generalised rather than duplicated.** `every()` walks
|
||||
every body of every trigger. `planted` maps a keyword to the position its
|
||||
construct is legal at (`module` at file scope, `generate`/`always`/`always_ff`
|
||||
at item position, everything else at statement position) with statement
|
||||
position as the *default*, so a future trigger either parses there or fails
|
||||
loudly. `accepted()` models what VS Code writes — prepend the base, widen each
|
||||
`\t` to one step — and `every_accepted_ghost_parses` feeds *that*, filled in,
|
||||
to the parser: the test now checks the text the user really ends up with
|
||||
rather than the text the server sends. Two tests are new and derived rather
|
||||
than restated: `every_accepted_ghost_is_scope_balanced` runs `pairs::analyze`
|
||||
over what the user typed plus what Tab writes, and `every_gate_is_the_one_the_body_needs`
|
||||
works out from each body whether it closes a scope it did not open, and
|
||||
asserts the gate matches.
|
||||
|
||||
**Not added, as instructed:** no `function`/`task` triggers. Their accepted
|
||||
text cannot parse without a name in a position no placeholder reaches, and no
|
||||
clean shape turned up. Reasoning is in *The triggers* so the next person does
|
||||
not re-derive it.
|
||||
|
||||
**No new popup templates.** The brief allowed adding `generate` and a module
|
||||
declaration to `templates.rs` for parity; not taken. Both are already covered
|
||||
by the static VS Code snippets (`genfor`, `module`, `modulep`) which
|
||||
`completion-templates`' *Reconciliation* deliberately keeps because a file
|
||||
template is worth having before the server starts, and adding server
|
||||
templates that collide with them would undo that ruling. Ghost text does not
|
||||
collide: it fires on a keyword the user has finished typing, not on a prefix
|
||||
in a list.
|
||||
|
||||
**Gates:** `cargo fmt --all -- --check` clean; `cargo clippy --all-targets
|
||||
--workspace` zero warnings; `cargo test --workspace` 1633 passed / 0 failed /
|
||||
4 ignored (up from 1614); `node editors/vscode/smoke.js target/debug/vfmt-server`
|
||||
→ `smoke: OK`; `node --check editors/vscode/smoke.js` and a `JSON.parse` of
|
||||
`package.json` both clean. No commit, no push.
|
||||
|
||||
## QA log
|
||||
|
||||
**2026-08-25 — QA**
|
||||
@@ -403,6 +694,185 @@ test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fin
|
||||
`node editors/vscode/smoke.js <debug-binary>` and `<release-binary>` both
|
||||
OK.
|
||||
|
||||
**2026-08-25 — QA, round 2**
|
||||
|
||||
**Verdict: pass.** No corruption risk (`verify.rs` and `vlog_formatter/` are
|
||||
untouched — confirmed by their absence from `git diff --stat`), no defect in
|
||||
the shipped code. Everything below is either a confirmation with a
|
||||
independent re-derivation, or a small hardening test added because the round
|
||||
asked for a wider net than the dev's own suite cast. No fix was needed.
|
||||
|
||||
**Gates**
|
||||
|
||||
- `cargo fmt --all -- --check`: clean (after formatting my own additions —
|
||||
see *What I changed*).
|
||||
- `cargo clippy --all-targets --workspace`: zero warnings.
|
||||
- `cargo test --workspace`: **1644 passed / 0 failed / 4 ignored** (up from
|
||||
the round-2 dev's 1633 — my 11 new tests, all in `inline.rs`; full tail
|
||||
below).
|
||||
- `cargo build -p vfmt_server && node editors/vscode/smoke.js
|
||||
target/debug/vfmt-server`: `smoke: OK`. Ran with the debug binary's
|
||||
explicit path, not a bare `vfmt-server`, for the reason round 1's QA log
|
||||
already flagged (a stale `$PATH` binary predating this feature answers
|
||||
`capability missing`).
|
||||
- `node --check editors/vscode/smoke.js` and a `JSON.parse` of
|
||||
`editors/vscode/package.json`: both clean.
|
||||
|
||||
**Item 2 — simulating VS Code's insertion end to end.** This is the item the
|
||||
round exists for, so it got the most independent work: a *second*, from-source
|
||||
re-implementation of `TextModel.normalizeIndentation`/
|
||||
`normalizeIndentationFromWhitespace` and `SnippetSession.adjustWhitespace`
|
||||
(`normalize_indentation_from_whitespace`, `normalize_indentation`,
|
||||
`accepted_faithful` — `crates/vfmt_server/src/inline.rs:1108-1177`), built
|
||||
straight from the quoted VS Code source rather than from the dev's `accepted()`
|
||||
shortcut, so a divergence in the shortcut would have somewhere independent to
|
||||
show up.
|
||||
|
||||
- `the_accepted_helper_matches_vscodes_own_algorithm_for_a_self_consistent_buffer`
|
||||
(`inline.rs:1179`) cross-checks `accepted()` against `accepted_faithful()`
|
||||
for **every trigger's every body**, at depths 0/1/2/5, in spaces-at-2,
|
||||
spaces-at-4 and tabs. All agree. This is not a coincidence worth leaving
|
||||
unexplained: `accepted()`'s shortcut (prepend `base` verbatim, re-spell only
|
||||
the `\t`s the body added) is provably equal to the real column-counting
|
||||
algorithm exactly when `base` is already spelled as a whole number of the
|
||||
editor's own indent unit — the ordinary case, and the only one the dev's
|
||||
suite or mine exercises. A buffer whose on-disk indentation uses a
|
||||
*different* character or width than the editor's current
|
||||
`tabSize`/`insertSpaces` (a tab-indented file opened under
|
||||
`insertSpaces: true`, say) would make VS Code re-spell the trigger line's
|
||||
own leading run too, not just the inserted `\t`s — but that is a fact about
|
||||
`normalizeIndentation` applied to *pre-existing* text the server never
|
||||
wrote and cannot control, not something this feature's fix could get right
|
||||
or wrong. Noted here rather than filed, because there is no code in this
|
||||
feature's scope to act on it.
|
||||
- `every_bodys_first_line_is_stable_under_normalization` (`inline.rs:1206`)
|
||||
— a narrower, permanent finding. `accepted()`'s line-0 handling
|
||||
(`inline.rs`'s `accepted`, `out.push(line.to_string())` for `index == 0`
|
||||
— no normalization at all) is a shortcut of its own: the real
|
||||
`adjustWhitespace` normalizes line 0 too
|
||||
(`lines[0] = model.normalizeIndentation(lines[0])`). It is correct *today*
|
||||
only because every body's first line has either no leading whitespace or
|
||||
exactly one leading space (the `module` trigger's `" ${1:name};"`), and a
|
||||
single space is a fixed point of `normalizeIndentation` at every
|
||||
`indent_size` VS Code allows (1 space rounds to 0 tabs + 1 space remainder
|
||||
regardless of `tabSize`). This test pins that fixed-point property
|
||||
directly, at four configs, so a future body that picked up two or more
|
||||
leading spaces on its first line would fail *loudly* here rather than
|
||||
silently making every other test's `accepted()` calls wrong in a way
|
||||
nothing else would catch.
|
||||
- `every_bodys_closer_lands_level_with_the_trigger_and_its_interior_one_step_in`
|
||||
(`inline.rs:1232`) is the user's exact complaint, checked generically: for
|
||||
every trigger's every body, at depths 0/1/2/5, in two-space, four-space and
|
||||
tab indentation, every line's accepted indentation matches the table's own
|
||||
`(level, text)` metadata, and the closer (every body's last line) is
|
||||
asserted to be level 0 — never a step deeper than its opener. All pass.
|
||||
|
||||
Net: the fix is correct, and the two round-1-style tests above turn "I looked
|
||||
at a few cases and it seemed right" into something that would fail on its own
|
||||
if the table or the renderer regressed.
|
||||
|
||||
**Item 3 — attacking the new triggers.** Everything on the requested list,
|
||||
tried live against the built server via the unit-test harness (not just
|
||||
re-reading the dev's own tests):
|
||||
|
||||
| Attack | Result |
|
||||
|---|---|
|
||||
| `casez (` in a `.v` file | offered — `case`/`casez`/`casex` are dialect-`None` (`casez_triggers_in_a_verilog_file_too`, `inline.rs:1273`) |
|
||||
| `for (` in `.v`, `.sv`, and a pathless (`untitled:`) buffer | `.sv` and `.v` were the dev's own test; pathless added (`a_for_loop_in_a_pathless_buffer_gets_the_verilog_body`, `inline.rs:1281`) — resolves to the Verilog body, matching `templates::dialect`'s documented default |
|
||||
| `always @(` | exactly two items, posedge first (dev's test, re-verified) |
|
||||
| `always_ff @(` in `.sv` vs `.v` | one item / none (dev's test, re-verified) |
|
||||
| `always @ (` — a space between `@` and `(` | still two items — tokens carry no inter-token whitespace, so the opener-sequence match sees `@` then `(` regardless (`always_at_space_paren_still_offers_both_items`, `inline.rs:1305`); pins the opposite spacing from the dev's tight `always@(` test |
|
||||
| `module` mid-file, above an existing closed module | offers — the new `module`'s own span is what `pairs::analyze` reports unmatched, not a global count (`module_mid_file_above_an_existing_closed_module_still_offers`, `inline.rs:1317`) |
|
||||
| `case (` above an already-closed `case`, and directly in front of a bare `endcase` | both the dev's own test (`a_case_that_already_has_its_endcase_offers_nothing`) — re-verified, no change needed |
|
||||
| `generate` inside a module with a balanced `generate`/`endgenerate` pair elsewhere | offers — the earlier, closed pair does not cancel the new one's own openness (`generate_offers_even_when_an_earlier_generate_is_balanced`, `inline.rs:1328`) |
|
||||
| `fork` in both dialects | offers in both (`fork_offers_in_both_dialects`, `inline.rs:1337`) — `fork` is dialect-`None`, as it should be |
|
||||
| `casex (` whose paren closes two lines down | declined — the paren half of `Unclosed::ParenAndScope` alone is enough (`a_casex_whose_paren_is_closed_two_lines_down_offers_nothing`, `inline.rs:1344`), same rule `a_paren_the_line_below_closes_still_counts_as_closed` already pins for `if (` |
|
||||
| `if (` then, on the next line, `always @(` — nested unclosed parens | each gate sees only its own paren: both still offer, `if (` alone and `always @(` with its usual two items (`nested_unclosed_parens_each_see_their_own_gate`, `inline.rs:1362`) — `paren_is_closed` is a stack keyed by the exact span passed in, not a count, so neither construct's `(` can be mistaken for the other's |
|
||||
|
||||
No attack found a false offer or a false decline. All ten new tests pass and
|
||||
are now permanent.
|
||||
|
||||
**Item 4 — the `insertTextMode` popup change.** Verified the wire value
|
||||
against the `lsp-types` 0.97.0 source directly:
|
||||
`InsertTextMode::AS_IS = InsertTextMode(1)`,
|
||||
`ADJUST_INDENTATION = InsertTextMode(2)` — matching LSP's own `asIs = 1`.
|
||||
Both `tests/e2e.rs` pins (`:1258` template item, `:1625` module skeleton)
|
||||
assert `insertTextMode == 1`, correctly. Confirmed `insert_text_mode` is set
|
||||
on exactly the two multi-line item builders
|
||||
(`grep -n "insert_text_mode" crates/vfmt_server/src/completion.rs` → two
|
||||
hits) and that `Items::simple` — the keyword/word/index tiers' single-line
|
||||
items — builds with `..Default::default()`, leaving it `None`; no leak.
|
||||
Client capability path (`insertTextModeSupport` in the vendored
|
||||
`completion.js`) traced end to end. Full detail, including the constant's
|
||||
provenance and the flagged brief typo (the QA brief's own parenthetical said
|
||||
"asIs (2)", which is actually `AdjustIndentation` — checked against source
|
||||
rather than assumed, and the shipped code uses `1` correctly), is logged in
|
||||
`docs/features/completion-templates/README.md`'s matching 2026-08-25 QA
|
||||
entry, since the code lives in that feature's file.
|
||||
|
||||
**Item 5 — regression.** Full `cargo test --workspace` green (above) exercises
|
||||
every round-1 test unchanged: suppression negatives, the true-EOF fix, CRLF,
|
||||
UTF-16 positions, the setting off-switch
|
||||
(`the_setting_turns_the_whole_feature_off`), and deep nesting
|
||||
(`a_deeply_nested_file_neither_crashes_nor_misses_the_trigger`, depth 3,000).
|
||||
That last one's own comment already records that `pairs::analyze`'s O(depth²)
|
||||
scan — round 1's Finding 2 — was fixed and pinned linear in a separate,
|
||||
already-committed change (`83eb908`, outside this diff); re-confirmed here
|
||||
only that the comment matches the current state (it does) and that the fix
|
||||
commit is not part of this round's uncommitted diff (it is not — `git log`
|
||||
shows it landed before round 2 started).
|
||||
|
||||
**Item 6 — scope check.** `git diff --stat` against the claimed file list:
|
||||
exact match — `crates/vfmt_server/src/{inline.rs,completion.rs}`,
|
||||
`crates/vfmt_server/tests/e2e.rs`, `editors/vscode/{smoke.js,package.json}`,
|
||||
and the two feature READMEs. `templates.rs` is untouched (absent from the
|
||||
diff), confirming the dev's "no new popup templates" claim structurally, not
|
||||
just by reading the work log. No `unwrap()`/`expect()`/`panic!` in
|
||||
non-test code: checked every `+` line of `completion.rs`'s diff and every
|
||||
line of `inline.rs` above its `#[cfg(test)]` boundary — none found. `Layout`
|
||||
removal from `inline.rs` left no dead code: `grep -n Layout
|
||||
crates/vfmt_server/src/inline.rs` — zero hits outside doc comments;
|
||||
`layout_at` is `fn` (private) in `completion.rs`, called only from within
|
||||
that same file (`completion.rs:211` and `:293`, both inside
|
||||
`completion.rs` itself), matching the "no second caller left" claim —
|
||||
`inline.rs` no longer names it at all. `docs/features/completion-templates/README.md`'s own
|
||||
*The indentation contract* section documents the `layout_at` handshake
|
||||
change on its side; no stale mention of a shared `layout_at` remained in
|
||||
either README.
|
||||
|
||||
**What I changed**
|
||||
|
||||
- No fixes — nothing broken was found.
|
||||
- Tests added, all in `crates/vfmt_server/src/inline.rs`:
|
||||
`the_accepted_helper_matches_vscodes_own_algorithm_for_a_self_consistent_buffer`,
|
||||
`every_bodys_first_line_is_stable_under_normalization`,
|
||||
`every_bodys_closer_lands_level_with_the_trigger_and_its_interior_one_step_in`,
|
||||
`casez_triggers_in_a_verilog_file_too`,
|
||||
`a_for_loop_in_a_pathless_buffer_gets_the_verilog_body`,
|
||||
`always_at_space_paren_still_offers_both_items`,
|
||||
`module_mid_file_above_an_existing_closed_module_still_offers`,
|
||||
`generate_offers_even_when_an_earlier_generate_is_balanced`,
|
||||
`fork_offers_in_both_dialects`,
|
||||
`a_casex_whose_paren_is_closed_two_lines_down_offers_nothing`,
|
||||
`nested_unclosed_parens_each_see_their_own_gate`. Plus the two helper
|
||||
functions (`normalize_indentation_from_whitespace`, `normalize_indentation`)
|
||||
and `accepted_faithful` the first three tests are built on.
|
||||
- No commit, no push.
|
||||
|
||||
**Final test-suite tail** (`cargo test --workspace`, summed across every
|
||||
`test result:` line rather than trusted from one):
|
||||
|
||||
```
|
||||
test result: ok. 557 passed; 0 failed; 4 ignored; 0 measured; 0 filtered out; finished in 2.13s
|
||||
Running tests/e2e.rs (target/debug/deps/e2e-...)
|
||||
test result: ok. 29 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.27s
|
||||
```
|
||||
|
||||
1644 passed / 0 failed / 4 ignored across the workspace (1633 + my 11).
|
||||
`cargo fmt --all -- --check` and `cargo clippy --all-targets --workspace`
|
||||
both clean. `node editors/vscode/smoke.js target/debug/vfmt-server` →
|
||||
`smoke: OK`.
|
||||
|
||||
## Review
|
||||
|
||||
**2026-08-25 — lead.** Approved and committed.
|
||||
@@ -420,3 +890,23 @@ OK.
|
||||
- Gates re-run by the lead: fmt clean, clippy clean, full workspace suite
|
||||
green, `smoke.js` exercised by QA against debug and release.
|
||||
|
||||
|
||||
**2026-08-25 — lead, round 2.** Approved and committed.
|
||||
|
||||
- The misalignment root cause is proven, not assumed: dev quoted VS Code's
|
||||
`SnippetSession.adjustWhitespace` and the inline-accept path (no
|
||||
`adjustWhitespace` opt-out exists for inline completions), and QA rebuilt
|
||||
the normalization from the same source as an independent model — both
|
||||
agree at every trigger, depth, and tab/space config, and the
|
||||
closer-lands-level property the user reported broken is now pinned
|
||||
directly (`every_bodys_closer_lands_level_with_the_trigger_...`).
|
||||
- The asymmetric fix is right: relative `\t` bodies where the protocol has
|
||||
no opt-out (inline), `insertTextMode: asIs` where it does (popup), each
|
||||
documented as the sibling of the other. `vfmt.indent` no longer sizing
|
||||
ghost snippets is the correct trade and is stated in the setting text.
|
||||
- Trigger-table review: all twelve designer constructs check out; the two
|
||||
case-arm and case-gate deviations from the brief are both improvements
|
||||
and both pinned. `function`/`task` correctly declined (no parseable
|
||||
accepted text). The first-line-normalization stability pin QA added
|
||||
closes the one latent hazard I could find in the accepted() shortcut.
|
||||
- Gates re-run by the lead before commit. Ships as 0.7.0.
|
||||
Reference in new issue
Block a user