Tapd Opener
在 VS Code 中通过 Cmd + 点击 story/bug 的 ID,自动用浏览器打开对应 TAPD 单。
功能
- 识别
git-commit 文档与 plaintext 文本中的 story/bug ID,并生成可点击链接
- 支持 tapd commit message 标准格式
--story=128488163 & --bug=149561048
- 兼容如下格式
story id: 123456 & 需求: 123456 & SID 123456 & bug id: 234567 & 缺陷: 234567 & BID 234567
- 识别集成终端中的
git log 输出,支持点击打开
- 识别
git log 输出中的分支名((HEAD -> develop, origin/develop)),Cmd + 单击打开对应仓库分支页面
- GitHub 仓库默认支持;其他仓库通过
tapd.branchUrlRules 配置
- 提供命令
Tapd: 打开当前分支远程 URL(快捷键 Cmd+Shift+B / Ctrl+Shift+B),直接打开当前分支对应的远程页面
- 这是不依赖 terminal link 的独立入口,不与 GitLens 的 terminal link 抢占
- 默认使用
http://tapd.woa.com/r/t?id={id}&type=story|bug,可配置模板
- 首次激活自动信任
tapd.woa.com,免外链确认提示(可关闭)
关于与 GitLens 的冲突
VSCode 的 TerminalLinkProvider 多个扩展重叠时,先注册者优先被 click 触发。GitLens 在 zsh prompt 中的 git:(branch) 字符上注册了 link,行为是「在 GitLens commits 视图打开此分支」。这个 link 范围与我们识别到的分支名完全重叠,因此 prompt 行的 click 总是 GitLens 抢走,无法被本插件覆盖(VSCode 没有 link priority 机制)。
可行的取舍:
- 保留 GitLens + 用本插件的命令(默认推荐):prompt 行点击走 GitLens(打开本地 commits 视图);想直接打开远程 URL 用
Cmd+Shift+B
- 完全由本插件接管:在 GitLens 设置里把
gitlens.terminal.Terminal Links 关闭
配置项
tapd.storyUrlTemplate(字符串,默认 http://tapd.woa.com/r/t?id={id}&type=story)
tapd.bugUrlTemplate(字符串,默认 http://tapd.woa.com/r/t?id={id}&type=bug)
tapd.autoTrustDomain(布尔,默认 true):自动把 tapd.woa.com 加入 workbench.trustedDomains
tapd.branchUrlRules(数组,默认 []):自定义分支 URL 规则。GitHub 与 git.woa.com 已默认支持,其他 git 平台在此追加。示例:
"tapd.branchUrlRules": [
{
"match": "^git@your\\.git\\.host[:/](https://github.com/luwuer/tapd-opener/blob/HEAD/[^/]+)/([^/]+?)\\.git$",
"urlTemplate": "https://your.git.host/{owner}/{repo}/commits/{branch}"
}
]
match:匹配 git remote -v 输出中 origin URL 的正则字符串,括号用于捕获 owner / repo
urlTemplate:分支 URL 模板,支持 {owner} {repo} {branch} 三个占位符
| |