Skip to content

Change UI to a web view - #10

Merged
emanuelen5 merged 24 commits into
mainfrom
webview
Nov 30, 2026
Merged

emanuelen5 merged 24 commits into
mainfrom
webview

Conversation

@emanuelen5

Copy link
Copy Markdown
Collaborator

No description provided.

@emanuelen5 emanuelen5 self-assigned this Nov 13, 2026
VS Code recreates the webview content when the panel is opened, moved
to another editor group or shown again after being hidden, and focuses
the panel before the new content has loaded. Focus the panel again once
the content reports that it is ready, and give keyboard focus to the
selected row (or the message editor) when the webview gets focus.
Show the branch line as `webview <-> fork/*` instead of
`webview <-> fork/webview` when the upstream branch has the same name
as the local branch.
Reconcile cloned snapshots by patch ID and file path at the message
boundary. Reuse unchanged rows, files, selection and editing state so
loading-only updates skip the table and row memoization stays shallow.

Cover duplicate snapshots, file updates, insertion/removal, reordering
and retained DOM identity.
Use a common P namespace for applied and popped patches instead of
including their current status in row IDs. Patch names remain stable
across refresh, while history, index and work-tree IDs are unchanged.

Cover series status/SHA changes and assert that moving a patch between
applied and popped rows preserves its existing header and file DOM.
Share pending and completed diff-tree reads between recreated patch
and history rows in the repository-bound reader. Retain the 500 most
recently used completed results and use the SHA already listed by StGit.

Check Git exit status before caching, and retry failed reads and row
detail requests. Keep mutable Delta objects and live reads uncached.
Warm the SHA cache on the next event-loop turn after the series is
published. Use two background workers, deduplicate commit IDs, and cap
each batch at the 500-entry cache capacity to avoid reload churn.

Cancel queued work on reload, mutation, repo switch and disposal. Keep
in-flight reads repo-bound, suppress speculative errors, and share
pending reads with foreground expansion without additional UI updates.
Version webview selection messages and echo the processed version in
render snapshots. Keep newer local movement when an older loading
snapshot arrives, while still applying file and loading updates.

Use the synchronous selection for rapid keyboard navigation and clear
older deferred file targets when the user explicitly moves the cursor.
Keep acknowledged host navigation and missing-file fallback working.

Tests: 60 unit tests, 52 extension-host tests, grammar tests and lint.
Keep cursor selection and focus in the webview after initialization.
Ordinary snapshots preserve surviving rows; local missing-row fallbacks
are mirrored to the host without interrupting toolbar or composer focus.

Send intentional host navigation separately, defer missing targets, and
ignore requests superseded by newer user movement. Make view-state reads
pure and preserve existing explicit command navigation.

Cover zero-focus metadata refreshes, keyed reordering, nearby fallbacks,
control focus, and deferred navigation races in compiled-webview tests.
Validated 64 unit tests, both grammars, 52 extension-host tests, compile,
lint, formatting, editor diagnostics, and whitespace checks.
Use one stable selection callback for user navigation and mirrored
selection, instead of a separate callback and boolean notification mode.
Keep snapshot history local to the message effect and derive editing
transitions from it rather than maintaining redundant refs.

Let React autofocus newly mounted composers and query the selected row
directly for focus repair. Inline trivial host navigation wrappers and
remove the duplicate index navigation after switching repositories.

Preserve versioned/deferred navigation and all existing test assertions.
Validated 64 unit tests, both grammars, 52 extension-host tests, compile,
lint, formatting, editor diagnostics, and whitespace checks.
This is an invariant since we use them as keys in React
Every command ran as a mutation: monitoring was paused, the spinner
shown and the whole series, index and work tree were read again, even
for expanding a row or marking a patch.

Run view-only commands directly. Opening and cancelling the commit
message editor still wait for a running mutation, but do not reload.

Reloads used to copy expansion and marks when they started reading,
which would now lose a change made while one is in flight. Let loaded
rows take over the current view state when they are shown instead, and
expand a row before its files have been read.
The Files column was empty for a patch or history commit until it had
been expanded, and went blank again at the next reload: the prefetch
only filled a cache, and a reload read files for expanded rows only.

Give each row its files from that cache when it is shown, and once more
when the prefetch of the remaining commits has finished.

Send the counts next to the rows and show them through a context, so
that counts arriving later redraw only their cells. Rows now carry
their file list only while expanded.
Closing the pane while a reload was in flight made every later open
fail with "Webview is disposed". Disposing the loader reported that
loading had finished, the resulting redraw touched the closed panel and
threw, and the close handler never got to forget the panel.

Do not report loading changes once disposed, and forget the pane before
tearing it down.
Size the textarea to 40% of the pane instead of a fixed 125px, so a
subject and body fit without dragging the resize handle. Cap it so the
label and buttons stay on screen in a short pane.
The webview folded "[submodule]" into the end of the file name, so it
lost the cyan the text view gave it, did not line up between rows and
was cut off by the ellipsis on long paths. Send it as a separate flag
and draw it as a cyan tag in front of the path.
The message used to be written in a text box in the webview, where
editor shortcuts and vim mode do not work. It now opens in a real text
editor, in an editor group of its own right under the StGit pane. The
editor is put back there whenever it or the pane is moved, or another
tab covers it, and other editors do not open in its group.

The editor shows the template of `stg new` and `stg edit`, which StGit
reads back with --file, so the patch name and author can be changed as
well. The message is highlighted as Markdown and the help as comments.

Ctrl+Enter or Ctrl+C Ctrl+C commits, as in the pane. Escape is left to
the editor, where vim needs it. Closing the editor commits a saved
message and cancels otherwise, as closing the editor of `stg new` does.
The cursor starts where the message goes.

Committing always closes the editor. As with `stg new`, an empty message
creates no patch, while an existing patch may be given an empty message.
Should StGit fail, the error offers to edit the message again.
A patch or commit with an empty commit message showed as an empty row.
It now shows a "no message" tag, in the style of the submodule tag.
A patch without changes, which had " (empty)" after its description,
now has an "empty" tag before it instead, like the other tags.
While running extension tests, VS Code prints its whole log to stdout.
Most of it came from the chat and agent features failing to sign in to
GitHub, and from the Git extension failing on the repositories the tests
delete. Run the tests in a fresh profile with those features turned off,
and keep what the tests' own git commands print to stderr out of the
output, since a failing command still reports it in its error.
@emanuelen5
emanuelen5 added this pull request to stack #12 November 30, 2026 21:50
@emanuelen5
emanuelen5 merged commit d344f5b into main Nov 30, 2026
3 checks passed
@emanuelen5
emanuelen5 deleted the webview branch November 30, 2026 21:53
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