feat(editor): 编辑器未提交变更提示(行号着色 + 左侧色条 + hover blame)(#212)

code 视图(可编辑 CodeMirror)显示未提交变更的行级提示,一个布尔设置
editorGitGutter(默认开)总开关:

- 行号槽着色 + 行号左侧 2px 细色条(新增/修改/删除),取色复用文件树
  既有 tone 口径(--dsw-alias-state-*);
- hover 某行时按需取该行 blame,纯文本 tooltip(作者 · 时间 + 摘要),
  按 sessionId+path+line 记忆化,不预取整文件、滚动不重复请求;
- 行映射复用既有 useGitStatus 共享 store 与既有统一 diff 引擎
  (parseUnifiedDiff/unifiedSegments),不新增第二个 git status 轮询器;
  未跟踪文件按状态 store 整篇标新增;
- 新增宿主路由 git.diff-head(git diff HEAD,部分暂存时给出已暂存+未暂存
  的整份未提交变更,未出生 HEAD 回退 --cached)与 git.blame
  (git blame --porcelain -L,四条失败路径一律返回空,不抛);
- 只给 viewerId === 'code' 挂 decoration/gutter/tooltip,markdown/html 与
  关闭设置后不安装任何扩展;开关经 Compartment 原地重配。

不做行尾常驻作者 widget、不做徽章、不做动画、不做渐变、不做四个独立开关。
This commit is contained in:
Menghuan1918 committed 2026-10-05 22:25:51 +08:00
1 parent 39e7b587d8
commit 2c8d11a8fc
37 files changed
+1376 -5

No files matched your search

+48
View File
@@ -1522,6 +1522,54 @@ body[data-dsh-sidebar-dragging] .bottomPanel {
cursor: pointer;
}
/* ── Uncommitted-change gutter (issue #212) ─────────────────────────────────
VS Code's restraint: the line NUMBER takes the tone of its change, and a
2px bar sits at the far left of the numbers. The classes are handed to
CodeMirror as gutter-marker class names (see editor-git-gutter.ts), which
is why they are referenced from TS as well as styled here. The tones are
the file tree's own mapping (added/untracked green, modified amber,
deleted red). Deliberately nothing else: no end-of-line widget, no badge,
no animation, no gradient. */
.editorGitAdd { color: var(--dsw-alias-state-success-primary); }
.editorGitMod { color: var(--dsw-alias-state-warn-primary); }
.editorGitDel { color: var(--dsw-alias-state-error-primary); }
/* The bar column: 2px of ink, plus the hidden spacer that keeps the width
reserved while the file is clean (the numbers never shift sideways). */
.editorGitBarGutter {
width: 2px;
min-width: 2px;
}
.editorGitBar,
.editorGitBarSpacer {
width: 2px;
height: 100%;
}
.editorGitBarAdd { background: var(--dsw-alias-state-success-primary); }
.editorGitBarMod { background: var(--dsw-alias-state-warn-primary); }
.editorGitBarDel { background: var(--dsw-alias-state-error-primary); }
/* Hover blame: plain text, two rows (author · when, then the summary). */
.editorBlame {
max-width: 420px;
padding: 4px 8px;
font: var(--dsw-font-xxxs-11);
color: var(--dsw-alias-label-primary);
}
.editorBlameHead {
color: var(--dsw-alias-label-secondary);
}
.editorBlameSummary {
margin-top: 2px;
color: var(--dsw-alias-label-primary);
white-space: pre-wrap;
overflow-wrap: anywhere;
}
/* Live sandbox status row (HTML preview / browser tab): GREEN while the
sandbox is on (with the one-tap temporary unlock), RED while it is off
(global setting or temporary unlock) — the red state is the persistent