Repository navigation
Conversation
Coding agents link the files they write as file:// URLs or an editor's vscode://file/<path>:<line> link. The system opener refuses both, and in an SSH session the file is on the server anyway, so a Control+click (Command+click on macOS) on one only left an error in the status bar. - A Control+click on a file link now opens the file panel at the file's folder with the file selected, opening the panel or switching it to the server first. file:// on a server names a file on that server; a local terminal takes only this computer's host. :line is dropped. - An agent that thinks the terminal has no hyperlinks underlines the name instead. term.UnderlinedTextAt reads that run (one colour, across soft wraps, with spaces and wide characters), and a Control+click on one that reads as a file name works the same way. A bare name is taken from the shell's reported folder; when it is not there, the folder's subfolders are searched for it. A plain click never takes it. - The terminal menu offers Show in Files, Download and Copy for a file link, an underlined file name or an absolute path, and Open in browser for a web link. Download selects the file and runs the panel's own download, so the download folder setting applies. Show in Files now selects the file rather than only opening its folder. - A file that is not in its folder says so in the status line. - docs: file links, in the terminal page. Closes t8y2#401 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #401.
What it does
Coding agents point at the files they write with an OSC 8 link, as
file:///home/me/notes/a.mdor an editor'svscode://file/<path>:<line>.app.OpenURLrefuses both. In an SSH session the file is on the server anyway, so a Control+click on one only left "Could not open link" in the status bar. An agent that thinks the terminal has no hyperlinks underlines the name instead, and Motty saw nothing at all to click.file://,vscode,vscode-insiders,vscodium,cursorandwindsurf(<scheme>://file/<path>), and a target that is already an absolute path.:lineand:line:columnare dropped.file://host/...is a file on that server whatever the host says. A local terminal only takes this computer's host (localDirectoryHost).term.UnderlinedTextAtreads the underlined run of one colour around a cell. The run may hold spaces and wide characters, and it follows soft wraps, including a row that wrapped early before a wide character.downloadSFTP, so the download folder setting and the save dialog behave as they do in the panel. It is offered on servers only.How it works
terminal_file_link.go:fileLinkTargetparses a link target into a path for the machine the session runs on.underlinedFileTargetdoes the same for underlined text.openSessionLinkreplacesopenTerminalLinkas the terminal'sopenLink. It is now a closure over the session ID, so a click knows whose files to show.revealSFTPEntryclears the filter, setsfolder.revealand navigates. Search results andshowInFilesshare it.sftpRevealcarriesdownloadandsearch.applyRevealreports whether the listing was the reveal's folder and whether the entry was in it.settleRevealis deferred in both listing paths, so it runs after the listing has written the status. It shows the not-found message, starts the subfolder search, or starts the download. The download therefore never runs from inside half-applied listing state, and its "queued" status is not overwritten.showInFilestakes asftpReveal. It clearsfollowPathso the terminal-follow cannot pull the panel back to the shell's folder, and it selects the entry instead of only opening its folder. A path ending in a slash still opens that folder.Testing
term:UnderlinedTextAtwith spaces, wide characters, an early soft wrap, a colour change and plain text.workbench/terminal_file_link_test.go:file://with a host and%20, editor links with:line:col, refused schemes, control characters, a local terminal refusing another host, and a Windowsfile:///C:/...link.file://link selects the file and does not reach the system opener. A plain click does nothing.vscode://file/...:3link opens a closed panel that was on local files, back on the server, with the file selected.terminal_action_test.go: absolute paths now also offer Download.gofmt,go vet ./...,go vet -tags dev ./internal/workbenchandGOOS=linux go vetfor the touched packages are clean.go testpasses forterm,i18nandsftpclient.workbenchhas one unrelated failure on this Windows machine,TestLocalListShowsApplicationBundlesWithTheirSystemIcon, which also fails on a cleanmainhere.🤖 Generated with Claude Code