🐛 fix(vscode): 改动 tab 默认统一视图并保留阅读位置

This commit is contained in:
cruldra committed 2026-07-25 11:08:48 +08:00
1 parent 84a5cda8d2
commit d68603ee06
9 files changed
+213 -20

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
/**
* 「改动」tab 的 diff 模式(统一 / 分栏)解析。
* 纯逻辑:不碰 VS Code API,便于单测。
*/
export const DEFAULT_PR_DIFF_MODE = 'unified' as const
export type PrDiffMode = 'unified' | 'split'
export function isPrDiffMode(x: unknown): x is PrDiffMode {
return x === 'unified' || x === 'split'
}
/**
* workspaceState 读出值 → 合法模式。
* 仅精确字符串 `'split'` 才是分栏;其它一律统一(默认路径)。
*/
export function parsePrDiffMode(stored: unknown): PrDiffMode {
return stored === 'split' ? 'split' : DEFAULT_PR_DIFF_MODE
}