Skip to content

to-human: local file links open in VS Code at their line (7.163.0) - #209

Merged
SSFSKIM merged 1 commit into
mainfrom
to-human-file-links
Oct 17, 2026
Merged

SSFSKIM merged 1 commit into
mainfrom
to-human-file-links

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 17, 2026

Copy link
Copy Markdown
Owner

What

On the terminal, a marked span's link to a local file — [name](/abs/path#L42) — is drawn as an explicit file: link behind a file glyph (nf-cod-file, VS Code's own), and a plain click on it opens VS Code at the line (vscode://file/<path>:<line>).

Why

The human's global CLAUDE.md now asks every file reference to be written as a Markdown link with the absolute path as its target, so files open from the conversation instead of by hand. The engine's Markdown element draws only http:, https: and file: links, and a cmd-click is Ghostty's own (it hands a file: URL to the file's default app, so no line). A plain click in the fullscreen terminal is the mod's to answer (onLinkPress + pressableLinks), which is the one place a line can reach VS Code.

How

  • fileLinks(block): rewrites local links outside code regions (reusing the mark parser's code-region reading) to file:// URLs (non-ASCII percent-encoded, #L kept as fragment) behind the glyph, and returns their targets for pressableLinks.
  • editorUrl(href): file:///p#L42 / /p#L42 → vscode://file/p:42; anything else → undefined.
  • A ui.press hook on to-human-links:* runs open <vscode url>, toasting on failure.
  • Remote surfaces are untouched.

Tests

tests/mods/run-mods-tests.sh: 322 pass, 0 fail (3 new: rewrite, URL, a pressed link on the terminal runs open vscode://…:12, desktop keeps the text as written). claude plugin validate . passes.

Not yet verified live: that the real terminal's press carries the file: target as written (so pressableLinks matches) and that Ghostty draws the glyph.

…open in VS Code at their line on a plain click (7.163.0)

On the terminal, [name](/abs/path#L42) in a marked span is drawn as an
explicit file: link behind nf-cod-file, and the view answers a plain click
on it (onLinkPress, pressableLinks) by opening vscode://file/<path>:<line>.
A cmd-click stays Ghostty's, which hands the file: URL to the default app.
Links inside code stay literal; remote surfaces draw the text as written.
@SSFSKIM
SSFSKIM merged commit b9b4d0b into main Oct 17, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant