feat(web): add syntax highlighting to source viewers - #6303
feat(web): add syntax highlighting to source viewers#6303Nameless-Monster-Nerd wants to merge 2 commits into
Conversation
|
Thanks @Nameless-Monster-Nerd — reusing the existing Shiki runtime for this is a nice fit. Since this is still a draft, we'll hold off on substantive review until you mark it ready for review.
|
|
ready to review |
PerishCode
left a comment
There was a problem hiding this comment.
The source-highlighting path has one blocking Windows line-ending regression: valid token output is discarded for normal multi-line CRLF files. The inline comment identifies the normalization fix and the missing regression case.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.|
any update |
|
Hey @Nameless-Monster-Nerd, quick update from our side: the current blocker is the CRLF regression that @PerishCode called out above, so the next step is a follow-up push addressing that normalization path and the missing regression coverage. Since this changes the source-viewing UI in a user-visible way, I’ve also marked it for manual QA before merge. Once the blocking review item is fixed, CI settles, and design sign-off is in, we’ll loop QA in on the current head. |
|
ok |
|
@PerishCode review please |
PerishCode
left a comment
There was a problem hiding this comment.
@Nameless-Monster-Nerd The source viewer now adds theme-aware Shiki token rendering for supported HTML, CSS, JavaScript, TypeScript, JSX/TSX, JSON, SVG, and related MIME types while preserving exact source text, line gutters, and plain-text fallbacks for unsupported, oversized, or token-dense inputs. I verified the full changed ranges, confirmed the prior multi-CRLF regression is fixed with focused coverage, and ran the two new test suites (8 tests passed) plus the web typecheck. Nice work addressing the follow-up cleanly and keeping the fallback behavior defensive.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.
Fixes #6301
Why
Generated HTML, CSS, and JavaScript files were rendered as monochrome text in the source viewer, making larger artifacts difficult to scan. This change addresses the issue reported from the Open Design desktop app while reusing the project’s existing Shiki runtime.
What users will see
Supported source files now use theme-aware syntax colors in the existing viewer. Line numbers and exact source text are preserved, with plain-text fallback for unsupported, oversized, or unusually token-dense files.
Surface area
apps/weborapps/desktop(including Electron menu bar)odsubcommand or flag, newtools-dev/tools-packflag, or newOD_*env var/api/*endpoint, new SSE event, or changed shape inpackages/contractsskills/,design-systems/,design-templates/, orcraft/, or change to the skills protocolTRANSLATIONS.mdfor the locale workflow)package.json(dependenciesordevDependencies); workspace-packagepackage.jsonfiles are out of scope. Include a paragraph on what we get vs. what bytes we ship (seeCONTRIBUTING.md→ Code style)Screenshots
Bug fix verification
apps/web/src/components/__tests__/FileViewer.syntax-highlight.test.tsxmainbecause the viewer never called Shiki for HTML/CSS/JavaScript, then passed on this branch.Validation
pnpm guardpnpm typecheckpnpm --filter @open-design/web test— 4,909 passed, 7 skippedpnpm --filter @open-design/web build