[Feature] 编辑器支持 Annotate with Git Blame:行号旁显示修改日期 / 修改人,点击跳转到对应提交

Đang mở
#2,677 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
git, typescript

Hướng nghiên cứu

Start by inspecting the editor’s line number context menu and the existing “使用 Git Blame 注释” implementation, then trace how Git History opens commit details. The issue describes the desired gutter annotations, hover details, click behavior, and context menu actions, but does not name files or tests. Done means blame annotations can be toggled per file, show date and author, expose commit details and navigation, and avoid full-file blame on every edit.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement issue-form:feature review: low
Problem to solve / 要解决的问题

当前 Lithe 已有“使用 Git Blame 注释”,但它打开的是一个弹框:

  • 弹框里的 Blame 历史无法点击,无法定位 / 跳转到对应的 Git 提交历史,也看不到该提交的改动内容;
  • 看完弹框要关掉再去 Git History 面板里手动找提交,流程是断的,排查“这行是谁、什么时候、为什么改的”很不方便。
Proposed solution / 建议方案

参考 IntelliJ IDEA 的 Annotate with Git Blame 实现:

  1. 入口:在编辑器行号区域右键菜单中增加 Annotate with Git Blame(与 IDEA 同名,便于 IDEA 用户找到),可开关,再次点击 / 选择 Close Annotations 关闭。
  2. 展示位置:开启后,在行号右侧、代码左侧增加一列注释(annotation gutter),按提交分块显示,每行 / 每块只显示两项,和 IDEA 一致,不需要短 hash:
    • 修改日期(如 2026/6/23)
    • 修改人
    • 未提交的行明确标注 Uncommitted changes
  3. Hover 即看提交历史:鼠标移到某一行注释上,弹出该行的提交信息(commit、Author、Date、提交说明),不用点开、不用跳转就能先看一眼。
  4. 可点击跳转:点击某一行的注释,直接跳转到对应的 Git 提交历史 / 提交详情(提交信息、改动文件、diff),而不是只能看列表。
  5. 配套操作(参考 IDEA):
    • 右键注释:Show History / 显示行历史、Show Diff、Copy Revision Number
  6. 性能:只对当前文件 / 可见范围做 blame,避免每次输入都全量重新 blame(之前 #343、#187 有过类似回归)。

现有弹框形式的“使用 Git Blame 注释”可保留作为补充,但不应是唯一的 Blame 查看方式;行内 Blame(inline blame)也不应替代 gutter 注释,两者可共存。

Target platform / 目标平台

macOS

Area / 模块

Editor / 编辑器

Priority / 优先级

P2 / 后续考虑:目前不着急,可安排到后续版本

Alternatives considered / 已考虑的替代方案
  • 继续用弹框 + 手动去 Git History 里找提交:能用,但每次都要多步查找,且无法从行直接定位提交。
  • 用“显示行历史”:只能看单行历史,无法像 Annotate 一样一眼扫过整个文件的修改分布。
Additional context / 补充信息

Lithe 版本:0.8.26
操作系统与架构:macOS Version 27.2.1 (Build 26B131) · arm64
环境信息:build: b963c8a · 2026-12-03;runtime: go1.27.4

  • 参考:IntelliJ IDEA 右键行号菜单中的 Annotate with Git Blame(见截图 1),开启后注释列直接显示在行号旁。
  • 现状:Lithe 行号右键菜单中的“使用 Git Blame 注释”(见截图 2)目前是弹框展示,弹框内历史不可点击、不可定位提交。
  • 相关已关闭 Issue:#451、#1128 当时提的正是这个需求,现实现为弹框,未达到 IDEA 式 gutter 注释 + 点击跳转的效果,故新开此 Issue 作为后续跟进。

截图说明:

  1. IDEA 的 Annotate with Git Blame 菜单
  2. Lithe 现有行号右键菜单,“使用 Git Blame 注释”
  3. IDEA 注释列只显示日期 + 修改人,hover 弹出对应提交的 commit / Author / Date / 提交说明
image-8e675ea9 image-fef2d5c2 image-4b2922c0
Checklist / 提交前检查
  • I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
Ngôn ngữ chính
TypeScript
Star
1.8k
Fork
151
Merge trung bình
3 giờ 13 phút
Pull request đã merge (30 ngày)
614

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của 1lck/Lithe-IDEA

Tất cả issue của 1lck/Lithe-IDEA

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.