Files
lucisv/docs/features/hierarchy-current-path/README.md
T
Guoliang ChenandClaude Mythos 5.2 10cb6e020f
ci / checks (push) Successful in 57s
ci / corpus (push) Successful in 15s
ci / linux (push) Successful in 4m52s
release / build-and-publish (push) Successful in 5m18s
Release 0.66.0: the overnight queue, complete
Closes TODO §71: eight owner-ordered features shipped as 0.65.2–0.65.11.
No engine change since 0.65.11.

- docs/topo.md refreshed through 0.65.11: contracts, server-lane edges,
  packaging rows, open handshakes 44–66, new modules, choke points; stale
  FACTS_FORMAT and state.rs references corrected.
- CLAUDE.md: file sizes re-measured.
- Feature READMEs: five stale facts corrected.
- large.rs: the two linear-time tests re-measure up to three times before
  failing (0.65.11's Linux CI run read 24.9x against a 24x limit under load).

Co-Authored-By: Claude Mythos 5.2 <[email protected]>
2026-11-19 21:01:14 -08:00

572 lines
32 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# hierarchy-current-path
## Goal
The owner (TODO §71.6): "In the module view, always highlight the current open
file and its parents, in different shade. Light bright orange for the instance,
and getting dimmer the further it goes … I just want easy understanding of the
hierarchical view." The Hierarchy pane now lights every row whose module is
declared in the active editor's file (level 0, a light bright orange) and every
row whose module is above it in the design, one shade dimmer per
instantiation level, down to a floor that stays distinguishable from an unlit
row. A module instantiated in several places lights every instance and each
instance's chain; where chains meet, the nearer distance wins. It works on a
closed tree (the root, or a section header, says the file is in there), costs
no snapshot request, and repaints only the rows whose level changed. A boolean
setting, `lucisv.hierarchy.highlightCurrent` (default on), turns it off.
### Mechanism, and why
The brief assumed a `TreeView`, where a row's background cannot be painted and
the candidates are a `FileDecorationProvider` (label colour + badge), a
`ThemeIcon` colour or label highlights. **The Hierarchy pane is not a
`TreeView`: it is a `WebviewView`** (`registerWebviewViewProvider` in
`hierarchyView.js`, rows drawn by `media/hierarchy.js`). A webview can paint a
row's whole background with CSS, which is the most legible of all the options,
so that is what this does. The colours are still real theme colours:
- They are contributed through `contributes.colors` (five ids, with `dark`,
`light`, `highContrast` and `highContrastLight` defaults), so a user or a
theme overrides them with `workbench.colorCustomizations`.
- **Verified, 2026-11-19:** the contribution handler
(`src/vs/workbench/services/themes/common/colorExtensionPoint.ts`, VS Code
`main`) calls `colorRegistry.registerColor` for every contributed id (id
pattern `^\w+[.\w+]*$`; `highContrastLight` falls back to `light`,
`highContrast` to `dark`); the webview theming
(`src/vs/workbench/contrib/webview/browser/themeing.ts`) iterates
`getColorRegistry().getColors()` and exports each resolved colour as
`'vscode-' + entry.id.replace('.', '-')`. So a contributed colour reaches the
webview as a CSS variable — **with only the first dot replaced** (a plain
string `replace`). Every id here therefore has exactly one dot
(`lucisv.hierarchyCurrent` → `--vscode-lucisv-hierarchyCurrent`), and a test
pins that. The public guides (code.visualstudio.com/api/extension-guides/webview,
…/references/contribution-points) document the `--vscode-` naming and the
`contributes.colors` shape but say nothing about contributed colours inside
webviews; the source is the authority used.
- The same source lists the body classes `vscode-light`, `vscode-dark`,
`vscode-high-contrast`, `vscode-high-contrast-light`; the high-contrast rule
adds the theme's `contrastActiveBorder` around the current row (not on a
bookmarked one, whose border is the bookmark's).
**Two layers per lit row, both `background-image`s**, so they sit over whatever
the row already has — hover, the opaque sticky section header — instead of
replacing it:
1. **A translucent tint**, kept light enough that the label stays at or above
WCAG AA (4.5:1) on every level, hovered or not, in Dark Modern, Dark+, Light
Modern, Light+, HC dark and HC light. `hierarchyPalette_test.js` blends the
`package.json` defaults over those themes' sidebar and hover colours and
fails under 4.5:1, or when neighbouring levels are closer than ΔE76 3.
2. **A bar at the left edge** (`lucisv.hierarchyCurrentBar`, opaque) that
carries the "brightest" the tint gave up for legibility. On the current row
it is a solid 4px light bright orange, fully opaque. Each level up it gets
narrower and fainter: 3px at 80 %, 2px at 65 %, then 2px dashed at 55 %,
then 1px dashed at 45 %. Width and dash are the cue that does not depend on
colour, which is what high-contrast themes need for levels 1–4 (QA F3). The
current row's label is also bold. The test asserts the opaque bar is at
least 3:1 against the sidebar (WCAG 1.4.11, non-text contrast).
*Why this and not a darker tint per theme kind:* a tint dark enough to keep
light text readable on a dark sidebar stops reading as "light bright orange".
The bar can be that orange at full strength, because no text sits on it. So the
tint does legibility and the bar does brightness.
**A bookmark wins:** a bookmarked row keeps its yellow fill and border and drops
the tint. The bar stays, so a bookmarked current row still says it is current.
**Forced colours** (Windows High Contrast / `forced-colors: active`) drop every
background image, so the tint and the bar are gone and **levels 1–4 have no
cue there**. The current row keeps a dashed `CanvasText` *border* and its bold
label. It is a border rather than an outline, so the focus ring and the
bookmark's 2px outline stay as they were (QA F4).
| level | colour id | meaning | dark | light | HC dark | HC light |
|---|---|---|---|---|---|---|
| 0 | `lucisv.hierarchyCurrent` | module declared in the active file | `#FFB34745` | `#FFC26661` | `#FFB34780` | `#FF8C0099` |
| 1 | `lucisv.hierarchyParent1` | one level above | `#FFB34730` | `#FFC2664F` | `#FFB34761` | `#FF8C0073` |
| 2 | `lucisv.hierarchyParent2` | two levels above | `#FFB34721` | `#FFC2663B` | `#FFB34745` | `#FF8C0052` |
| 3 | `lucisv.hierarchyParent3` | three levels above | `#FFB34716` | `#FFC26629` | `#FFB3472B` | `#FF8C0033` |
| 4 | `lucisv.hierarchyAncestor` | four or more (the floor) | `#FFB3470D` | `#FFC26615` | `#FFB34717` | `#FF8C001A` |
| bar | `lucisv.hierarchyCurrentBar` | left-edge bar, every level | `#FFB347` | `#C86400` | `#FFB347` | `#B35900` |
Light themes use a paler orange (`#FFC266`) than dark ones. Light+ is the
tightest theme: its list foreground `#616161` is only about 5.0:1 on its hover
colour to begin with. Searching the hue showed `#FFC266` gives the widest steps
under that limit among the oranges (ΔE ≥ 3.9). `#FFBF00` does better, but it is
amber and too close to the yellow bookmark.
### What "distance" means
A row's distance is a property of its **module**: how many instantiation levels
it sits above the nearest module declared in the active file (0 for that
module). The level below a row is its module's own instance list wherever the
row sits, so every row of a module has the same answer, and one breadth-first
walk *up* the module graph from all current modules at once (the reverse index
`hierarchySections.parentIndex` already builds) answers it for every module.
- **Plain tree and a DUT's forward section:** the lit rows are exactly the
paths from the root down to every current instance, brightest at the bottom.
A forward row that cannot open (leaf, `recursive` repeat, unresolved or
ambiguous type) is lit only when it is itself current — what it would lead
to is not under it on screen.
- **"Parents of <DUT>" (upward tree):** the same rule — the rows lit are the
active file's own parents among the DUT's parents, dimmer the further up the
design, which on that tree is further *down* the page. With `leaf.sv` active
under `tb → dut → leaf`, it shows `dut` at 1 and `tb` at 2. An upward row is
always its own module, so a `recursive` repeat there is still lit.
- **Section headers** light one step dimmer than the nearest module the section
holds, shown or not: a forward section that holds the current module lights
its header at 1; an upward section lights at 1 + the nearest distance in the
DUT's ancestor closure. That is what tells the user a *closed* section holds
the file (or its parents).
- **Search results are not lit**: a flat hit has no path to light.
### Cost
Per active-file change, with M modules, E resolved instances, R rows on screen:
- one URI comparison per distinct definition file (≤ M), then the upward BFS —
O(M + E), and in practice only the current module's ancestor closure is
visited;
- per upward section header, one walk of the DUT's ancestor closure, memoized
on the path for the life of that (snapshot, file) pair;
- one map lookup per row on screen — O(R);
- a `lit` message carrying only the `[id, level | null]` pairs that changed;
the webview sets `data-lit` on those buttons, looked up in an id → button map
it builds at render. **No snapshot request, no row rebuild, no re-render.**
A render (opening a row, a refresh) reuses the cached path for the same
(snapshot, file) pair, so it adds only the O(R) lookups. Ids are untouched, so
expansion state survives every relight.
## Assumptions
- **"Declared in the active file" is `module.definition.uri` equal to the
editor's URI** after both go through `vscode.Uri.parse(...).toString()`
(the server and VS Code may percent-encode a path differently). The
comparison is asked once per distinct file. A module declared in a file the
snapshot reaches only through `` `include`` is attributed to whichever URI the
server put in its definition.
- **What that comparison does and does not fold.** `Uri.parse` + `toString`
lowercases a Windows drive letter and encodes `:` as `%3A`, so the server's
`file:///C:/x/top.sv` matches VS Code's `file:///c%3A/x/top.sv`. It does
**not** fold the case of directory or file names: on a case-insensitive file
system (win32, default darwin), a filelist that spells `C:\Proj\rtl` where
the editor opened `c:\proj\rtl` lights nothing. **UNC paths do not light
either**: the server writes `\\srv\share\a.sv` as `file:////srv/share/a.sv`
and VS Code as `file://srv/share/a.sv` (see Handshakes, note for the lead).
Both read from source by QA, not executed.
- **An ambiguous or unresolved instance names no one module**, so it is never
current and never leads anywhere: the declaration rows themselves (roots) are
still lit.
- **In a recursive component a forward row may be lit with nothing lit below
it**: the shortest path in the module graph can run through a module the tree
cuts as `recursive` on that particular path. Documented rather than fixed —
it needs a per-path walk, which is what this design avoids. It is not rare in
dense cycles: QA's property run over 1 500 random cyclic graphs of 3–6
modules found 1 165 lit open rows with no child one level brighter (e.g.
`m0:[m1,m2] m1:[m3,m5] m2:[m1] m3:[m2,m4] m4:[m1,m3] m5:[m0,m4]`, `m3`
current: `m0 › m1 › m3 › u (m2)` is lit at 2 and its only child is a cut
`m1`). Acyclic designs, and a self-instantiating module, never show it.
- **Focus moving to a panel or a webview is not a new file.**
`onDidChangeActiveTextEditor(undefined)` with editors still visible keeps the
current lighting; with none visible it clears. An `output`-scheme editor (the
Output panel) is ignored. Any other non-HDL file (a README, a diff side) lights
nothing.
- **A bookmark beats the tint** on the same row; the bar and the current row's
bold label still show.
- **The theme table in `hierarchyPalette_test.js` is representative, not
exhaustive**: the built-in Dark Modern, Dark+, Light Modern, Light+, HC dark
and HC light sidebar, foreground and hover colours. A third-party theme with
a very different sidebar is not measured; its author or the user can override
the six colours.
## Handshakes
### Consumed
- `hierarchySections.parentIndex(model)` — the module → instantiating edges
index, memoized on the model. Unchanged.
- `hierarchySections.headerId(section)` — **now exported** (additive; it was
module-private). Used to find a header row's section.
- Tree nodes from `hierarchyModel.rootNode`/`instanceNode` and
`hierarchySections.upNode`/`upRootNode`: reads `definition`, `moduleId`,
`hasChildren`, `up`. Unchanged.
### `hierarchyCurrent.js` → `hierarchyView.js`
- `matchingFiles(model, sameFile)` → the model's spellings of the active file.
- `currentPath(model, files)` → the distance state, or `undefined`.
- `rowLevels(rows, nodes, list, path)` → `Map<rowId, level>` for lit rows only.
- `levelChanges(before, after)` → `[id, level | null][]`.
- `LIT_COLORS`, `litLevel`, `cssVariableFor` — the level ↔ colour contract.
- `BAR_COLOR` (`lucisv.hierarchyCurrentBar`, the lit row's left bar) and
`nodeDistance(node, path)` (a node's distance, `undefined` when unlit) are
exported too; `hierarchyView.js` reads neither (`BAR_COLOR` is read by
`hierarchyCurrent_test.js` and `hierarchyPalette_test.js`).
### `hierarchyView.js` → `media/hierarchy.js` (the wire inside the extension)
- A `render` row carries `lit: <0..4>` **only when lit**; an unlit pane's rows
are byte-identical to before this feature (the existing "unstar restores the
pane exactly" assertion still holds).
- New message `{ type: 'lit', changes: [[id, level | null], …] }`, tree rows
only. The renderer sets or removes `data-lit` on the matching buttons.
- `treeOrSections` now returns `{ rows, nodes, bookmarkId, list }` (`list` is
the section list, `[]` for the plain tree). Internal to the view.
### Scope deviation, flagged for the lead
The brief's file list did not name `editors/vscode/media/hierarchy.js` and
`media/hierarchy.css`, because it assumed a `TreeView`. The pane is a webview
and those two files *are* its rows; nothing is visible without them. The edits
are small and additive (a `lit` message handler, `data-lit` per row, the CSS
block for five levels). The dut-hierarchy lane edited the same renderer under
the same reasoning. Please confirm the other lane does not own them.
`extension.js` needed **no** change: the view subscribes to
`onDidChangeActiveTextEditor` and the setting itself.
### Note for the lead — UNC URIs (not a request; nothing acted on)
`crates/lucisv_server/src/uri.rs:20-28` turns `\\srv\share\a.sv` into
`file:////srv/share/a.sv` (four slashes, empty authority), where VS Code uses
`file://srv/share/a.sv` (authority `srv`). This predates this feature and is
outside its scope. Here it means a module declared on a UNC path never lights,
and it probably affects any other client-side comparison against server URIs.
QA F6, from reading the source, not executed.
### The server — nothing
The snapshot already carries each module's declaring file
(`definition.file` in the schema-2 file table). No request or schema change.
## Status / TODO
- [x] Pure module `hierarchyCurrent.js`: distance per module (BFS up),
per-row levels, header levels, changes diff, colour contract.
- [x] Headless tests `hierarchyCurrent_test.js` (18 checks: 15 by the dev,
3 added by QA).
- [x] Palette regression test `hierarchyPalette_test.js` (4 checks over 6
themes): label ≥ 4.5:1 on every level, hovered too; neighbours ΔE ≥ 3;
brightest first; bar ≥ 3:1.
- [x] QA fix round: F1 contrast, F2 distinct levels, F3 HC bookmark + non-colour
cue, F4 forced colours, F7 renderer guard, F8 count, F5/F6 documented.
- [x] View wiring: active-editor tracking, cached path per (snapshot, file),
`lit` on render rows, in-place `lit` message, setting.
- [x] View test: relight posts only changed rows, no request, no render;
ignores unchanged file / focus loss / Output; setting off and on;
closing all editors clears.
- [x] Renderer and CSS (`media/`): `data-lit`, gradient tint, bookmark wins,
high-contrast border, forced-colors outline.
- [x] `package.json`: five tints and the bar colour, `lucisv.hierarchy.highlightCurrent`.
- [x] `.vscodeignore` excludes `hierarchyCurrent_test.js` and
`hierarchyPalette_test.js`; `RELEASING.md`
lists `hierarchyCurrent.js` as a runtime module (`release.sh` has no
such list).
- [x] Extension README: feature row and setting row.
- [ ] Visual check in a running VS Code (cannot be done by the dev agent; see
the work log).
## Work log
### 2026-11-19 — dev (Opus 5.5)
- Read the sidebar, dut-hierarchy and hierarchy feature docs and the view code.
Found the pane is a `WebviewView`, not a `TreeView`, which removes the
premise of the mechanism question: row backgrounds are paintable. Chose CSS
backgrounds driven by contributed theme colours; verified in VS Code's source
that contributed colours reach webviews and that only the first dot of the id
becomes a dash (see Goal → Mechanism).
- First design lit the upward "Parents of" tree by *tree* direction (a row lit
when the current file is below it on the page). Its own test showed the flaw:
with `leaf.sv` open, that section shows `dut` and `tb` — leaf's parents — and
lit neither. Switched to one meaning everywhere: distance = instantiation
levels above the current module. Dropped the second (downward) BFS that the
first design needed.
- Headers: first cut was "root distance + 1"; replaced by "one dimmer than the
nearest module the section holds", which is the only version that means the
same thing for forward and upward sections.
- Tests before: 10 files under `node --test editors/vscode/*_test.js`, all
passing. After: 11 files, all passing (`hierarchyCurrent_test.js` is new, 15
checks; `hierarchyView_test.js` gained one scenario).
- **Not verified:** the rendered colours in a real VS Code (no editor access);
the `.vsix` contents (`vsce` is not installed in this tree). Human check:
1. Open a design, open the Hierarchy pane, open a leaf module's file: the
root row is tinted even while closed; open it — each level brighter to the
leaf, which is bold and brightest orange.
2. Open a module instantiated twice: both instance rows and both chains lit.
3. Switch files: the tint moves without the "Loading hierarchy…" status and
without collapsing anything.
4. Star a DUT: the DUT section and the "Parents of" section light; close
them — the headers stay tinted when they hold the file.
5. Bookmark a lit row: yellow wins. Hover a lit row: tint over hover.
6. Light, dark, high-contrast dark and light themes: the floor (level 4,
use a design ≥ 5 levels deep) is still visible against the sidebar.
7. `"lucisv.hierarchy.highlightCurrent": false` clears it live; `true`
restores it.
8. `workbench.colorCustomizations` with `"lucisv.hierarchyCurrent": "#00ff0080"`
recolours the current row.
9. After packaging: `unzip -l dist/lucisv-<v>.vsix | grep hierarchyCurrent`
prints `extension/hierarchyCurrent.js` and no `_test`.
### 2026-11-19 — dev (QA fix round, Opus 5.5)
- **F1 contrast.** The tints are now lighter, and the brightness moved to a new
opaque left-edge bar (`lucisv.hierarchyCurrentBar`). Reasons are under Goal →
Mechanism. The tint alphas were placed from measurements: for each theme
kind, the most tint that keeps label text ≥ 4.55:1 on both the sidebar and
the hover colour, then five levels spread evenly in ΔE between that and an
unlit row. Light themes moved to `#FFC266` after a hue search (Light+ is
the binding constraint). Ratios of label text on the level-0 row:
| theme | before (QA) | after | after, hovered | after, levels 1–4 |
|---|---|---|---|---|
| Dark Modern | 3.68 | **5.91** | 4.72 | 7.39 8.51 9.42 10.09 |
| Dark+ | 3.32 | **5.14** | 4.72 | 6.25 7.25 7.98 8.62 |
| Light Modern | 7.61 | **8.99** | 8.72 | 9.26 9.62 9.85 10.23 |
| Light+ | 4.09 | **4.83** | 4.56 | 4.98 5.13 5.25 5.41 |
| HC dark | 4.67 | **6.17** | — | 8.93 12.46 16.23 18.86 |
| HC light | 8.14 | **8.64** | — | 9.82 11.00 12.24 13.30 |
Every level, hovered or not, is now ≥ 4.56:1 (hovered levels 1–4 are in
the `LUCISV_PALETTE_TABLE=1` output). The bar against the sidebar: Dark
Modern 9.97, Dark+ 8.60, Light Modern 3.75, Light+ 3.59, HC dark 11.79,
HC light 4.83 (all ≥ 3:1).
- **F2 distinct levels.** ΔE76 between neighbours, as 0/1, 1/2, 2/3, 3/4 and
floor/unlit:
| theme | before (QA) | after |
|---|---|---|
| Dark Modern | 14.5 10.7 5.8 **3.0** 14.2 | 9.0 6.2 5.1 3.7 6.4 |
| Dark+ | 13.9 10.4 5.3 **2.7** 13.2 | 8.0 6.4 4.6 4.0 5.3 |
| Light Modern | 14.5 7.6 4.4 **1.8** 9.0 | 4.4 4.0 4.5 3.9 4.6 |
| Light+ | 14.4 7.6 4.3 **1.8** 9.0 | 3.9 4.3 4.0 4.2 4.6 |
| HC dark | 19.8 10.7 12.0 7.2 16.0 | 12.6 12.1 12.7 11.3 7.4 |
| HC light | 15.7 8.4 6.2 3.7 10.4 | 15.2 12.8 11.6 9.1 9.1 |
So five levels stay: every neighbour pair is ≥ 3.7, where the old palette
had pairs at 1.8. The steps are smaller than before because the whole range
is smaller (the price of legible text), but they are now even. On top of the
tint, the bar's width and dash differ at every level.
- **Regression test** `editors/vscode/hierarchyPalette_test.js` (new, listed
in `.vscodeignore`). It computes all of the above from `package.json`'s
defaults and fails under 4.5:1 text, under ΔE 3 between neighbours, if the
levels are not brightest-first, or under 3:1 for the bar. Proven to bite:
pointed at a copy of the manifest with the old level-0 defaults, it fails
with "Dark Modern: label on level 0 is 3.68:1, under 4.5".
`LUCISV_PALETTE_TABLE=1` prints the table.
- **F3.** The HC border rule is now `:not(.bookmarked)`, so a bookmarked
current row keeps the bookmark's border. Levels 1–4 get a cue that is not
colour in every theme: bar width and style (4 solid, 3 solid, 2 solid,
2 dashed, 1 dashed). A bookmarked lit row keeps its bar too
(`.row.bookmarked[data-lit]`), so "bookmark wins" now means fill and border.
- **F4.** Forced colours: the current row's cue is a dashed `CanvasText`
border instead of an outline, so focus and bookmark outlines are no longer
overridden. The dropped tint and bar are written down under Goal.
- **F7.** `media/hierarchy.js` `relight` skips a non-array entry.
- **F8.** Status corrected (18 + 4 checks).
- **F5, F6.** Stated under Assumptions, with QA's numbers and examples. The
UNC note is under Handshakes, for the lead, with nothing acted on.
- `hierarchyCurrent.js` exports `BAR_COLOR`. The manifest test now expects the
five tints plus the bar, and checks the bar is opaque in all four kinds and
that the CSS uses its variable.
- Tests: `node --test editors/vscode/*_test.js` gives 12 files, 12 pass, 0 fail
(11 before this round; `hierarchyPalette_test.js` is new). `node --check`
is clean on `hierarchyCurrent.js`, `hierarchyCurrent_test.js`,
`hierarchyPalette_test.js` and `media/hierarchy.js`. `package.json` parses.
- **Still unverified:**
- Any of it in a running VS Code.
- Whether `color-mix()` with a `var()` percentage and the dashed
`repeating-linear-gradient` bar render as intended. The webview's Chromium
supports both, and `color-mix` was already used for the bookmark.
- Forced-colors behaviour (it follows the spec, but nobody has run it).
- The theme table is the built-in themes' published colours, not a capture
from a live window.
### Changelog paragraph (for the lead)
**The Hierarchy pane shows where you are.** The rows leading to the file you
are editing are lit: every instance of the module it declares in a bright
orange with a solid bar at its edge, each row above one shade dimmer with a
narrower bar, down to a faint floor; labels stay readable at every level. It works on a
closed tree and on DUT sections — a header is tinted when its section holds
the file or its parents — and switching files repaints only the rows that
changed, with no reload of the hierarchy. The shades and the bar are theme
colours (`lucisv.hierarchyCurrent`, `lucisv.hierarchyParent1`–`3`,
`lucisv.hierarchyAncestor`, `lucisv.hierarchyCurrentBar`) you can override; set
`lucisv.hierarchy.highlightCurrent` to `false` to turn it off.
## QA log
### 2026-11-19 — QA (Opus 5.5)
**Verdict: PASS WITH FINDINGS.** The distance logic, the wiring, the renderer and
packaging all check out. One medium finding: text contrast on the current row
in dark themes. The rest are low or informational.
**Commands and results** (worktree `lucisv-wt/71.6`, Node v26.13.0):
- `node --test editors/vscode/*_test.js`: 11 files, 11 pass, 0 fail (before and
after the QA additions).
- `node --check` on `hierarchyCurrent.js`, `hierarchyCurrent_test.js`,
`hierarchyView.js`, `hierarchyView_test.js`, `hierarchySections.js` and
`media/hierarchy.js`: all clean.
- `package.json` parses, and `version` is still `0.65.1`.
`git diff --name-only 88546c8` plus the untracked files touch only
`editors/vscode/**`, `tools/RELEASING.md` and this folder. The `media/` edits
only add the `lit` handler, `setLit` and `treeButtons`, and the CSS block for
the five levels plus the high-contrast and forced-colors rules. All of it
belongs to this feature.
- `npx --no-install @vscode/vsce ls --no-dependencies` ran offline (vsce 4.1.1
from the npx cache). It lists `hierarchyCurrent.js`, `media/hierarchy.css`
and `media/hierarchy.js`, and no `*_test.js` or `smoke` file. `package.json`
has no `files` field, so `.vscodeignore` decides what ships.
- I checked the VS Code source on `main` myself. In `themeing.ts` the variable
name is `'vscode-' + entry.id.replace('.', '-')`, so only the first dot
becomes a dash. `colorExtensionPoint.ts` uses the pattern `^\w+[.\w+]*$`, and
`highContrast ?? dark` / `highContrastLight ?? light` as fallbacks. The
README's account is accurate. All five ids have exactly one dot, the CSS uses
`--vscode-lucisv-hierarchy{Current,Parent1,Parent2,Parent3,Ancestor}`, and
every id has all four defaults.
**Attacks on `hierarchyCurrent.js`** (scratch scripts outside the repo; the
plain missing assertions were added to `hierarchyCurrent_test.js`):
- Passed:
- an empty snapshot, including in DUT sections
- a file that declares no module
- one file declaring several modules, two of them on one chain (both are
level 0)
- an unequal diamond (`top→a→b→c→leaf` plus `top→leaf`): top is lit at 1
and the long chain at 3, 2, 1
- 50 instances of one module: all lit at 0
- a self-instantiating module
- a pure cycle with no root
- DUT sections over a cycle
- a 300-deep chain: 296 rows at the floor, no level outside 0..4
- `litLevel(NaN)` and `litLevel(Infinity)` both return `undefined`
- Timing, 6 000 modules (a fan-out-3 DAG with cross links):
- `matchingFiles` + `currentPath`: 4.9 ms including the first `parentIndex`
build, 1.8 ms on a fresh model
- `rowLevels` over 176 open rows: 1.6 ms
- Property test over 1 500 random DAGs: every lit forward row that is open and
not current has a child exactly one level brighter, with 0 violations. See F5
for the cyclic case.
**`media/hierarchy.js`, executed** with a hand-rolled fake `document` and
`acquireVsCodeApi` loaded through `vm` (scratch `dom.js`):
- A render paints `data-lit`.
- A `lit` message changes only the rows it names, and the button objects stay
the same, so nothing is rebuilt.
- Unknown ids and invalid levels (`-1`, `1.5`, missing) are ignored or cleared.
- `changes` set to a non-array, or missing, is ignored.
- A later full render shows whatever the host sends.
- While search is active, the hidden tree still relights and a search row
named in a `lit` message is not touched.
- Setting off (all-null changes, then a render without `lit`) leaves no lit
row.
- A `lit` message after an error status does not throw.
**Findings**
- **F1 (medium): body text on the level-0 row is below WCAG AA in dark and
Light+ themes.** Source: `editors/vscode/package.json`, the
`lucisv.hierarchyCurrent` defaults (`dark` `#FFB34773`, `light`
`#FF8C0066`). Blended onto typical sidebar backgrounds, the foreground
contrast is:
| theme | foreground | level-0 background | contrast | unlit |
|---|---|---|---|---|
| Dark Modern | `#CCCCCC` | `#805E2D` | 3.68:1 | 11.06 |
| Dark+ | `#CCCCCC` | `#876535` | 3.32:1 | 9.54 |
| Light+ | `#616161` | `#F8CA92` | 4.09:1 | 5.58 |
| HC dark | `#FFFFFF` | — | 4.67:1 | — |
The row the user most needs to read is the hardest one to read.
Reproduction: `node contrast.js` (scratch). This is a palette decision for
the lead and owner. I did not change it.
- **F2 (low): level 3 and the floor are close to indistinguishable.** In light
themes they differ by ΔE76 1.8 (`#FF8C001F` against `#FF8C001A`), which is
under the ≈2.3 just-noticeable difference. Dark+ is at 2.7 and Dark Modern at
3.0. The steps between the other levels are 4.3 to 15.7. The floor against an
unlit row is ΔE 9.0 to 16.0, which is fine. In practice the user sees about
four shades, not five.
- **F3 (low): in high-contrast themes a bookmarked current row loses its yellow
border.** Source: `media/hierarchy.css:77-80`. The selector
`body.vscode-high-contrast .row[data-lit="0"]` (specificity 0,3,1) sets
`border-color` and beats the `.row.bookmarked` border (0,2,0). That
contradicts "a bookmark wins". The yellow background is kept. In HC only
level 0 gets a cue other than colour (the border, plus the bold label every
theme gets). Levels 1 to 4 are colour only.
- **F4 (low): in `forced-colors`, the focus ring and the bookmark outline are
lost on the current row.** Source: `media/hierarchy.css:115`. The rule
`.row[data-lit="0"] { outline: 1px dashed Highlight }` comes later and has the
same specificity, so it replaces the `.row:focus` outline (line 48) and the
bookmark's 2px outline (line 114). That leaves a focused current row without
its focus ring. Under forced colors the gradient tint is also dropped (CSS
Color Adjust forces `background-image` to `none`), so levels 1 to 4 are
invisible there. That is expected, but it is not written down.
- **F5 (low, documented): the recursive-design limitation is real and common
in dense cycles.** Over 1 500 random cyclic graphs of 3 to 6 modules, 1 165
lit open rows had no child one level brighter. Example: with
`m0:[m1,m2] m1:[m3,m5] m2:[m1] m3:[m2,m4] m4:[m1,m3] m5:[m0,m4]` and `m3`
current, the row `m0 › m1 › m3 › u (m2)` is lit at 2 and its only child,
`m1`, is cut as `recursive`. A self-instantiating module does not show this.
Assumptions describes it accurately.
- **F6 (low, not executed): files are compared exactly after `vscode.Uri`
normalization.** From `uri.ts` on `main`, `parse` followed by `toString`
lowercases the drive letter and encodes `:` as `%3A`. So
`file:///C:/x/top.sv` from the server matches VS Code's
`file:///c%3A/x/top.sv`. Two cases do not match:
- Directory case is not folded. If a filelist spells the path differently
from how the editor opens it (`C:\Proj` against `c:\proj`, on
case-insensitive win32 or darwin), nothing lights.
- UNC paths: `crates/lucisv_server/src/uri.rs:20-28` turns `\\srv\share\a.sv`
into `file:////srv/share/a.sv`, while VS Code uses `file://srv/share/a.sv`.
This is a pre-existing server encoding and outside this scope, but here it
means nothing lights.
`vscode-uri` is not available offline, so this comes from reading the source.
- **F7 (info): `media/hierarchy.js:157` throws a TypeError on an entry that is
not an array** (`changes: [null]`). Only a malformed host message triggers
it, and the host never sends one.
- **F8 (doc):** Status said "15 checks". It is 18 now, with the QA additions.
**QA changes:** I added three tests to `hierarchyCurrent_test.js`:
`anEmptySnapshotLightsNothing`, `theShorterOfTwoUnequalChainsWins` and
`aSelfInstantiatingModuleTerminates`.
**Still to check in a running VS Code (by a human):**
- The dev's nine checks in the Work log.
- The `onDidChangeActiveTextEditor(undefined)` ordering against
`visibleTextEditors` when the last editor closes, and when focus moves to a
webview editor such as a Markdown preview.
- That contributed colours with alpha really reach the webview (`toString` of
a translucent `Color`).
- F1 and F2 judged by eye in real themes.
- Windows: a drive-letter workspace, and a filelist with path case that
differs from the editor's.
## Review
**Lead, 2026-11-19.** Accepted for 0.65.2.
- The brief assumed a TreeView; the pane is a webview, and the dev was right
to paint rows with CSS and to take `media/hierarchy.{js,css}` into scope —
no other lane owns them. Ruled in.
- QA's F1–F4, F7, F8 are fixed in the fix round and I re-ran the suite on the
result: 12 test files, 12 pass. The palette test is the part I value most:
the contrast claim is computed from the shipped defaults, not asserted.
- Read the stylesheet: `--bar-alpha`/`--lit` are set by the per-level rules on
the same element the `[data-lit]` rule reads them on, so they resolve; a
bookmarked row keeps its fill and border and only adds the bar.
- Not verified by anyone: the look in a running VS Code (tint, bar, dashes,
forced-colours). I tried to render the stylesheet in a browser from this
session and could not. The owner's eye is still owed; the changelog says so.
- Left open, recorded under Assumptions: case-differing folder names and UNC
paths do not light (the UNC spelling is the server's, `uri.rs:20-28` — a
candidate for a later round), and the recursive-design gap.