feat: print target and package names formatted as file hyperlinks#15405
feat: print target and package names formatted as file hyperlinks#15405weihanglo merged 1 commit intorust-lang:masterfrom
Conversation
|
this would also work on vte and konsole. |
weihanglo
left a comment
There was a problem hiding this comment.
Looks good to me! Thanks you.
| let mut shell = ws.gctx().shell(); | ||
| for (name, manifest_path) in packages { | ||
| let link = shell.err_file_hyperlink(manifest_path); | ||
| writeln!(output, "{ITEM_INDENT}{link}{}{link:#}", name)?; |
There was a problem hiding this comment.
| writeln!(output, "{ITEM_INDENT}{link}{}{link:#}", name)?; | |
| writeln!(output, "{ITEM_INDENT}{link}{name}{link:#}")?; |
There was a problem hiding this comment.
On macOS:
- ghostty 1.0.1 opened the default editor.
- kitty 0.38.1 opened the default editor.
- iterm2 3.5.11 didn't render any link, even the old existing ones. Anyway, I tried
It tried to scp at the first attempt as we found in feat: Make browser links out of HTML file paths #12889 (comment). However in subsequent attempts it worked correctly and opened the default editor.
printf '\e]8;;file:///Users/user/foo/Cargo.toml\e\\This is a link\e]8;;\e\\' - alacritty 0.15.1 didn't render any link just like iterm2. With the same test link above it worked and opened the default editor.
@ehuss would you happen to know why iterm2 doesn't really render those links? Finished dev profile [unoptimized + debuginfo] target(s) in 0.04s should also have a rendered link, but on iterm2 I didn't see it.
There was a problem hiding this comment.
I feel like this is a two-way door decision, and we already provide a way to disable the behavior, so the bar accepting this should be fairly low. However, as @ehuss has raised a concern of iterm2, I'd like to hear opinions from them :)
There was a problem hiding this comment.
Yeah and by turning hyperlink on always, both alacritty and iTerm2 work for me. I am going to merge this since iTerm2 is already always disabled.
Update cargo 12 commits in 0e93c5bf6a1d5ee7bc2af63d1afb16cd28793601..864f74d4eadcaea3eeda37a2e7f4d34de233d51e 2025-04-05 00:00:24 +0000 to 2025-04-11 20:37:27 +0000 - chore: Bump build-rs version (rust-lang/cargo#15421) - fix(build): Correct name of CARGO_CFG_FEATURE (rust-lang/cargo#15420) - Revert "fix(package): detect dirtiness for symlinks to submodule" (rust-lang/cargo#15419) - Improved error message when build-dir template var is invalid (rust-lang/cargo#15418) - Added validation for unmatched brackets in build-dir template (rust-lang/cargo#15414) - fix(package): detect dirtiness for symlinks to submodule (rust-lang/cargo#15416) - chore(deps): bump crossbeam-channel from 0.5.14 to 0.5.15 (rust-lang/cargo#15415) - docs(metadata): Added build_directory to cargo metadata documentation (rust-lang/cargo#15410) - Added symlink resolution for `workspace-path-hash` (rust-lang/cargo#15400) - feat: print target and package names formatted as file hyperlinks (rust-lang/cargo#15405) - docs(ref): Use better example value in `CARGO_CFG_TARGET_ABI` (rust-lang/cargo#15404) - chore: Bump cargo-util-schemas to 0.8.2 (rust-lang/cargo#15403) r? ghost
Resolves #15401
Here is an example of the feature in kitty
0.40.1with the following config set in~/.config/kitty/kitty.confTested on
uname -a:Terminals tested with:
kitty
0.40.1ghostty

1.1.4-6f1b22a-nixalacritty

0.15.1VScode's version
1.98integrated terminal aka. xterm.jsThe following
cargoinvocations will have their output be modified by this change:In addition I have done a slight refactor to have the printed indent of targets and packages be the same by using a shared constant named
const ITEM_INDENT: &str = " ";This is my first PR to the cargo codebase, so I am not familiar with what is expected in terms of test for a feature such as this.