Description
Both the one-shot PR creation and step-by-step PR webview panels take noticeably long to open (estimated 300ms to 1s+), hurting UX.
Root Causes
Looking at src/inputService.ts:
-
Large inline HTML payload — All four webview HTML templates (getWebviewHtml, getStepByStepHtml, getAddCommitHtml, getFinalizePrHtml) inline ~250 lines of CSS each. getWebviewHtml and getAddCommitHtml also render one DOM entry per changed file, generating substantial markup when there are many files.
-
Full diff renderer included upfront — The diff-view CSS, JS rendering logic, and inline styles are loaded even though most users won't expand diffs immediately.
-
VSCode Webview overhead — createWebviewPanel + setting panel.webview.html with a large string is inherently slow on the extension host. String concatenation via template literals blocks the JS thread.
-
Synchronous HTML generation — getWebviewHtml() runs synchronously with all files rendered eagerly. With 50+ changed files, the template literal alone takes non-trivial time.
Affected Code
src/inputService.ts — all get*Html() functions (lines 26-528, 686-879, 881-1246, 1248-1412)
- Called via
createWebviewPanel in collectInputs() (line 537) and collectStepByStepInputs() (line 1421)
Suggested Solution
- Lazy-load diff CSS/JS — only inject diff-related styles and scripts when the user double-clicks to expand a file diff
- Minimize inline CSS — extract shared styles or reduce duplication across the four templates
- Virtualized file list — when there are 50+ files, render only the visible ones and use scroll event to render more
- Async HTML generation — use
setTimeout(0) to yield to the UI thread between template chunks
- Consider a single shared webview with routing instead of 4 separate panel types, so the HTML/CSS is loaded once
No implementation required — design discussion only.
Description
Both the one-shot PR creation and step-by-step PR webview panels take noticeably long to open (estimated 300ms to 1s+), hurting UX.
Root Causes
Looking at
src/inputService.ts:Large inline HTML payload — All four webview HTML templates (
getWebviewHtml,getStepByStepHtml,getAddCommitHtml,getFinalizePrHtml) inline ~250 lines of CSS each.getWebviewHtmlandgetAddCommitHtmlalso render one DOM entry per changed file, generating substantial markup when there are many files.Full diff renderer included upfront — The diff-view CSS, JS rendering logic, and inline styles are loaded even though most users won't expand diffs immediately.
VSCode Webview overhead —
createWebviewPanel+ settingpanel.webview.htmlwith a large string is inherently slow on the extension host. String concatenation via template literals blocks the JS thread.Synchronous HTML generation —
getWebviewHtml()runs synchronously with all files rendered eagerly. With 50+ changed files, the template literal alone takes non-trivial time.Affected Code
src/inputService.ts— allget*Html()functions (lines 26-528, 686-879, 881-1246, 1248-1412)createWebviewPanelincollectInputs()(line 537) andcollectStepByStepInputs()(line 1421)Suggested Solution
setTimeout(0)to yield to the UI thread between template chunksNo implementation required — design discussion only.