>_VSCODE-ZSH — ZSHRS IN VS CODE
Open a .zshrc and the whole shell lights up. zshrs is the first-ever Rust rewrite of zsh — a compiled, JIT'd, massively parallel shell. vscode-zsh registers the zshrs language for zsh dotfiles, *.zsh files, and zsh shebangs, highlights with a standalone TextMate grammar generated from the zshrs binary's own reflection tables (138 builtins, 112 extensions, 245 special variables), and starts the zshrs --lsp language server via vscode-languageclient. Since 0.2.0 it also runs the active script (Ctrl+F5) and debugs it (F5) through zshrs's own connect-back debug adapter, zshrs --dap.
Install
The zshrs binary must be on $PATH for the language server (build zshrs with cargo build). Build and install the .vsix locally:
git clone https://github.com/MenkeTechnologies/vscode-zsh cd vscode-zsh npm install npx @vscode/vsce package # vscode-zsh-<version>.vsix code --install-extension vscode-zsh-*.vsix
Or clone straight into your extensions dir for development: ~/.vscode/extensions/vscode-zsh.
What you get
Filetype detection
Zsh dotfiles (.zshrc, .zshenv, .zprofile, …), *.zsh / *.zsh-theme files, and files with a #!/usr/bin/env zsh shebang (via firstLine) become the zshrs language.
Own language grammar
A standalone TextMate grammar (source.zshrs) with its own language id — 138 builtins, 112 extensions, 245 special vars, not a shellscript reskin.
Generated from the binary
scripts/gen_grammar.sh dumps zshrs --dump-reflection (.builtins / .extensions / .special_vars), so the grammar never drifts from the shell.
Language server
Launches zshrs --lsp (stdio JSON-RPC) through vscode-languageclient — diagnostics, hover, completion as the server provides.
Run
zshrs: Run File — Ctrl+F5, the editor-title ▶, or the command palette. Saves the file and executes zshrs <file> in an integrated terminal.
Debug
Gutter breakpoints, step over/into/out, call stack, scopes, variables, watch and hover-to-evaluate. F5 on a zsh script works with no launch.json; program, args, cwd, stopOnEntry and zshrsPath are the launch attributes.
Connect-back DAP
zshrs --dap HOST:PORT dials into the IDE rather than speaking over stdio (the model it already uses in JetBrains). The extension runs that listener, spawns the adapter, and pipes the two sockets together.
Binary resolution
The zshrs binary is resolved to an absolute path from $PATH plus ~/.cargo/bin, /opt/homebrew/bin, /usr/local/bin and ~/.local/bin, so it works when the editor is launched from the Dock or Finder and inherits no shell $PATH.
Editor config
Comments, brackets, auto-closing pairs, and brace-based indentation via language-configuration.json.
Verified
A vscode-textmate + vscode-oniguruma test tokenizes a sample and asserts the scopes; separate headless tests cover binary resolution, the activation contract, and the DAP bridge end to end.
Scopes
| Token group | Scope |
|---|---|
Control flow (if then fi for while case function) | keyword.control.zshrs |
Declarations (typeset local export declare readonly integer) | storage.modifier.zshrs |
| Builtins (138) | support.function.builtin.zshrs |
| Extensions (112 — zshrs world-first additions) | support.function.extension.zshrs |
| Special variables (245) | variable.language.zshrs |
Sigil variables ($foo ${bar} $1 $? $@ $#) | variable.other.zshrs |
Operators / pipes / redirects (| || && > >> <<) | keyword.operator.zshrs |
Strings (single / double / backtick), here-docs (<<EOF / <<- / <<'EOF'), $var / ${...} interpolation, escapes, command substitution $(...), and numbers are scoped too.
Language server settings
| Setting | Default & effect |
|---|---|
zshrs.path | zshrs — path to the executable used for the language server, running and debugging |
zshrs.lsp.enabled | true — start the server; set false for highlighting only |
zshrs.lsp.args | ["--lsp"] — args to start the server |
If the binary is missing, the extension shows one non-fatal warning and highlighting keeps working.
Commands & keybindings
| Command | Title | Where |
|---|---|---|
zshrs.run | zshrs: Run File | Ctrl+F5, the editor-title ▶, the command palette |
zshrs.debug | zshrs: Debug File | F5, the editor-title debug icon, the command palette |
Both are gated on the active file being the zshrs language. For a saved configuration use debug type zshrs, request launch, with program, args, cwd, stopOnEntry and zshrsPath; the extension ships that configuration as both an initial configuration and a snippet, so launch.json is optional.
Compatibility
| Target | Status |
|---|---|
| VS Code 1.75+ | Grammar + LSP + run + debug |
| VSCodium / OSS builds | Same extension |
| Syntax highlighting | No binary required |
| Language server | Requires zshrs (PATH or a common install dir) |
| Run / debug | Requires zshrs; debugging needs its --dap adapter |