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

Teach rustc to use OSC8 on nightly / Embedded links in terminal output #587

Closed
1 of 3 tasks
estebank opened this issue Feb 9, 2023 · 6 comments
Closed
1 of 3 tasks
Labels
major-change A proposal to make a major change to rustc major-change-accepted A major change proposal that was accepted T-compiler Add this label so rfcbot knows to poll the compiler team

Comments

@estebank
Copy link

estebank commented Feb 9, 2023

Proposal

Add a nightly flag -Zterminal-urls=y|on|yes|n|off|no|auto that configures enabling embedded links in terminal output. Start using this configuration only in nightly, defaulted to off. The specifics of auto will be determined through experimentation.

This will allow us to customize the printed output with hyperlinks to relevant documentation, or to local files (by using file://, but leveraging that can be fraught for people using ssh).

An example of what this would look like in practice can be seen in this video:

Screen.Recording.2023-02-08.at.11.44.15.AM.mov

rust-lang/rust#107838 shows what the code changes required would be.

Mentors or Reviewers

If you have a reviewer or mentor in mind for this work, mention then
here. You can put your own name here if you are planning to mentor the
work.

Process

The main points of the Major Change Process are as follows:

  • File an issue describing the proposal.
  • A compiler team member or contributor who is knowledgeable in the area can second by writing @rustbot second.
    • Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a -C flag, then full team check-off is required.
    • Compiler team members can initiate a check-off via @rfcbot fcp merge on either the MCP or the PR.
  • Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.

You can read more about Major Change Proposals on forge.

Comments

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

@estebank estebank added T-compiler Add this label so rfcbot knows to poll the compiler team major-change A proposal to make a major change to rustc labels Feb 9, 2023
@rustbot
Copy link
Collaborator

rustbot commented Feb 9, 2023

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

cc @rust-lang/compiler @rust-lang/compiler-contributors

@rustbot rustbot added the to-announce Announce this issue on triage meeting label Feb 9, 2023
@estebank estebank changed the title Teach rustc to use OSC8 / Embedded links in terminal output Teach rustc to use OSC8 on nightly / Embedded links in terminal output Feb 9, 2023
@tmiasko
Copy link

tmiasko commented Feb 9, 2023

@rustbot second

@rustbot rustbot added the final-comment-period The FCP has started, most (if not all) team members are in agreement label Feb 9, 2023
@apiraino apiraino added to-announce Announce this issue on triage meeting and removed to-announce Announce this issue on triage meeting labels Feb 15, 2023
@apiraino
Copy link
Contributor

@rustbot label -final-comment-period +major-change-accepted

@rustbot rustbot added major-change-accepted A major change proposal that was accepted to-announce Announce this issue on triage meeting and removed final-comment-period The FCP has started, most (if not all) team members are in agreement labels Feb 22, 2023
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Feb 24, 2023
@epage
Copy link

epage commented Dec 11, 2023

Is there a tracking issue for discussing this?

Cargo is stabilizing link support in 1.75 (see rust-lang/cargo#12889)

  • We offer term.hyperlinks to control it
  • We are auto-detecting with supports-hyperlinks
    • Unsure how we feel about the FORCE_HYPERLINK env variable; we aren't documenting it
    • We do have an extra check beyond that because a file path link wasn't correctly working on iTerm2
    • To drop is-terminal dep, I'm tempted to just copy/paste the code

It'd be good for cargo and rustc to coordinate on when links are shown (so one doesn't auto-detect when the other doesn't) and other behavior.

@estebank
Copy link
Author

  1. we should absolutely unify the behavior across rustc and cargo.
  2. Be aware that "just" checking if the terminal supports hyperlinks is insufficient: if using a terminal sshing into a remote development machine, the links will either use the full ssh format (username@host:/path/to/file) or to a "fake" local path (/path/to/file/that/doesn't/exist/locally), breaking the currently working auto-linking that the VSCode terminal has. Are you certain that this is already correctly handled on the cargo side?

@epage
Copy link

epage commented Dec 11, 2023

For file: links, we include the hostname according to this gist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major-change A proposal to make a major change to rustc major-change-accepted A major change proposal that was accepted T-compiler Add this label so rfcbot knows to poll the compiler team
Projects
None yet
Development

No branches or pull requests

5 participants