Skip to content

Conversation

@MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Nov 19, 2025

Summary

GitHub action's renderer doesn't support hyperlink rendering and, unlike the terminals I tested,
it also isn't just ignoring the hyperlink escape sequence, instead it removes/hides the entire content between the Hyperlink escape sequence.

This PR uses supports-hyperlinks to only render hyperlinks
on terminals that are known to support the escape sequence.

The crate is used by cargo and miette.

Test Plan

Is mypy primer timing out proof enough that ty no longer renders the hyperlink ANSI escapes in CI 😅?

I tested that the hyperlinks are clickable in Ghostty

@MichaReiser MichaReiser added the cli Related to the command-line interface label Nov 19, 2025
@astral-sh-bot
Copy link

astral-sh-bot bot commented Nov 19, 2025

Diagnostic diff on typing conformance tests

No changes detected when running ty on typing conformance tests ✅

4 |
note: This is an unsafe fix and may change runtime behavior
");
insta::assert_snapshot!(env.render_diagnostics(&diagnostics));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made those tests "normal" snapshot tests because some snapshot lines contain trailing whitespace that Zed strips (might be a bug in Zed as I don't think an editor should strip trailing whitespace in a string!).

I spent some time yesterday trying to fix the trailing whitespace but without success.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I support this. My editor (nvim) is configured to do the same.

@AlexWaygood AlexWaygood changed the title Only reneder hyperlinks for terminals known to support them Only render hyperlinks for terminals known to support them Nov 19, 2025
@astral-sh-bot
Copy link

astral-sh-bot bot commented Nov 19, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Copy link
Contributor

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That library looks reasonable. And I don't mind if this buys us a few "false negatives".

@MichaReiser MichaReiser merged commit ffce0de into main Nov 19, 2025
40 of 41 checks passed
@MichaReiser MichaReiser deleted the micha/supports-hyperlinks branch November 19, 2025 09:02
Copy link
Member

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

4 |
note: This is an unsafe fix and may change runtime behavior
");
insta::assert_snapshot!(env.render_diagnostics(&diagnostics));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I support this. My editor (nvim) is configured to do the same.

dcreager added a commit that referenced this pull request Nov 19, 2025
* origin/main:
  [ty] Fix flaky tests on macos (#21524)
  [ty] Add tests for generic implicit type aliases (#21522)
  [ty] Semantic tokens: consistently add the `DEFINITION` modifier (#21521)
  Only render hyperlinks for terminals known to support them (#21519)
  [ty] Keep colorizing `mypy_primer` output (#21515)
  [ty] Exit with `2` if there's any IO error (#21508)
  [`ruff`] Fix false positive for complex conversion specifiers in `logging-eager-conversion` (`RUF065`) (#21464)
  [ty] tighten up handling of subscripts in type expressions (#21503)
dcreager added a commit that referenced this pull request Nov 19, 2025
* origin/main:
  [ty] Fix flaky tests on macos (#21524)
  [ty] Add tests for generic implicit type aliases (#21522)
  [ty] Semantic tokens: consistently add the `DEFINITION` modifier (#21521)
  Only render hyperlinks for terminals known to support them (#21519)
  [ty] Keep colorizing `mypy_primer` output (#21515)
  [ty] Exit with `2` if there's any IO error (#21508)
  [`ruff`] Fix false positive for complex conversion specifiers in `logging-eager-conversion` (`RUF065`) (#21464)
  [ty] tighten up handling of subscripts in type expressions (#21503)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Related to the command-line interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants