Skip to content

Warm typediagram renderer during VS Code activation for markdown preview#23

Merged
MelbourneDeveloper merged 3 commits into
Nimblesite:mainfrom
abdushakoor12:fix/markdown-preview-warmup
May 2, 2026
Merged

Warm typediagram renderer during VS Code activation for markdown preview#23
MelbourneDeveloper merged 3 commits into
Nimblesite:mainfrom
abdushakoor12:fix/markdown-preview-warmup

Conversation

@abdushakoor12
Copy link
Copy Markdown
Contributor

TLDR

Warm the VS Code typeDiagram sync renderer during extension activation so the first Markdown preview render produces SVG instead of leaving a pending raw-code placeholder. Fixes #21.

Details

What Was Added:

  • A cold-start regression test in packages/vscode/test/extension.test.ts that mocks a not-yet-warm typediagram-core, activates the extension, renders a typeDiagram Markdown fence, and asserts the first render contains SVG and not typediagram-pending.

What Was Changed/Deleted:

  • packages/vscode/src/extension.ts now makes activate async and awaits warmupSyncRender() before returning the extendMarkdownIt contribution when the sync renderer is still cold.
  • The activate-time warmup path logs success and failure explicitly.
  • packages/vscode/test/extension.test.ts now awaits activate(...) throughout the extension-host tests to match the async activation contract.
  • The existing markdown preview refresh test now explicitly mocks a cold renderer so it remains deterministic after activate-time warmup.

Spec/Doc Changes:

  • None.

Breaking Changes:

  • No.

How Do The Automated Tests Prove It Works?

  • make ci passed.
  • packages/vscode/test/extension.test.ts includes [VSCODE-MD-COLD-FIRST-RENDER] waits for warmup before exposing markdown preview so the first render is SVG, which directly covers the reported failure mode.
  • packages/vscode/test/extension.test.ts also still verifies [VSCODE-MD-EXTEND] extendMarkdownIt schedules a preview refresh after warmup, proving the cold-path refresh behavior remains wired.
  • The full packages/vscode suite passed with 132 passed, 1 skipped, and the full workspace CI run completed successfully.

@MelbourneDeveloper MelbourneDeveloper merged commit b78e82a into Nimblesite:main May 2, 2026
1 check passed
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.

VS Code 0.6.0 markdown preview leaves typeDiagram fence as raw code after warmup

2 participants