Repository navigation
Conversation
Cmd/Ctrl-clicking a URL like `file:///src/Main.kt:35:24` (as printed by Gradle and other compilers) passed the whole string, suffix included, to the OS. No file has that name, so nothing happened. URL links (and OSC 8 hyperlinks) now go through `open_url_link`. When a `file://` URL ends in a line/column suffix and the path without the suffix is an existing file, it is opened like a detected file path, honoring the line and column. Everything else, including `file://` URLs without a suffix, is still handed to the OS as before. Fixes warpdotdev#3970
Open
3 of 4 tasks
maxmilian
marked this pull request as ready for review
October 27, 2026 07:32
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.
Description
Cmd-clicking (Ctrl-clicking on Linux/Windows) a
file://URL with a line/column suffix in terminal output does nothing. Gradle, kotlinc and other tools print locations in this form, for example:Root cause. The URL detector (
urlocator) treats the whole token,:35:24included, as one URL, and that takes priority over file-path detection. When the link is clicked, theGridHighlightedLink::Urlarm inmaybe_open_link(app/src/terminal/view.rs) and inopen_highlighted_link(app/src/terminal/view/link_detection.rs, used by the "Open link" tooltip and context menu) passes the string straight toctx.open_url. The OS looks for a file literally namedMain.kt:35:24, finds none, and fails silently. A plain path such as/Users/me/project/src/Main.kt:35:24already works, because file-path detection parses the suffix withCleanPathResult::with_line_and_column_numberand opens it throughopen_file_path.Fix. The URL arms, and the OSC 8 hyperlink path (
open_hyperlink_uri, which is also what theHyperlinkClickaction uses), now call a smallopen_url_linkhelper. It usesfile_url_link_targetto split a:line[:col]suffix off afile://URL with the sameCleanPathResult::with_line_and_column_numberparser.Url::to_file_pathdecodes percent-encoding, somy%20notes.ktworks. If the result is an existing file, it is opened throughopen_file_path, the same way a detected file path with a suffix is opened. Otherwise the URL is handed to the OS as before.Kept narrow on purpose. Only URLs that have a suffix and resolve to an existing local file change behavior:
file://URLs without a suffix still go to the OS, soecho file:///…/foo.txt+ Cmd-click still opens the file in its default macOS app, as it does today.fileschemes,file://URLs with a host other thanlocalhost, and paths that don't exist are unchanged. The host check runs before anything touches the filesystem, so afile://host/share/x.kt:1link is never resolved as a UNC path on Windows.notes:12), it is not reinterpreted as line 12 ofnotes.When a suffixed
file://link is opened, it follows the same "open files with" editor setting as other file links with a line number, since that's the only way to honor the line and column.This is a different code path from #11566, which handles
file://links in AI block output. The two changes don't overlap.Linked Issue
Fixes #3970
ready-to-specorready-to-implement.Testing
cargo fmt -- --checkcargo clippy -p warp --all-targets --tests -- -D warningscargo nextest run -p warp --lib -E 'test(/terminal::view/)': 360/360 passed./script/run(see below)New tests:
link_detection_tests.rs:file_url_link_targetsplits:35:24and:35, decodes a percent-encoded space, acceptsfile://localhost/…(unix), returnsNonewith no suffix, for non-fileschemes, for missing files and for a remote host, and keeps a file literally namednotes:12(unix only).view_tests.rstest_clicking_file_url_with_line_and_column_opens_file: prints afile://…/Main.kt:35:24line into a block, checks that it is detected as one URL, then Cmd/Ctrl-clicks it throughclick_on_gridand assertsOpenFileWithTargetis emitted with the file and line 35, column 24.All three behavior tests failed before the fix. The view test failed with no
OpenFileWithTargetevent because the URL went toopen_url.Screenshots / Videos
Same window, the same Gradle-style line (
catof a file containinge: file:///Users/maxmilian/c3970-demo/src/Main.kt:35:24 Return type of 'clear' ...), and the same synthesized Cmd-click on the link in both builds (./script/runbundles on macOS). "Open files with" is set to Warp in both.21f06832): the link is underlined on hover, but Cmd-clicking it does nothing.4f5cd75b): Cmd-clicking opensMain.ktin a Warp editor pane at line 35, with the cursor on the secondclear.With the default "Open files with: system default", the file is handed to the default app without a line number, the same as a plain
Main.kt:35:24path today.Full recordings: master · this PR
Agent Mode
🤖 Generated with Claude Code
https://claude.ai/code/session_01Rtq1jctUbJMqEmwTxtZsTu