Fix the version it reports, and the preview freezing while you type - #21
Merged
Conversation
`.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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two unrelated fixes that happened to be found together.
kumihimo --versionsaid 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.refreshdoes nothing when there is no panel.It is not the compiler
It is the redraw
Assigning a webview's
htmlreloads 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:
kumihimo.preview.delay, default 600 ms. A squiggle should keep up with typing; a whole diagram should settle first.retainContextWhenHiddenis gone — the editor's own docs warn it is memory-expensive, and it bought nothing here.redrawgained 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
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
.vsixbefore merging.Extension bumped to 0.4.1.
🤖 Generated with Claude Code
https://claude.ai/code/session_01824X53UWBk8JUvTPoN7hnu