Inlay hints M8: port and parameter names on ordered lists

textDocument/inlayHint draws ghost portname:/PARAM: labels on positional
connection lists and all-positional #(...) overrides, from the same plan
extraction M4 uses — walked off the parse tree, so nested-call commas
cannot shift positions. Range filtering runs before any definition is
parsed; plans are cached per request (O(distinct modules)); every
uncertainty is silent, including QA's find: an ifdef-carrying port list
unions its arms in the plan, which is right for an editable skeleton and
wrong for a read-only label, so such plans now hint nothing.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
lucioandClaude Fable 5 committed 2026-08-24 23:24:01 -07:00
1 parent 3c55783e09
commit fa38fd9dec
8 files changed
+1425 -15

No files matched your search

+38
View File
@@ -30,6 +30,7 @@ looks like language knowledge in here is a bug or a `Handshake` request.
| `textDocument/rename` | `vlog_refactor::rename` | Cross-file `WorkspaceEdit` (`changes`); warnings go out on `window/logMessage`; refusals are `RequestFailed`. See `docs/features/refactor-rename/README.md` |
| `textDocument/completion` | `vlog_refactor::instantiation_plan` | Module hinting: one item per indexed module, inserting the whole instantiation skeleton as a snippet (plain text for a client that did not advertise `snippetSupport`). Capped at 64 items, `isIncomplete` when truncated; declines every position that is not module-item. See `docs/features/refactor-instantiate/README.md` |
| `textDocument/signatureHelp` | `vlog_refactor::instantiation_plan` | The instantiated module's ports (or, inside `#( ... )`, its parameters) with the active one highlighted — by name for a named list, by position for an ordered one. Triggers: `(` and `,`. Same feature README |
| `textDocument/inlayHint` | `vlog_refactor::instantiation_plan` | Ghost port names on an **ordered** connection list (`u1 (clk, rst_n)`) and parameter names on ordered `#( ... )` overrides, read from the instantiated module's declaration. Range-scoped; named lists, `.*`, omitted positions, connections past the last port, gate primitives and modules the index cannot resolve get nothing at all — a hint is decoration and never guesses. No `resolveProvider`. See `docs/features/inlay-hints/README.md` |
| `workspace/symbol` | `WorkspaceIndex::workspace_symbols` | Capped at 256 hits |
Deferred, deliberately, and named in Status/TODO below: ~~range formatting
@@ -442,11 +443,48 @@ list to `vlog_parser::KEYWORDS`. Rationale and inventory:
`docs/features/references-nav/README.md`.
- [x] ~~**Not done:**~~ `vfmt.toml` discovery, `.gitignore`-aware indexing —
delivered by vfmt-core-lift (both Handshakes below marked DELIVERED).
- [x] `textDocument/inlayHint` — delivered by **inlay-hints** (M8): port and
parameter names on ordered connection lists, off the same
`instantiation_plan` completion and signature help read.
`docs/features/inlay-hints/README.md`.
- [ ] **Not done:** editor packaging (the VS Code extension and the
`lspconfig` snippet are their own TODO.md §6 item).
## Work log
### 2026-08-24 — dev agent (M8 inlay-hints)
- **One new capability, one new module, nothing else moved.**
`inlayHintProvider` is advertised as `InlayHintOptions` with no
`resolveProvider` (every hint is returned complete), `server.rs` gained one
dispatch arm, and `crates/vfmt_server/src/inlay.rs` holds the whole answer.
No engine change: `vlog_refactor::module_definition` +
`instantiation_plan` were already public for M4, and this feature reads only
the port/parameter **names** out of the plan.
- **The one architectural difference from `signature.rs`, stated here because
the two look like they should share code**: signature help reads the token
stream because it answers about a half-typed list; inlay hints read
`doc.tree`, because a hint decorates text that parses and the tree already
knows which lists are ordered, where each expression starts, and which
positions were omitted. Sharing a comma counter between them would have made
the hint answer worse, not the code smaller.
- **Cost measured before the design was fixed**, not after: 0.005 ms over a
1916-line corpus file, 12.2 ms for a 40-line screen showing forty *distinct*
ordered instantiations, 30.8 ms for a hundred of them at once. Plans are
cached for the length of one request and not across requests; the number
that would justify a cross-request cache, and the staleness it would bring,
are written up in the feature README's *Cost* section.
- **Nothing in `state.rs` was touched**, so the workspace is still immutable
through every read handler. `editors/vscode` needs no change either — the
language client picks the feature up from the advertised capability — and
`smoke.js` was deliberately left alone (its capability list belongs to
editor-packaging); it still passes against the release binary.
- **Results.** `cargo test --workspace`: **1358 passed, 0 failed** (1330
before — 26 unit tests in `inlay.rs`, one capability test in `main.rs`, one
e2e stdio round trip). `cargo clippy --all-targets`: silent.
`cargo fmt --all -- --check`: clean. No new dependencies, no version bump
(0.5.0 belongs to M14), no commits.
### 2026-08-24 — dev agent (0.4.1, fence audit only)
Owned by `docs/features/editor-packaging/README.md`; noted here because it