Skip to content

Fix the version it reports, and the preview freezing while you type - #21

Merged
sasagar merged 4 commits into
mainfrom
cli-version
Jul 31, 2026
Merged

Fix the version it reports, and the preview freezing while you type#21
sasagar merged 4 commits into
mainfrom
cli-version

Conversation

@sasagar

@sasagar sasagar commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Two unrelated fixes that happened to be found together.

kumihimo --version said 0.0.0

.version('0.0.0') was a literal. Every release up to 0.3.0 answered 0.0.0 — verified against the copy installed from npm, not just the working tree. That is the number that ends up in a bug report.

It now reads the version out of the package that ships it.

The preview froze the editor while typing

Reported as the extension freezing, and only with the preview open — which fits: Preview.refresh does nothing when there is no panel.

It is not the compiler

measured result
12 consecutive compiles, 24-device file 10–18 ms, flat RSS, no growth in active handles
256 ports on one device 13 ms
60 devices in series 19 ms
one output fanned out 80 ways 16 ms

It is the redraw

Assigning a webview's html reloads the webview — document torn down, markup parsed again, a base64 data URI of the whole drawing decoded and laid out again. That was happening every 250 ms while typing, at 98 kB of SVG / 130 kB encoded for a job-sized diagram.

Changes:

  • The preview gets its own, slower beat — kumihimo.preview.delay, default 600 ms. A squiggle should keep up with typing; a whole diagram should settle first.
  • The write is skipped entirely when the drawing has not changed. Mid-word edits mostly do not change the picture.
  • A hidden tab is not drawn into at all, and catches up when it returns.
  • Renders no longer overlap. A slow one could previously finish last and leave stale wiring on screen.
  • retainContextWhenHidden is gone — the editor's own docs warn it is memory-expensive, and it bought nothing here.
  • redraw gained the language guard it was missing: saving any file in the workspace was arming a timer for a preview that could never be showing it.

The smoke test now counts the cost itself

○ 同じ内容の編集 8 回 → 書き込み 0 回
○ 内容が変わったら描き直す → 書き込み 1 回
○ 隠れているタブには描かない → 書き込み 0 回
○ 戻ってきたら追いつく → 書き込み 1 回

The first of those is the freeze, measured: eight edits that leave the drawing identical must write nothing.

Not verified

I have not reproduced this in a real extension host — I cannot run one here. What is measured is that the compiler is not the cause, and that the write was happening at that size and rate. Worth trying the .vsix before merging.

Extension bumped to 0.4.1.

🤖 Generated with Claude Code

https://claude.ai/code/session_01824X53UWBk8JUvTPoN7hnu

sasagar and others added 3 commits July 31, 2026 22:58
`.version('0.0.0')` was a literal, so `kumihimo --version` answered 0.0.0
for every release up to 0.3.0 — including the copy installed from npm, which
is where I checked it. That is the number that ends up in a bug report.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01824X53UWBk8JUvTPoN7hnu
Reported as the extension freezing, and only with the preview open — which
fits, because `Preview.refresh` does nothing when there is no panel.

It is not the compiler. Measured: twelve consecutive compiles of a 24-device
file run 10–18 ms with flat RSS and no growth in active handles, and 256
ports, 60 devices in series and an 80-way fan-out all land under 20 ms.

Assigning a webview's `html` reloads it — the document torn down, the markup
parsed again, a base64 data URI of the whole drawing decoded and laid out
again. That was happening every 250 ms while typing, at 98 kB of SVG and
130 kB encoded for a job-sized diagram.

So: the preview gets its own slower beat (600 ms), the write is skipped
entirely when the drawing has not changed, a hidden tab is not drawn into at
all and catches up when it returns, and renders no longer overlap — a slow
one could previously finish last and leave stale wiring on screen.

`retainContextWhenHidden` is gone too. The editor's own documentation warns
it is memory-expensive and it bought nothing: the page holds no state a
reader would lose.

The smoke test now counts `html` assignments, which is the cost itself: eight
edits that leave the drawing identical must write nothing.

Not reproduced in a real extension host — I cannot run one here. What is
measured is that the compiler is not the cause and that the write was
happening at that size and rate.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01824X53UWBk8JUvTPoN7hnu
Saving any file in the workspace armed a timer for a preview that could
never be showing it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01824X53UWBk8JUvTPoN7hnu
@sasagar
sasagar merged commit aee0469 into main Jul 31, 2026
1 check passed
@sasagar
sasagar deleted the cli-version branch July 31, 2026 14:43
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