Skip to content

feat(dx): add syntax highlighting for error stack trace source lines#32667

Draft
bartlomieju wants to merge 1 commit intomainfrom
feature/syntax-highlight-stack-traces
Draft

feat(dx): add syntax highlighting for error stack trace source lines#32667
bartlomieju wants to merge 1 commit intomainfrom
feature/syntax-highlight-stack-traces

Conversation

@bartlomieju
Copy link
Member

@bartlomieju bartlomieju commented Mar 12, 2026

Add a lightweight JS/TS syntax highlighter for source code lines displayed in error stack traces. Uses a simple character-scanning lexer (inspired by Bun's QuickAndDirtyJavaScriptSyntaxHighlighter) that works on arbitrary single lines without requiring syntactically valid code.

Features:

  • Keywords in bright blue, TS type keywords in cyan, strings in green, numbers/booleans in yellow, comments in gray, null in bold, undefined in gray (matching console.log inspect colors)
  • Template literal interpolation highlighting
  • Line number gutter prefix (e.g. "42 | source code here")
  • Error class name in red bold, "(in promise)" in gray
  • Bold red caret for error position indicator
Screenshot 2026-03-12 at 17 02 36

…ines

Add a lightweight JS/TS syntax highlighter for source code lines displayed
in error stack traces. Uses a simple character-scanning lexer (inspired by
Bun's QuickAndDirtyJavaScriptSyntaxHighlighter) that works on arbitrary
single lines without requiring syntactically valid code.

Features:
- Keywords in bright blue, TS type keywords in cyan, strings in green,
  numbers/booleans in yellow, comments in gray, null in bold,
  undefined in gray (matching console.log inspect colors)
- Template literal interpolation highlighting
- Line number gutter prefix (e.g. "42 | source code here")
- Error class name in red bold, "(in promise)" in gray
- Bold red caret for error position indicator

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bartlomieju bartlomieju changed the title feat(runtime): add syntax highlighting for error stack trace source l… feat(runtime): add syntax highlighting for error stack trace source lines Mar 12, 2026
@bartlomieju bartlomieju changed the title feat(runtime): add syntax highlighting for error stack trace source lines feat(dx): add syntax highlighting for error stack trace source lines Mar 12, 2026
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.

1 participant