Skip to content

fix(playground): line-level diff highlighting and reduce typing freezes#10442

Merged
JoshLove-msft merged 2 commits into
microsoft:mainfrom
JoshLove-msft:fix/playground-line-diff
Apr 22, 2026
Merged

fix(playground): line-level diff highlighting and reduce typing freezes#10442
JoshLove-msft merged 2 commits into
microsoft:mainfrom
JoshLove-msft:fix/playground-line-diff

Conversation

@JoshLove-msft
Copy link
Copy Markdown
Contributor

Bug 1: The CSS rule for '.playground-changed-line' was defined inside a .module.css file and imported as a side-effect. Vite/CSS Modules does not emit :global() rules from a side-effect import, so the class was never in the built stylesheet and Monaco decorations were invisible. Renamed to a plain .css file and removed the :global() wrapper.

Additionally, 'highlightChanges' was gated by 'emitterOptions.newChangeDiff' which the shipping website never sets. Default it to true so the feature is live out of the box (callers can still opt out).

Bug 2: While a compile is in progress, any additional onDidChangeContent-triggered recompile now marks a pending recompile flag and bails out instead of stacking work. When the current compile completes we run a single trailing recompile. This doesn't fix the fundamental main-thread block from synchronous compilation, but prevents queuing redundant blocking compiles while the user is typing.

Bug 1: The CSS rule for '.playground-changed-line' was defined inside a .module.css file and imported as a side-effect. Vite/CSS Modules does not emit :global() rules from a side-effect import, so the class was never in the built stylesheet and Monaco decorations were invisible. Renamed to a plain .css file and removed the :global() wrapper.

Additionally, 'highlightChanges' was gated by 'emitterOptions.newChangeDiff' which the shipping website never sets. Default it to true so the feature is live out of the box (callers can still opt out).

Bug 2: While a compile is in progress, any additional onDidChangeContent-triggered recompile now marks a pending recompile flag and bails out instead of stacking work. When the current compile completes we run a single trailing recompile. This doesn't fix the fundamental main-thread block from synchronous compilation, but prevents queuing redundant blocking compiles while the user is typing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 21, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/playground@10442

commit: a4dbebb

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

All changed packages have been documented.

  • @typespec/playground
Show changes

@typespec/playground - fix ✏️

Fix line-level diff highlighting not appearing in the playground output editor, and reduce typing freezes by coalescing recompilations triggered while a compile is already running.

@azure-sdk
Copy link
Copy Markdown
Collaborator

azure-sdk commented Apr 21, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JoshLove-msft JoshLove-msft added this pull request to the merge queue Apr 22, 2026
Merged via the queue into microsoft:main with commit 600e0ff Apr 22, 2026
31 checks passed
@JoshLove-msft JoshLove-msft deleted the fix/playground-line-diff branch April 22, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants