Skip to content

Give the MAT-file editor the dictionary editors' Properties refresh, safe save and backup ids, and share the table editors' message dispatch - #111

Merged
ww-mw merged 8 commits into
mainfrom
provider-parity
Oct 24, 2026
Merged

ww-mw merged 8 commits into
mainfrom
provider-parity

Conversation

@ww-mw

@ww-mw ww-mw commented Oct 24, 2026

Copy link
Copy Markdown
Member

Makes the MAT-file editor work like the dictionary editors where they still differed, and shares the message dispatch every table editor repeated.

  • Properties panel: the MAT-file editor has the same onChanged hook as the dictionary editors, fired after every repaint (edits, Add, delete, paste, move-out, undo/redo, revert/reload). The panel now follows a MAT-file variable's edits, not only a reload. onReplaced is gone, because onChanged covers it.
  • Save: MAT-file save and Save As go through the shared writeUserFile, the safe write with its stamp from the write, as the binary dictionary editor does.
  • Backup ids: the MAT-file editor uses the shared backupId.ts (same format; old backup ids still restore). Its private copy is removed.
  • Disk reads: both byte-backed editors read through diskFollow.readStamped/readForOpen, so the stat-before-read rule is written once.
  • Message dispatch: tableDispatch.dispatchCommon answers what every table editor answers the same way: ready, select, navigate, requestMatrix, requestChildren, undo and redo. All four providers use it, each with its own handlers: the JSON view's ready ordering and native undo, MAT's annotator, and the read-only viewer with no undo/redo. test/messageDispatch.test.ts reads each provider's table and still fails if a provider drops a message, answers one twice, or a read-only view gains an editing message.

Tests: unit 4332 passed; integration 425 passing / 2 pending, on this branch merged with main.

ww-mw added 8 commits October 23, 2026 22:48
…e, not only a reload

The MAT-file editor told the inspector only when its tree was replaced
from disk, so an edit, its undo or redo, a paste or a move out of the
file left the panel showing the value from before until another row was
clicked. Its document now says so after every repaint (onChanged), as
the binary dictionary editor's does since #108, and extension.ts answers
both with the inspector's one re-resolve; onReplaced, which this
subsumes, is gone.
…rite both byte-backed editors share

The MAT-file editor wrote the user's file through its own copy of what
diskFollow.writeUserFile does for the binary dictionary editor: the
replace, then the stamp the write left, read back by a stat where the
write could not say (a folder deleted under the view, written again).
It now calls writeUserFile, so the two editors save by one rule; the
behaviour is the same, and a test holds the MAT-file's deleted-folder
save to it, as one already holds the binary editor's.
…editor gives its own

The MAT-file editor kept a private copy of backupId/backupSource, the
format src/host/backupId.ts now owns for both byte-backed editors. It
uses the shared module and its copy is gone. The format is the one it
already wrote, so a backup it made before still restores; a test now
also restores a MAT-file from a bare-uri id, the binary editor's older
shape.
…ed from, by one rule

The binary dictionary and MAT-file editors each spelled out the read
that opens, reverts and reloads a document: the stat before the read
(so a write between the two costs a needless prompt, never a silent
overwrite), and, for a hot-exit restore, the backup's bytes under the
stamp its id recorded. diskFollow.readStamped and readForOpen now say
it once, and both editors call them. The save's own bookkeeping (saving,
the conflict ended by a write) and the revert's stay in each provider:
each is two lines around format-specific rollback, and the binary
revert ends the conflict inside applyDisk, so a shared helper would be
neither simpler nor exactly the same.
…the MAT-file and both binary editors

ready, select, navigate, requestMatrix, requestChildren, undo and redo
were spelled out in each provider's own if/else chain, with the same
checks on what arrived (a selection that is no array, a link target that
is no string) written again in each. tableDispatch.dispatchCommon now
answers them from a table of handlers keyed by message type, which the
MAT-file, binary dictionary and read-only editors pass; the JSON view
follows later. The type makes the four every view owes required, and
messageDispatch.test.ts reads each provider's table keys beside its
branches, so it still holds every editor to its tier, and to answering
no message twice.
# Conflicts:
#	src/host/inspectorSelection.ts
…table too

The JSON view was the last table provider spelling ready, select,
navigate, requestMatrix, requestChildren, undo and redo out in its own
chain. It now hands them to tableDispatch.dispatchCommon from its
CommonHandlers table, each doing what its branch did (the ready
handshake marks the webview ready before it paints; the fetch fills the
Usage column with its own annotator); locateInText and the editing
messages stay its own. messageDispatch.test.ts now requires the table of
all four providers.
…om the code

The read-only viewer's "register listeners BEFORE assigning webview.html" note had ended up
over the CommonHandlers table instead of the subscription it is about; it sits over
onDidReceiveMessage again. The MAT-file document's onChanged doc named two call sites while
there are three: a gesture that threw says the tree changed too, before its view paints every
row again itself. An overlong comment line in binarySlddInspectorRefresh.test.ts is wrapped.

No shared factory for the handlers the four providers' tables have in common: each is a
one-liner over that provider's own callbacks, and messageDispatch.test.ts and
matrixRequest.test.ts read each table's keys off the provider's source, which a factory
would hide from them. Comments only; no behaviour change.
@ww-mw
ww-mw merged commit 246c202 into main Oct 24, 2026
4 checks passed
@ww-mw
ww-mw deleted the provider-parity branch October 24, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant