You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature] Streaming Markdown & Code Syntax Highlighting Polish in VS Code Extension #751
Improve the rendering of streaming text in the VS Code extension, specifically ensuring that code blocks receive syntax highlighting immediately as they stream in, rather than waiting for completion.
Use Case
When generating large blocks of code, users want to read and evaluate the code in real-time. If the VS Code extension's markdown renderer waits for the closing ``` backticks, the text appears as unformatted plaintext for too long, making the AI feel sluggish.
Proposed Solution
Configure the webview markdown parser (currently marked.min.js) to handle incomplete code blocks gracefully. Additionally, append a subtle blinking cursor (e.g., ▌) to the end of the stream to clearly indicate active generation.
Alternatives Considered
Using a heavier markdown library, but this could impact webview performance.
Additional Context
I have searched existing issues to ensure this is not a duplicate
This feature aligns with the project's goals (local-first AI assistance)
Target Component: VS Code Extension (plugins/vscode/)
Implementation Notes (optional)
Folder Path:plugins/vscode/
UI: Update the DOM injection logic in plugins/vscode/media/chat-panel.js (when handling agent_thought_chunk updates) to format partial code blocks safely before passing them to marked.
Contribution Guidelines
If you would like to work on this issue, please comment below to ask for assignment first.
Before opening a Pull Request, please briefly share your implementation plan in this thread so we can align on the approach!
quick thing before i start — tested marked against an unclosed fence and it already turns it into a proper <pre><code> block, doesn't wait for the closing backticks. same deal in ThoughtAggregator for the thinking bubble. so it's not actually waiting for completion like the issue says
real issue is there's no syntax highlighter at all right now. marked just dumps <pre><code class="language-x"> with zero color, streaming or done, doesn't matter
was thinking i'd vendor a small highlighter same way marked.min.js is done (static file, no new dep), run it after each render tick on both paths, and do the cursor separately since that's a different thing entirely. sound good?
Went with vendoring a small highlight.js bundle the same way marked.min.js is already done — static file, no new dep, just a curated set of common languages so the extension doesn't balloon in size.
For rendering, switched from a full re-parse-and-replace on every stream tick to block-level diffing — split the markdown into blocks via marked.lexer(), only touch a block if its raw text actually changed. Cursor's handled completely separately, pure CSS, not mixed into the markdown logic at all.
Hit two real bugs along the way I wasn't expecting — blank lines between blocks were leaving empty stray divs in the DOM, and highlighting a code fence while its language name was still mid-typing (like "py" before "python") caused a console warning and a flash of unstyled text. Both fixed.
@kishore280 I just assigned you to #856, so please complete that one first. Once it's done, mention me again and I'll assign this one to you if no one else has already shown interest.
Activity
kishore280 commentedon Aug 12, 2026
hey @akramcodez, want to take this one
quick thing before i start — tested marked against an unclosed fence and it already turns it into a proper
<pre><code>block, doesn't wait for the closing backticks. same deal in ThoughtAggregator for the thinking bubble. so it's not actually waiting for completion like the issue saysreal issue is there's no syntax highlighter at all right now. marked just dumps
<pre><code class="language-x">with zero color, streaming or done, doesn't matterwas thinking i'd vendor a small highlighter same way marked.min.js is done (static file, no new dep), run it after each render tick on both paths, and do the cursor separately since that's a different thing entirely. sound good?
kishore280 commentedon Aug 12, 2026
Went with vendoring a small highlight.js bundle the same way marked.min.js is already done — static file, no new dep, just a curated set of common languages so the extension doesn't balloon in size.
For rendering, switched from a full re-parse-and-replace on every stream tick to block-level diffing — split the markdown into blocks via marked.lexer(), only touch a block if its raw text actually changed. Cursor's handled completely separately, pure CSS, not mixed into the markdown logic at all.
Hit two real bugs along the way I wasn't expecting — blank lines between blocks were leaving empty stray divs in the DOM, and highlighting a code fence while its language name was still mid-typing (like "py" before "python") caused a console warning and a flash of unstyled text. Both fixed.
Branch's up here if you want to take a look before I open the PR: https://github.com/kishore280/nanocoder/tree/feat/751-vscode-streaming-syntax-highlight — open to feedback on the approach.
akramcodez commentedon Aug 13, 2026
@kishore280 I just assigned you to #856, so please complete that one first. Once it's done, mention me again and I'll assign this one to you if no one else has already shown interest.
feat(vscode): syntax-highlight code blocks and show a cursor while st…