Terminal Highlighter
Terminal Highlighter adds a Linux/Remote SSH terminal profile that automatically highlights common status words, errors, email addresses, and optional network addresses.
It launches the selected shell behind a Python PTY proxy, so interactive programs such as vim, top, ssh, tmux, and srun --pty bash continue to receive a real pseudo-terminal.
Requirements
- VS Code 1.85 or newer
- Linux or Remote SSH Linux extension host
- Python 3.6 or newer on the machine where the extension runs
- Bash, Zsh, Fish, or another POSIX shell
For Remote SSH, install the extension on the remote host when VS Code prompts you. The extension declares extensionKind: ["workspace"] so its Python wrapper and shell run remotely.
Start using it
- Install the VSIX.
- Run Terminal Highlighter: Validate Python Runtime.
- Open the terminal profile selector and choose Terminal Highlighter, or run Terminal Highlighter: Open Highlighted Terminal.
- Optionally run Terminal Highlighter: Set as Default Linux Profile.
Every new terminal created with this profile is highlighted automatically.
Built-in rules
The built-in rules cover:
- Email address: blue-violet and underlined
error, fail*, false, fault, fatal, down, not, kill: red bold
active, success*, true, ok, up, running, deployed, unlocked: green bold
start*, begin*, enable*, create*, open: green bold underline
stop*, end, finish*, disable*, delete*, close*: magenta bold underline
warn*, inactive, unknown: yellow bold italic
info: green bold
debug: magenta bold
- IPv4, IPv6, CIDR: available but disabled by default; enable them as needed
Matching is case-insensitive unless a custom rule requests case sensitivity. Earlier rules win when matches overlap.
Configuration
Open Settings and search for Terminal Highlighter.
Example custom rule in settings.json:
{
"terminalHighlighter.customRules": [
{
"name": "WRF fatal diagnostics",
"pattern": "\\b(?:segmentation fault|SIGSEGV|CFL error)\\b",
"color": "#ff5555",
"bold": true,
"underline": true,
"caseSensitive": false,
"enabled": true
}
]
}
Custom patterns use Python regular-expression syntax.
Shell selection
By default the extension uses $SHELL, falling back to /bin/bash.
{
"terminalHighlighter.shellPath": "/bin/bash",
"terminalHighlighter.shellArgs": ["-l"]
}
Python on older clusters
CentOS 7 often has Python 2 as python. Point the extension to an available Python 3 executable:
{
"terminalHighlighter.pythonPath": "/usr/bin/python3"
}
A module-provided Python can also be used by specifying its absolute executable path.
ANSI handling
The filter parses terminal escape sequences and highlights only printable text. Existing SGR styles are tracked as a bounded effective state and restored after each highlighted match. CSI, OSC, DCS, keyboard, mouse, bracketed-paste, resize, and other PTY data are forwarded unchanged.
Printable text remains eligible for keyword highlighting inside alternate-screen applications such as Helix, Vim, top, and tmux. Repeated full-screen redraws therefore keep their current colors and attributes without accumulating or replaying partial SGR sequences.
If an unknown, malformed, or oversized SGR sequence makes exact style restoration impossible, only text in that ambiguous state is forwarded without injected highlighting until a full SGR reset. This safety fallback is independent of the application and alternate-screen mode.
Known limitations
- This version targets Linux and Remote SSH Linux. Windows ConPTY is not implemented.
- VS Code shell integration may not be injected automatically because the outer profile executable is Python rather than the child shell.
- A keyword split across separate low-level PTY reads may occasionally not be highlighted. Normal line-oriented command output is generally emitted in sufficiently large chunks.
- Custom regular expressions run on terminal output; avoid computationally expensive expressions.
Install from a VSIX
Use Extensions: Install from VSIX..., or:
code --install-extension terminal-highlighter-0.1.0.vsix