feat(frontend): syntax-highlight all tool results + expand language support#357
feat(frontend): syntax-highlight all tool results + expand language support#357dimakis wants to merge 2 commits into
Conversation
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>
Centaur ReviewFound 5 issue(s) (1 critical) (3 warning).
|
- Update ToolPill test: non-read results now render via CodeBlock - Add tests for bash/write tool result highlighting - Add 13 tests for new EXT_MAP languages (objectivec, dart, scala, haskell, ocaml, clojure, elixir, erlang, powershell, nix, wasm, nginx) - Add conf → nginx mapping to close CodeBlock/EXT_MAP sync gap Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dimakis
left a comment
There was a problem hiding this comment.
Centaur Review
Found 3 issue(s) (2 warning).
packages/protocol/src/language.ts
Clean feature expansion — EXT_MAP and CodeBlock registrations are in sync, the ToolResult refactor handles all edge cases correctly, and tests cover the core behavior. Main concern is .conf → nginx being overly broad.
- 🟡 unsafe_assumptions (L97): Mapping
.conf→nginxis too broad. Many non-nginx files use.conf(e.g.httpd.conffor Apache,sysctl.conf,resolv.conf,logrotate.conf, application configs). Applying nginx syntax highlighting to these will produce misleading results. Consider removing this mapping or using basename-level detection (e.g. only match files containing 'nginx' in the name).[fixable] - 🟡 unsafe_assumptions (L59): Mapping
.m→objectivecconflicts with MATLAB/Octave, which also uses.mfiles. In codebases that use MATLAB, this will produce incorrect highlighting. No great solution — just worth documenting the ambiguity as a code comment.
packages/protocol/__tests__/language.test.ts
Clean feature expansion — EXT_MAP and CodeBlock registrations are in sync, the ToolResult refactor handles all edge cases correctly, and tests cover the core behavior. Main concern is .conf → nginx being overly broad.
- 🔵 missing_tests: New extension variants added to EXT_MAP lack test coverage:
.mm(objectivec),.sbt(scala),.lhs(haskell),.mli(ocaml),.cljc/.edn(clojure),.exs(elixir),.hrl(erlang),.psm1/.psd1(powershell),.wast(wasm). Each language has one extension tested but the secondary extensions are uncovered.[fixable]
|
|
||
| // Infrastructure | ||
| dockerfile: 'dockerfile', | ||
| conf: 'nginx', |
There was a problem hiding this comment.
🟡 unsafe_assumptions: Mapping .conf → nginx is too broad. Many non-nginx files use .conf (e.g. httpd.conf for Apache, sysctl.conf, resolv.conf, logrotate.conf, application configs). Applying nginx syntax highlighting to these will produce misleading results. Consider removing this mapping or using basename-level detection (e.g. only match files containing 'nginx' in the name). [fixable]
| kts: 'kotlin', | ||
| swift: 'swift', | ||
| cs: 'csharp', | ||
| m: 'objectivec', |
There was a problem hiding this comment.
🟡 unsafe_assumptions: Mapping .m → objectivec conflicts with MATLAB/Octave, which also uses .m files. In codebases that use MATLAB, this will produce incorrect highlighting. No great solution — just worth documenting the ambiguity as a code comment.
Summary
CodeBlockinstead of plain<pre>— Bash output getsbashhighlighting, Write/Edit results use the file's language, everything else gets consistent monospace styling with copy buttonCodeBlockregistrations andEXT_MAP: clojure, dart, elixir, erlang, haskell, nginx, nix, objectivec, ocaml, powershell, scala, wasmTest plan
.nix,.ex,.hs,.dart,.scalafile → correct highlighting🤖 Generated with Claude Code