Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>TX Trace LanguageNew to Visual Studio Code? Get it now.
TX Trace Language

TX Trace Language

Saw-mon and Natalie

|
14 installs
| (0) | Free
Language support for TX Trace files: syntax highlighting, custom folding and keyword decorations.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

TX Trace Language VS Code Extension

Language support for tx-trace files with trace-aware visuals and navigation.

Highlights

  • Rust-aligned tokenization plus tx-trace specific scopes
  • Trace line parsing (guides, arrows, gas, contract::function, call tags)
  • Gas values appear when hovering over calls, keeping calls at the same depth aligned.
  • Shortened addresses, long numbers, and bytes with a hover to view and copy the full value
  • Distinct styling for addresses, 32-byte hashes, and other hex strings
  • Flow indicators and emit lines (Stop, ← for returns, Revert, emit)
  • Call types in row hovers and gutter markers for staticcall and delegatecall
  • Custom folding for tree-style call frames
  • Go to Definition / Peek References for contract and function tokens
  • Solidity declarations and NatSpec on function-name hover when the workspace contains matching source
  • File icon for .txtrace and .tx-trace

Gas highlighting

Run TX Trace: Set Gas Highlighting from the Command Palette to combine Line Background, Gutter Heat Strip, and Text Opacity. Clear all three choices to turn highlighting off. Colors run from blue to red and call text opacity ranges from 30% to 100% across 33 levels. Each root call and its descendants share a logarithmic scale relative to the highest gas value in that trace. Return, stop, and emit text is dimmed while any gas style is active.

TX Trace: Toggle Gas Highlighting switches the last selected combination on or off. You can bind either command in Keyboard Shortcuts.

Trace Actions menu

Click TX Trace Actions in the trace editor's top-right toolbar beside Split Editor. It groups actions for views, selection, gas highlighting, and compact inputs.

Selection highlights

  • TX Trace: Highlight Selected Word marks each exact, case-sensitive match in gold. With the cursor alone, it uses the word under the cursor.
  • TX Trace: Highlight Selected Lines marks the selected lines or the cursor's line in violet.
  • TX Trace: Toggle Highlight Focus dims unmarked text in the current trace and pauses gas overlays, gutter marks, and custom token backgrounds. Run it again to restore the normal view.
  • TX Trace: Show Highlighted Lines opens the Trace Tree beside the editor with only marked lines and lines containing marked words.
  • TX Trace: Reset Selection Highlights clears both kinds of marks and exits focus. Marks accumulate while the file is open.

Trace Tree

Run TX Trace: Open Trace Tree for a read-only view beside the editor. Connectors stay straight at intermediate siblings and curve at the last child. Hover over a row or connector to emphasize its branch. The tree uses the trace's token colors and the active gas styles.

Highlights only shows matching rows without the gold or violet selection marks. Dashed connections pass through hidden ancestors.

Click a line number to jump to the source. Hover over a call row for its gas and call type. Hover over a shortened value to see its full text and click it to copy.

Function documentation

Hover over a function name in the trace editor or Trace Tree to see its Solidity declaration and formatted NatSpec. Click the source location to open the Solidity file beside the current editor at the declaration. For Sourcify results, the source link opens the verified contract page.

The lookup checks open Solidity files first, then searches the workspace. If the hover reports a timeout or no match, open the contract’s .sol file directly. It uses contract and function names and narrows overloads by argument count when the trace supplies it.

For deployed contracts, click Look up verified docs on Sourcify in the function hover. The extension reads the nearest project foundry.toml for the chain ID and the address label. A full contract address in the trace takes precedence over a label. Hovering alone makes no network request.

[profile.default]
chain_id = 1

[profile.default.tracing.labels]
"0x1111111111111111111111111111111111111111" = "Vault"

Use txtrace.foundryProfile in VS Code settings for a different profile. Match the label exactly as it appears in the trace, including any proxy or implementation suffix. Sourcify results use the verified ABI and NatSpec for that chain and address.

Shortened values

Addresses, long decimal numbers, hashes, and long hex bytes display with an ellipsis between their prefix and suffix. Hover over a shortened value to view it in full or use Copy full value to copy the original text.

Run TX Trace: Toggle Compact Function Inputs in the editor to display calls and events as Contract::function(...) and emit Event(...). Hover over ... to see one input per line with names aligned. Run the command again to expand the inputs. The Trace Tree follows the same toggle.

Trace style

Add a commented JSON block before the trace to set token foreground and background colors for that file.

# txtrace-config
# {
#   "contract": { "color": "#5eead4", "backgroundColor": "#143b38" },
#   "function": { "color": "#fbbf24" }
# }
# end-txtrace-config

Traces:
  [25000] Vault::deposit()

Supported keys are contract, function, return, revert, stop, emit, address, hash, bytes, and number. Each accepts color and backgroundColor as CSS hex colors. Missing fields use the normal theme colors.

File types

  • .txtrace
  • .tx-trace

Dev

  1. Install dependencies (prefers bun if available):
if command -v bun >/dev/null 2>&1; then
  bun install
else
  npm install
fi
  1. Build TypeScript:
npm run build
  1. Open in VS Code and run the extension host:
code --extensionDevelopmentPath=$(pwd)
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft