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
bug(ui): code in a language outside the 39 preloaded grammars is never highlighted in the browser #5384
The shared Shiki highlighter in packages/ui loads 39 grammars, plus Tale's template grammars, and loads any other language on demand. That on-demand load is a runtime import() of a bare module name, `shiki/langs/${lang}.mjs`, which a browser cannot resolve. So every other language falls back to plain text, with a console warning. The chat agents epic's browser pass (#5371) saw this on 2026-11-05: previewing planets.csv logged [shiki] language "csv" not loadable, falling back to plaintext.
What the repository says today (main9be27c4e2)
The strategy comment says: "Anything else is lazy-loaded on demand via a runtime dynamic import." (packages/ui/src/markdown/shiki.ts:1-14)
The eager grammars are at :69-111.
The on-demand load is at :338-365: import(/* @vite-ignore */ `shiki/langs/${resolvedLang}.mjs`). @vite-ignore tells Vite to leave the import as written.
The production build keeps it that way. The platform's built app-*.js (a build from 2026-11-05) contains import(`shiki/langs/${n}.mjs`). The eager grammars are chunks of their own (for example lua-*.js and sql-*.js), and nothing is built for csv. The app has no import map.
Callers:
The file preview highlights by the file's extension (services/platform/app/features/documents/components/document-preview-text.tsx:45-75); a CSV file is in the data category.
A Markdown code block highlights by its fence's language (packages/ui/src/markdown/code-block.tsx:54 → highlighted-code.tsx:104), which includes chat replies.
Not examined: the docs sites; which other languages people use; a test of the on-demand path (git grep finds none).
Options (no preference)
Let the bundler see every possible import: a glob or a fixed map of the extra grammars, each as its own lazy chunk.
Add the common extras (CSV, for example) to the eager list.
Drop the on-demand path and its promise: other languages are plain text, without the warning.
Activity
fix(ui): highlight grammars outside the eager list in the browser