dsh-envelope-highlight
Restore syntax highlighting of read-tool results inside run_code (PTC / Code Mode).
Problem
In native mode, the read tool's result renders as a line-numbered,
syntax-highlighted code view (ReadBlock + shiki). In PTC / Code Mode,
the model calls tools through run_code programs, and read results arrive in
two shapes — both rendered as plain text by the official UI:
- Structured object
{ path, lines, totalLines }— returned from the
program, it lands in therun_codecard's OUT area as raw JSON; - Envelope text (
<path>…</path>\n<type>file</type>\n<content>…\n</content>,
tool-fs'sformatReadOutput) — the read sub-call (code-dispatch) content.
The syntax highlighting is lost in both cases.
Solution
This plugin registers two keyed tool.call.toolview views:
run_code(not registered by the shipped UI — zero replacement risk):
read envelopes and read-result JSON in the OUT area are parsed and rendered
asReadBlock— file line numbers in the gutter, shiki syntax
highlighting, the same visual language as the native read card.read(priority: -1, shadowing the official row): code-dispatch
sub-calls (whoseresultViewis always null) get their envelope content
rendered asReadBlock; native read calls are reproduced exactly like the
officialReadRow.
Non-read output stays exactly as before.
Install
dsh plugin --profile <profile> add dsh-envelope-highlight
Build (from source)
# requires a dsh source checkout (DSH_CHECKOUT) with tsc/tsdown
npm run build # host (tsc) + client (tsdown) → lib/
npm pack
Scope
- ✅
run_codechat-row result card: read envelopes + read-result JSON →
highlightedReadBlock - ✅
readsub-call rows under the run_code tree (code-dispatch) →
highlightedReadBlock; native read rows unchanged - ❌ Details panel (
conversation.details.tool) — not covered yet
License
MIT