clang: make file paths with spaces clickable via OSC 8 hyperlinks#4368
clang: make file paths with spaces clickable via OSC 8 hyperlinks#4368
Conversation
Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/8c564ecc-76c5-4d70-b9ee-782c76d0a8ec Co-authored-by: riverar <475132+riverar@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/9e64041f-8c56-4de0-b063-121b06a41c87 Co-authored-by: riverar <475132+riverar@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/601b8102-d750-474e-9b0f-06f7213ffc08 Co-authored-by: riverar <475132+riverar@users.noreply.github.com>
|
Hold up, something squirrely I need to check. |
|
The following code, regardless of terminal: Results in output with a non-hyperlinked path: I'm not interested in resolving the error--that's known and expected. |
The Removing the Happy to either revert the feature entirely, or remove the guard and accept the test update — whichever direction you'd prefer. |
|
Closing for now, need to noodle on this further. |
Error messages referencing paths like
C:\Program Files (x86)\Windows Kits\...are not clickable in terminals because spaces break link detection. OSC 8 hyperlinks solve this by embedding the URI separately from the display text.error.rshyperlink_path(): wraps the raw file path with OSC 8 escape sequences only whenstderris an interactive TTY (std::io::IsTerminal); falls back to plain text for piped/redirected output. The raw file path is used directly as the OSC 8 URI — nofile://conversion is needed.Error::fmt: callshyperlink_path()when emitting the file path portion of error messagesNote: The TTY guard means hyperlinks are only emitted when the process's
stderris directly connected to an interactive console. In build-script andcargo testcontexts, cargo pipesstderr, sois_terminal()returnsfalseand plain paths are produced — which is the correct behaviour for those environments.Error output in a supporting terminal (e.g. Windows Terminal, VS Code, iTerm2) when running a binary directly: