microsoft / microsoft/TypeScript

Add support for OSC8 hyperlinks in TTY output

未关闭
#63,082 2 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Awaiting More Feedback Suggestion
主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

### 🔍 Search Terms

"OSC8", "hyperlinks", "terminal emulator", "tty", "build output"

### ✅ Viability Checklist

- [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
- [x] This wouldn't change the runtime behavior of existing JavaScript code
- [x] This could be implemented without emitting different JS based on the types of the expressions
- [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- [x] This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- [x] This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals

### ⭐ Suggestion

Wrap file paths from build output with [OSC8 hyperlink](https://github.com/Alhadis/OSC8-Adoption) markers.

### 📃 Motivating Example

When the build output contains errors, it is convenient to be able to CMD+click on files path to directly see the error in the editor.

Most modern terminal emulators (iTerm, Ghostty, tmux, etc.) support CMD+clicking on file names in order to open them in the default app. These terminals use two different approaches to enable this; OSC8 hyperlinks and RegExp. The issue with the Regexp based approach is that their behavior is inconsistent across terminal implementations, making them unreliable. OSC8 hyperlinks, on the other hand, are unambiguous and reliable.

### 💻 Use Cases

1. What do you want to use this for?
When building a TS project, a change in a dependency might cause issues in dependent code, causing `tsc build` to return errors.

2. What shortcomings exist with current approaches?
Currently, I can sometimes CMD+click the filename, but this often fails (because the terminal does not properly infer the actual file location using the RegExp based method)

3. What workarounds are you using in the meantime?
Manually copy the file path in the terminal output + Manually open IDE + Manually open file

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

该 issue 将 build 输出和 TTY 输出列为范围,但没有提供文件或测试。首先跟踪 tsc build 在哪里格式化文件路径和终端诊断信息;完成的标准是用 OSC8 标记包裹文件路径,同时不改变现有的 JavaScript 行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
cli, developer-experience
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。