Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Hermes for VS CodeNew to Visual Studio Code? Get it now.
Hermes for VS Code

Hermes for VS Code

Sichen Ji

|
2 installs
| (0) | Free
Quote code and Markdown into the Hermes Agent TUI — with file path and line numbers, in one keystroke.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Hermes for VS Code

Hand your code to the AI — no copy-paste.

Select a few lines, press Ctrl+Alt+R, and they land in the Hermes Agent TUI composer with the file path and line numbers attached. The cursor stays where you left it, so you can finish your question before hitting Enter.

中文说明见下方 中文 一节。

1 · Quote from the editor | 在编辑器里选中代码,右键引用

Editor context menu: Hermes quote selection, with shortcuts Ctrl+Alt+R and Ctrl+Alt+Enter

2 · Quote from the Markdown preview | 在 Markdown 预览里划选,同样右键

Markdown preview context menu: Hermes quote selection

3 · It lands in the TUI, path and lines included | 带着路径和行号落进输入框

Quoted block injected into the Hermes TUI composer with file path and line numbers

Why bother

Copy-paste throws away the one thing that matters: where the code came from. Re-typing "that's line 87 of extension.ts" every single turn is pure overhead.

This extension does one thing, cleanly — it hands "location + content" to the Hermes process already running in your terminal:

[quote path="/abs/path/to/file.ts" lines=87-91]
  const existing = findHermesTerminal();
  if (existing) {
    existing.show();
    return;
  }
[/quote]

path locates it; the body is a snapshot of the text as it is right now.

Three ways to quote

Where you are Trigger Result
Editor selection Ctrl+Alt+R or right-click Injected into the composer, not sent
Want to send immediately Ctrl+Alt+Enter Injected and submitted
Selection in the built-in Markdown preview Right-click → quote Mapped back to real source line numbers

The preview case is the hard part: the built-in preview is a webview, so the extension host cannot read its DOM selection. A script injected via markdown.previewScripts stashes the selection into the right-click context, and the extension matches the rendered text back to a unique window of source lines.

Line numbers are only written when the match is unique — an absent line number beats a wrong one.

Deliberate choices

  • Quote ≠ send: text stops in the composer so you can add "why is this written this way?" before Enter
  • Long quotes collapse into a [N lines] chip in the TUI instead of flooding the screen
  • Empty selection quotes the cursor line
  • Multi-cursor quotes each range, de-duplicating overlaps
  • Never blind-typed: if the TUI isn't up yet, nothing is written into the terminal (it would hit the shell); the quote falls back to the clipboard and the terminal is launched

Also included

  • Open the Hermes TUI from the title bar — click the Hermes icon, or press Ctrl+Alt+H
  • Editor-area split terminal (ViewColumn.Beside) — sits beside your code, draggable, closable on its own, and leaves the bottom integrated terminal alone
  • Single instance — triggering again focuses the existing terminal instead of opening another
  • Follows the workspace — the terminal starts in the first workspace folder
  • Random kaomoji terminal names — each session gets one, e.g. hermes · (^▽^)
  • Menu titles follow your VS Code language — English by default, Chinese on zh-cn

Requirements

A working Hermes Agent CLI (hermes) on your machine. See Hermes Agent to install it.

If a window cannot find hermes, set hermesForVscode.hermesPath explicitly.

Install

From the Marketplace — search Hermes for VS Code, or:

code --install-extension sichen7263.hermes-for-vscode

From a VSIX (offline / internal testing):

code --install-extension hermes-for-vscode-0.3.7.vsix

Settings

Setting Default Description
hermesForVscode.hermesPath "" (auto-detect) Path to the hermes executable. Empty = auto-detect (Windows: PATH, %LOCALAPPDATA%\hermes\hermes-agent\venv; Linux/macOS: PATH, ~/.local/bin, ~/.hermes). Overrides auto-detection when set
hermesForVscode.hermesCommandArgs ["--tui"] Extra CLI args appended to the launch command
hermesForVscode.quoteMode "inject" How quotes are delivered. inject writes into the TUI composer (falls back to the clipboard and launches the terminal when no TUI is running); clipboard only copies, so you paste with Ctrl+V

Remote (Remote-WSL / SSH / Dev Containers)

No extra configuration. With Remote, the extension host itself runs on the remote side (e.g. process.platform === 'linux' inside WSL) and simply executes hermes --tui there. No WSL toggle, no /mnt/ path mapping, no wsl ... wrapper.

Make sure the extension is installed on the remote (Extensions view → "Install in WSL / SSH"), otherwise it will not activate.

Known limitations

  • The terminal uses the first workspace folder: in a multi-root workspace it does not follow the active folder; point hermesCommandArgs at a target if you need one
  • quoteMode: inject needs a ready TUI: the extension never blind-types into a terminal whose shell hasn't started. It falls back to the clipboard; press the shortcut again once the TUI is up
  • Preview selection only works in the built-in preview: third-party Markdown renderers do not load the injected script
  • Preview quotes are capped at 20,000 characters, with a hint to quote from the source tab instead
  • Single instance is per window: each VS Code window keeps its own Hermes terminal

Development

npm run compile    # src/ → out/, reusing a local TypeScript install
npm run package    # builds hermes-for-vscode-<version>.vsix

Debug: open this folder in VS Code, press F5 to start the Extension Development Host, then open any file and click the Hermes icon in the title bar.

No network requests, no telemetry.


中文

把代码递给 AI,不用复制粘贴。

在编辑器里划一段,按 Ctrl+Alt+R——它带着文件路径和行号落进 Hermes 的输入框, 光标留在原地,等你把想说的话补完再回车。

为什么值得为它装一个扩展

复制粘贴丢掉的,恰恰是最要紧的东西:这段代码从哪来。 每轮对话补一句「这是 extension.ts 第 87 行」,是纯粹的重复劳动。

这个插件只做一件事,但做得很干净——把「位置 + 内容」一起送进终端里正在跑的 Hermes:

[quote path="/abs/path/to/file.ts" lines=87-91]
  const existing = findHermesTerminal();
  if (existing) {
    existing.show();
    return;
  }
[/quote]

path 管定位,正文是当下的快照。模型既知道该去哪看,也拿到了这一份内容。

三种取法,覆盖你真正会遇到的三种场景

你在哪 怎么触发 结果
编辑器里选中代码 Ctrl+Alt+R 或右键 注入输入框,不发送
想立刻问出去 Ctrl+Alt+Enter 注入并回车
内置 Markdown 预览里划选 右键 → 引用选中内容 反查回源文件的真实行号

预览那条是这里最难的部分:内置预览是 webview,扩展宿主读不到它的 DOM 选区。 插件通过 markdown.previewScripts 注入脚本,把选区暂存进右键上下文,右键时由 VS Code 作为命令参数回传;再用渲染文本回到源码里找唯一匹配的行窗口。

只在唯一匹配时才写行号——匹配不确定宁可不写。给一个错的行号,比不给更糟。

几个刻意的取舍

  • 注入 ≠ 发送:文字落进输入框就停住,你可以接着补「这里为什么这么写」再回车
  • 长引用自动折叠:TUI 会把多行折叠成 [N 行],不刷屏
  • 空选区引用光标行:不必先选中,直接按
  • 多光标逐段引用:一次引用多处,同一段自动去重
  • 绝不盲注:TUI 还没起来时不会往终端写字符(会打进 shell),自动退为剪贴板并拉起终端

顺带把终端也做顺手了

  • 右上角图标一键唤起 Hermes TUI,Ctrl+Alt+H
  • 编辑器区分屏:终端放右侧(ViewColumn.Beside),不挤占底部集成终端,可拖动、可独立关闭
  • 单例复用:已存在就聚焦,不重复开新的
  • 跟随工作区:终端工作目录取第一个工作区文件夹
  • 随机颜文字终端名:每次新会话随机取一个,例如 hermes · (^▽^)
  • 菜单标题跟随 VS Code 语言:默认英文,中文环境自动显示中文

前提条件

需要本机可用的 Hermes Agent CLI(hermes 命令)。未安装请先参考 Hermes Agent。

装好后若某个窗口找不到 hermes,在设置里手动指定 hermesForVscode.hermesPath。

安装

code --install-extension sichen7263.hermes-for-vscode

或在扩展视图「Views and More Actions...」→「Install from VSIX...」安装本地 .vsix。

配置

设置项 默认值 说明
hermesForVscode.hermesPath ""(自动推断) hermes 可执行文件路径。留空时自动探测(Windows 查 PATH / %LOCALAPPDATA%\hermes\hermes-agent\venv;Linux/macOS 查 PATH / ~/.local/bin / ~/.hermes)
hermesForVscode.hermesCommandArgs ["--tui"] 追加到 hermes 启动命令的参数
hermesForVscode.quoteMode "inject" inject 直接注入 TUI 输入框(TUI 未启动时退为剪贴板并拉起终端);clipboard 只复制

已知限制

  • 终端工作目录取第一个工作区文件夹:多根工作区不跟随当前激活的文件夹
  • quoteMode: inject 需要 TUI 已就绪:不会向 shell 还没就绪的终端盲注,自动退为剪贴板
  • 预览选区只对内置预览生效:第三方 Markdown 渲染器不会加载注入脚本
  • 预览引用上限 20000 字符
  • 单例作用域是「当前窗口」

技术说明

  • 复用 VS Code 内置集成终端(ConPTY),以 ViewColumn.Beside 放入编辑器区右侧——不打包 node-pty / xterm.js,体积小、无原生依赖
  • 终端身份通过 _HERMES_EXTENSION=1 环境变量识别,而非终端名(名字是随机颜文字)
  • 预览选区经 markdown.previewScripts 注入的脚本写入 <body data-vscode-context>,右键时由 VS Code 作为命令参数回传
  • 不发起任何网络请求,不采集遥测

许可证

MIT(全文见扩展包内 LICENSE.txt)

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft