Problem
Every text change triggers a full panel.webview.html = this.buildHtml(...) re-render. This destroys all webview DOM state: scroll position, search highlights, fold states, and (before v0.3.0) cursor position. The cursor now persists via vscode.getState(), but this is a workaround, not a solution.
Proposed solution
Replace the full HTML assignment with postMessage-based content patching. The extension sends only the changed content to the webview, which applies a targeted DOM update while preserving all other state.
Why it matters
This is the foundation for every stateful feature: section folding, bookmarks, focus mode. Without it, each feature needs its own persistence workaround.
Complexity
High. Requires DOM diffing or a structured patching strategy. Debounce logic needed for rapid typing.
From ideation item #2. Confidence: 90%.
Problem
Every text change triggers a full
panel.webview.html = this.buildHtml(...)re-render. This destroys all webview DOM state: scroll position, search highlights, fold states, and (before v0.3.0) cursor position. The cursor now persists viavscode.getState(), but this is a workaround, not a solution.Proposed solution
Replace the full HTML assignment with
postMessage-based content patching. The extension sends only the changed content to the webview, which applies a targeted DOM update while preserving all other state.Why it matters
This is the foundation for every stateful feature: section folding, bookmarks, focus mode. Without it, each feature needs its own persistence workaround.
Complexity
High. Requires DOM diffing or a structured patching strategy. Debounce logic needed for rapid typing.
From ideation item #2. Confidence: 90%.