Skip to content

feat(frontend): syntax-highlight all tool results + expand language support#357

Open
dimakis wants to merge 1 commit into
mainfrom
feat/tool-result-highlighting
Open

feat(frontend): syntax-highlight all tool results + expand language support#357
dimakis wants to merge 1 commit into
mainfrom
feat/tool-result-highlighting

Conversation

@dimakis
Copy link
Copy Markdown
Owner

@dimakis dimakis commented May 22, 2026

Summary

  • All tool results now use CodeBlock instead of plain <pre> — Bash output gets bash highlighting, Write/Edit results use the file's language, everything else gets consistent monospace styling with copy button
  • 12 new languages added to both CodeBlock registrations and EXT_MAP: clojure, dart, elixir, erlang, haskell, nginx, nix, objectivec, ocaml, powershell, scala, wasm
  • Total language count: 34 → 46

Test plan

  • Expand a Read tool pill → file content highlighted (unchanged behaviour)
  • Expand a Bash tool pill → output highlighted with bash colouring
  • Expand a Write tool pill → result section uses CodeBlock styling
  • Expand an Edit/Diff tool pill → result section uses CodeBlock styling
  • Expand a Grep/Glob tool pill → plain monospace in CodeBlock (no language)
  • Read/Write/Edit a .nix, .ex, .hs, .dart, .scala file → correct highlighting

🤖 Generated with Claude Code

Use CodeBlock for all tool result rendering, not just Read tool.
Bash output gets bash highlighting, Write/Edit results get the file's
language, and everything else gets consistent monospace + copy button.

Add clojure, dart, elixir, erlang, haskell, nginx, nix, objectivec,
ocaml, powershell, scala, wasm to both CodeBlock registrations and
the EXT_MAP language map.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dimakis
Copy link
Copy Markdown
Owner Author

dimakis commented May 22, 2026

Centaur Review

Found 5 issue(s) (1 critical) (3 warning).

frontend/src/components/__tests__/ToolPill.test.tsx

Broken existing test for non-read tool rendering is the critical issue; the code change itself is sound but needs test updates for the new behavior and new EXT_MAP entries, plus an nginx sync gap between CodeBlock registrations and EXT_MAP.

  • 🔴 regressions (L177): Existing test 'renders plain pre for non-read tools' (lines 177-192) will fail. It asserts .tool-pill-pre exists and .code-block-highlight is null — but the new code renders all tool results through CodeBlock, which uses .code-block-highlight and never creates .tool-pill-pre. The test must be updated to match the new unified rendering. [fixable]

frontend/src/components/CodeBlock.tsx

Broken existing test for non-read tool rendering is the critical issue; the code change itself is sound but needs test updates for the new behavior and new EXT_MAP entries, plus an nginx sync gap between CodeBlock registrations and EXT_MAP.

  • 🔵 style: nginx is imported and registered in CodeBlock but has no extension mapping in packages/protocol/src/language.ts EXT_MAP. The comment at line 8 says 'Keep in sync with EXT_MAP'. Without an EXT_MAP entry (e.g., conf: 'nginx'), no file will ever resolve to this language via languageFromPath. Either add an EXT_MAP entry or remove the nginx registration. [fixable]

packages/protocol/__tests__/language.test.ts

Broken existing test for non-read tool rendering is the critical issue; the code change itself is sound but needs test updates for the new behavior and new EXT_MAP entries, plus an nginx sync gap between CodeBlock registrations and EXT_MAP.

  • 🟡 missing_tests: The 12 new EXT_MAP entries (objectivec, dart, scala, haskell, ocaml, clojure, elixir, erlang, powershell, nix, wasm, and multi-extension variants like .cljs/.edn/.lhs/.mli/.hrl/.psm1/.psd1/.wast) have no test coverage. The existing test file covers 15 extensions but none of the newly added ones. At minimum, add one representative test per new language. [fixable]

frontend/src/components/ToolPill.tsx

Broken existing test for non-read tool rendering is the critical issue; the code change itself is sound but needs test updates for the new behavior and new EXT_MAP entries, plus an nginx sync gap between CodeBlock registrations and EXT_MAP.

  • 🟡 missing_tests: No test covers the new behavior where a non-read tool with a language (e.g., a Bash/command tool with language: 'bash') gets syntax highlighting via CodeBlock. The old test only covered the non-highlighted path. A test should verify that command-type tool results get bash highlighting and that Write-type results get their file-extension-derived highlighting. [fixable]
  • 🟡 regressions (L93): Visual regression: non-read tool results previously rendered as a plain <pre> with a 'Result' <span> label (styled via .tool-pill-label + .tool-pill-pre). They now render inside a CodeBlock with a header bar containing label, copy button, and language badge. This changes the visual appearance — the header chrome (background, padding, copy button) will show even for simple one-line results like Grep output. Intentional UX change, but worth verifying it looks good for short/plain results.

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