Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to build profile - how useful is it? #14481

Closed
mustakimali opened this issue Sep 1, 2024 · 3 comments
Closed

Link to build profile - how useful is it? #14481

mustakimali opened this issue Sep 1, 2024 · 3 comments
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@mustakimali
Copy link

mustakimali commented Sep 1, 2024

Problem

Cargo links the current profile when compilation or cargo check is done.
When clicking on the text underlined - this takes me to the (profile page)[https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles].

image

This is a hardcoded link configured here.

But more often than not, I accidentally click on this link when I mean to focus the terminal in vscode. So I'm wondering if this is really adding much value?

I'm happy to raise PR to remove them if it deems it acceptable. However, I don't want to remove something if it's helpful for most people, for reasons I don't know.

Steps

  • Run cargo build/check

Possible Solution(s)

  • Remove this hyperlink
  • Or reword it so it's clear this is a hyperlink eg.
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.45s
    View details: https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles

Notes

You can go to the same page by googling "rust build profile", this is the first search result.I often accidentally click on this link when I mean to focus the terminal in vs code. So, I'm wondering if this is really adding much value.

Also the idea of terminal hyperlink using escape character could be confusing and in other places (eg. cargo clippy output) we tend to output the entire link that markes it obvious and leave it up to the terminal to make them clickable or not.

Version

cargo 1.80.1 (376290515 2024-07-16)
@mustakimali mustakimali added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Sep 1, 2024
@epage epage added the A-console-output Area: Terminal output, colors, progress bar, etc. label Sep 3, 2024
@epage
Copy link
Contributor

epage commented Sep 3, 2024

I know this came up somewhere else but I'm not finding the discussion.

But more often than not, I accidentally click on this link when I mean to focus the terminal in vscode. So I'm wondering if this is really adding much value?

This link was added as an effort to help teach people about profiles, particularly that users may want a --release profile, see https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/cargo.20build.20default.20profile

Note that the profile is not the only link today but also the --timings output file and rustdoc output, see #12889. Also, cargo and rustc are both looking at using links more extensively.

The problem statement of "click to focus" causing a link to be clicked is therefore wider than just profile and is more about the overall strategy of using links at all.
Whether links are a help or a hindrance is likely workflow specific We do offer term.hyperlinks to control it.

This leaves the questions of

  • Are links worth it?
  • Should linking be the default?

I think the answer is "yes" to both". One use case for linking is to help connect the dots between the output and the relevant documentation that could help unblock users. This case is therefore more focused on new to intermediate users who are less likely to opt-in to a config.

@mustakimali
Copy link
Author

Links are definitely worth it (and I appreciate the effort to link docs where useful), but rendering them as clickable links does not feel like ergonomic for cli apps because it depends on tty and terminal used (eg. just noticed the links aren't rendered in zsh within tmux - but works without tmux).

Imho it would be useful if we just printed out the entire URL and let the terminal decide how to render them.

The configuration term.hyperlinks is useful - I wasn't aware of this. Thank you.

For anyone just looking for a solution, turn off hyperlink:

export CARGO_TERM_HYPERLINKS=false

@epage
Copy link
Contributor

epage commented Sep 3, 2024

Imho it would be useful if we just printed out the entire URL and let the terminal decide how to render them.

That would be quite verbose if we did that for every potential link. Think of our use or linked text like tooltips: it should be non-essential but helpful if you need some clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants