Files
7b0ccc7c00 Refactor Markdown rich editor messaging to HubRPC (#338005)
* Refactor Markdown rich editor messaging to HubRPC

Replace ad-hoc webview messages with shared runtime-validated interfaces and authenticated per-generation RPC connections. Preserve document edit ordering and editor behavior; cover lifecycle, stale edits, and transport isolation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix Markdown HubRpc CI source root and license coverage

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Reduce Markdown HubRPC bundle with Zod Mini

Bundle pinned HubRPC and Zod as development dependencies while retaining runtime validation and identical interface schema hashes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Align Markdown renderer validation with CI media config

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Load Markdown embedded web editors on demand

Defer the adapter until a rendered code block and registered providers need it. Preserve fallback rendering, refresh after loading and provider updates, and handle teardown and load failures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Dmitriy Vasyura <dmitriv@microsoft.com>
2026-10-06 11:49:21 +02:00
..
…
…

Language Features for Markdown files

Notice: This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.

Features

See Markdown in Visual Studio Code to learn about the features of this extension.

Rich editor RPC

The rich editor uses a private point-to-point @vscode/hubrpc connection between the extension host and webview. Shared runtime-validated interfaces in src/preview/markdownEditorProtocol.ts define document edits, commands, comments, diff markers, highlighting, rich links, and embedded-editor routing. No global Hub or capability service is required.

The interfaces use zod/mini to retain runtime validation and schema hashing without bundling Zod's full API and locale tables. HubRPC and Zod are development dependencies: the desktop extension, browser extension, and rich-editor builds bundle the runtime code they use.

Embedded web-editor support is loaded on demand when a fenced block is rendered and code-block providers are registered. Until loading completes, blocks use their normal rendering. Provider updates and completed loading refresh the blocks; the adapter still owns provider selection. Load failures are reported through the existing code-block diagnostics and can be retried by reopening the editor.

The TextDocument remains authoritative: local edits use the existing epoch queue and WorkspaceEdit, external changes replace the renderer mirror, and history commands drain accepted edits before invoking host undo/redo. Each webview generation has its own secret-authenticated transport and connection; reload/disposal closes pending requests and detaches listeners. Nested code block editors do not receive this secret and keep their separately sandboxed protocols; only their opaque host-transport payloads cross named RPC methods.