From d6d242004a779ffff961c35b087282f4eb3cc25e Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Mon, 16 Nov 2026 16:32:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(desktop):=20Git=20=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=8F=B0=E6=8C=89=E7=B1=BB=E5=88=AB=E7=9C=81=E7=95=A5=E5=86=85?= =?UTF-8?q?=E9=83=A8=E6=9F=A5=E8=AF=A2=E5=B9=B6=E8=B0=83=E6=95=B4=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=96=B9=E5=BC=8F=EF=BC=8C=E5=88=9D=E5=A7=8B=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=8E=20IntelliJ=20IDEA=20=E4=B8=80=E8=87=B4=20(#2?= =?UTF-8?q?025)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 设置 → 版本控制新增两张卡片,共 13 个开关,每个都带 ⓘ 说明: - “Git 控制台:省略的查询”(9 个,初始全部打开):后台分支读取、操作后的 自动重新加载、保存后的差异刷新、差异读取、日志浏览、日志路径筛选、注解与 行历史、列表与面板、操作前检查。省略的类别在 Core 记录前就丢弃,不占控制台 的 200 条记录。用户执行的命令、失败的 Git 请求、意外的退出码和未确认的命令 不受开关影响。 - “Git 控制台:显示”(4 个):查询只显示命令行(初始关)、省略“执行成功, 没有输出”提示(初始开)、完全隐藏临时 -c 配置(初始关)、省略仓库名(初始关)。 实现: - core:GitConsolePreferences 保存 13 个开关,零值就是 IDEA 的初始状态; ConsoleQueries 和 Display 换算成 Core 的 gitExecution.consoleQueries 与 git.consolePresentation 的 display;WithQueryCategory 为场景不同的同名请求 标注类别;删除 reportQueries。 - workbench:后台分支与引用读取、操作后的重新加载、保存后的差异刷新、日志路径 筛选分别标注 references、reload、diffRefresh、logPathFilter;控制台按显示 选项重新请求呈现,标题行按选项省略仓库名,复制全部内容仍保留完整命令和仓库名。 - 控制台工具栏的“隐藏读取命令”开关改为打开“设置 → 版本控制”的按钮。 - settingswindow:两张卡片接入设置保存,“恢复默认设置”回到 IDEA 的初始状态。 - i18n:新增 desktop.git.settings.console.* 词条,desktop.git.console.hideQueries 改为 desktop.git.console.settings。 - Core 固定到包含 consoleQueries、queryCategory 与 display 的提交。 - 功能矩阵 git-history 与 Agent Note 记录新的分类、记录前过滤和取舍。 --- ...09-12-git-execution-and-project-console.md | 26 ++- desktop/internal/core/client.go | 12 +- desktop/internal/core/gitconsole.go | 169 ++++++++++++-- desktop/internal/core/gitconsole_test.go | 92 ++++++-- desktop/internal/i18n/console_messages.go | 7 +- desktop/internal/i18n/shared.generated.go | 64 +++++- desktop/internal/settingswindow/controller.go | 12 + .../settingswindow/git_console_view.go | 86 +++++++ .../settingswindow/git_console_view_test.go | 60 +++++ .../settingswindow/version_control_view.go | 6 +- .../settingswindow/visual_capture_test.go | 6 +- .../internal/settingswindow/window_view.go | 2 + desktop/internal/workbench/app.go | 6 +- desktop/internal/workbench/branch.go | 2 +- desktop/internal/workbench/difftab.go | 12 +- desktop/internal/workbench/difftab_edit.go | 6 +- desktop/internal/workbench/gitconsole.go | 139 +++++++----- .../internal/workbench/gitconsole_settings.go | 30 +++ desktop/internal/workbench/gitconsole_test.go | 127 +++++++++-- desktop/internal/workbench/gitconsole_view.go | 4 +- desktop/internal/workbench/gitlog.go | 4 +- desktop/internal/workbench/gitsync.go | 2 +- desktop/internal/workbench/nested_refs.go | 3 + desktop/internal/workbench/settings.go | 9 + scripts/desktop/build-desktop-core.sh | 10 +- shared/i18n/locales/en-US.json | 32 ++- shared/i18n/locales/zh-CN.json | 32 ++- shared/i18n/messages.json | 214 +++++++++++++++++- .../features/git-history.json | 14 +- 29 files changed, 1044 insertions(+), 144 deletions(-) create mode 100644 desktop/internal/settingswindow/git_console_view.go create mode 100644 desktop/internal/settingswindow/git_console_view_test.go create mode 100644 desktop/internal/workbench/gitconsole_settings.go diff --git a/.agents/notes/implemented/architecture/2026-09-12-git-execution-and-project-console.md b/.agents/notes/implemented/architecture/2026-09-12-git-execution-and-project-console.md index 625363468a..8afbcfd8da 100644 --- a/.agents/notes/implemented/architecture/2026-09-12-git-execution-and-project-console.md +++ b/.agents/notes/implemented/architecture/2026-09-12-git-execution-and-project-console.md @@ -2,11 +2,11 @@ 状态:已实现 -> Viva 迁移状态:Viva 已提供 Core 请求事件桥(`desktop/internal/core/events_bridge.go`),但 Git 操作还没有接入事件消费与项目控制台;不能据此宣称命令输出、认证交互或平台验收已经迁移。 +> Viva 迁移状态:Viva 的 Git 工具窗口已有“控制台”页,命令、输出、退出码和查询开关都接入了 Core 事件(`desktop/internal/core/gitconsole.go`、`desktop/internal/workbench/gitconsole.go`);认证交互和双平台原生验收仍未完成,不能据此宣称已经迁移。 ## 先说结论 -用户从更改、分支、工作树或远程入口执行 Git 时,项目控制台保留实际命令、完整工作目录和连续输出。记录由 Core 的共享执行入口产生,界面只负责展示;内部查询保持静默,启动前失败保留原因,不能伪造已经执行的命令。参数策略、事件解码和展示规则在 Core,原生进程与认证生命周期由平台适配器负责。 +用户从更改、分支、工作树或远程入口执行 Git 时,项目控制台保留实际命令、完整工作目录和连续输出。记录由 Core 的共享执行入口产生,界面只负责展示;内部查询默认不记录(与 IntelliJ IDEA 一致),用户可以在设置里按类别打开,启动前失败保留原因,不能伪造已经执行的命令。参数策略、事件解码和展示规则在 Core,原生进程与认证生命周期由平台适配器负责。 ## 问题 @@ -76,6 +76,18 @@ Core 的引用读取保留正常 Git 查询结果;对缺失的上游元数据 按稳定标识保留手动展开状态,丢弃过期展示回复。复制使用完整保留内容;真正因内存上限丢弃的内容标为截断,不能假装可以展开恢复。控制台历史只存在于有界内存,不定义磁盘保存和长期保留策略。字段和容量的正式契约见 Core 仓库的 `rust/contracts/rust-core-api.md`。 +### 记录哪些查询由用户设置决定,在记录前过滤 + +内部查询指 Lithe 为了显示状态、日志、差异等自己发起的读命令。它们默认不进控制台,和 IntelliJ IDEA 一致;用户排查问题时,可以在“设置 → 版本控制”的“Git 控制台:省略的查询”里按类别关掉省略。九个类别是:后台分支读取、操作后的自动重新加载、保存后的差异刷新、差异读取、日志浏览、日志路径筛选、注解与行历史、列表与面板、操作前检查。开关写成“省略……”,初始全部打开。 + +过滤发生在 Core 记录之前。桌面端把要记录的类别放进 `gitExecution.consoleQueries` 交给 Core,没选的类别 Core 直接不记,因此不占控制台保留的 200 条记录。类别默认由 Core 按命令判断,例如 `git.diff` 归差异读取,`git.history*` 归日志浏览,没有归入其他类的 `git.*` 查询归操作前检查。同一条命令在不同场景下需要不同开关时,宿主才在请求上用 `queryCategory` 显式标注;目前标注的是后台分支读取、操作后重新加载、保存后差异刷新和日志路径筛选。后台请求没有标注就永远不记,所以随仓库变化自动刷新的状态、行号区标记、行尾 Blame 不会把控制台刷满。 + +用户执行的命令、失败的 Git 请求、意外的退出码和未确认的命令不受这些开关影响,始终记录。 + +“Git 控制台:显示”里的四个开关(查询只显示命令行、省略无输出提示、完全隐藏临时 `-c` 配置、省略仓库名)只改变已记录内容的画法。它们作为 `git.consolePresentation` 的 `display` 参数在 Core 里生效;切换后,控制台用新参数重新请求展示,旧参数下的展示结果不再使用。复制全部内容仍用完整原文,带仓库名和临时配置。 + +正确做法:新增一种需要单独开关的读取,而它和已有命令同名时,在调用处用 `core.WithQueryCategory` 标注类别,并在 Core 的类别表登记。不要这样做:桌面端拿到记录后再按命令名隐藏,被藏起来的查询仍占 200 条名额,会把用户真正执行的命令挤出去。 + ## 考虑过的备选方案 - 由每个功能界面记录计划命令:实现直接,但会重复或漏记其他入口,而且无法区分启动前失败,因此记录放在执行边界。 @@ -85,24 +97,28 @@ Core 的引用读取保留正常 Git 查询结果;对缺失的上游元数据 - 为远程另建更细粒度的并发队列:Lithe 已有共享仓库与工作树写入许可,本次保留既有互斥边界,不在执行层改写并发策略。 - 把控制台做成持久历史库:需要另外定义存储、清理和隐私契约,本能力只保留内存诊断历史。 - 所有 mutation 后的读取都使用独立清理期限:会截短正常请求的剩余预算并屏蔽其取消,因此只为已经结束的请求使用。 +- 只在显示时隐藏查询(原控制台工具栏的“隐藏读取命令”开关):实现简单,但被隐藏的查询照样占用 200 条记录,频繁的后台读取会挤掉用户执行的命令,因此改为记录前过滤,工具栏开关换成打开版本控制设置的按钮。 +- 每条命令一个开关:最精细,但 Core 的 `git.*` 查询有上百个,用户无法判断该关哪个,因此按用户能感知的九个场景分类。 +- 由桌面端逐条决定是否记录:归类规则会留在平台层,将来换界面实现时要重写,因此归类在 Core,平台只为场景不同的请求标注类别。 ## 后果 -用户可以跨功能和工作树查到真实执行过程,取消、认证和部分失败也有一致的归属。代价是必须维护请求与子进程两层生命周期,并同时验证 Core 与平台展示。共享展示减少两端规则偏差,但异步回复仍要求界面正确配对快照并丢弃过期结果。内存上限保证长时间使用可控,也意味着控制台不能承担完整审计存档。 +用户可以跨功能和工作树查到真实执行过程,取消、认证和部分失败也有一致的归属。代价是必须维护请求与子进程两层生命周期,并同时验证 Core 与平台展示。共享展示减少两端规则偏差,但异步回复仍要求界面正确配对快照并丢弃过期结果。内存上限保证长时间使用可控,也意味着控制台不能承担完整审计存档。查询在记录前过滤,打开开关之前发生的查询找不回来;用户要先打开对应开关再重现问题。 ## 验证 - 共享 fixture 覆盖命令、事件、生命周期、Fetch、远程查询和完整展示结果;Core 的真实 Git 测试对照标签 refspec、无效布尔值与实际 Fetch。 - 认证和重试回归需要包含:本机 HTTP 认证测试服务器直接绑定数字回环地址,不做反向 DNS 查询;认证、重试与取消场景保留 15 秒预算。 -- Viva 侧验证:`scripts/desktop/desktop-go.sh test ./internal/core/...` 覆盖事件桥;控制台接入后需补充对应的 `./internal/workbench/...` 测试。 +- Viva 侧验证:`scripts/desktop/desktop-go.sh test ./internal/core/...` 覆盖事件桥;`scripts/desktop/desktop-go.sh test ./internal/core ./internal/workbench -run 'TestGitConsole|TestConsole' -count=1` 覆盖查询类别的记录、偏好到类别与显示参数的映射,以及显示开关切换后的重绘。 - 进程清理和管道排空必须在真实 Windows 与 macOS 产品中验收;静态检查不能替代运行时清理证据。 - `./scripts/agent-notes/verify-agent-notes.sh` ## 适用范围 -- Core 仓库的 [`rust/crates/git-host/`](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/rust/crates/git-host) 与 [Git 相关模块](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/rust/crates/git-host) +- Core 仓库的 [`rust/crates/git-host/`](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/rust/crates/git-host) 与 [Git 相关模块](https://github.com/Lithe-IDEA/Lithe-core-rust/tree/main/rust/crates/git) - [Rust Core API 契约](https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/rust/contracts/rust-core-api.md) - `desktop/internal/core/client.go` - `desktop/internal/core/events_bridge.go` - `desktop/internal/core/gitconsole.go` +- `desktop/internal/settingswindow/git_console_view.go` - `desktop/internal/workbench/` diff --git a/desktop/internal/core/client.go b/desktop/internal/core/client.go index af1a5895d8..941d4caac0 100644 --- a/desktop/internal/core/client.go +++ b/desktop/internal/core/client.go @@ -39,11 +39,15 @@ type requestEnvelope struct { // gitExecution is the part of a request's Git policy the client sets (GitExecutionOptions in // the Rust protocol); fields left empty keep Core's defaults. type gitExecution struct { - // ReportQueries asks Core to report the request's internal read-only queries to the - // console, as it reports the commands the user started. - ReportQueries bool `json:"reportQueries,omitempty"` + // ConsoleQueries are the query categories (GitQueryReferences and the rest) whose internal + // read-only queries Core reports to the console, as it reports the commands the user + // started. Empty reports none, as IntelliJ IDEA's console does. + ConsoleQueries []string `json:"consoleQueries,omitempty"` + // QueryCategory names what the request reads when its command alone does not tell, such + // as a reload after an operation; empty leaves it to the command. + QueryCategory string `json:"queryCategory,omitempty"` // Source is the request's provenance: "background" for an automatic refresh, whose - // queries Core keeps silent; empty for unknown. + // queries Core keeps silent unless QueryCategory names them; empty for unknown. Source string `json:"source,omitempty"` } diff --git a/desktop/internal/core/gitconsole.go b/desktop/internal/core/gitconsole.go index 0c4cb98328..59615a2167 100644 --- a/desktop/internal/core/gitconsole.go +++ b/desktop/internal/core/gitconsole.go @@ -16,9 +16,10 @@ import ( // the console stores them in the bounded journal the contract describes, and Core's // git.consolePresentation turns the stored records into what the console draws. Core has // already redacted every text it reports, so nothing here redacts again, and Core decides -// which commands are visible: an internal read-only query reports a started command only for -// a request that asks for queries (gitExecutionOf), and Core marks it as a query, whose output -// git.consolePresentation folds. +// which commands are visible: an internal read-only query reports a started command only when +// its category is one the console's preferences show (gitExecutionOf), and Core marks it as a +// query, whose output git.consolePresentation folds. A query the console does not show is never +// reported, so it takes none of the journal's budget. // // The lengths of the retention budget are counted in bytes of UTF-8, which is never fewer // than the characters the budget names, so the console keeps at most what it allows. @@ -37,6 +38,104 @@ const ( // GitConsoleSearchLimit is the longest search, in bytes, git.consolePresentation accepts. const GitConsoleSearchLimit = 1024 +// Query categories, as Core names them (QueryCategory in the Rust contract): what a request's +// internal read-only queries read. Core infers the category from the request command; a host +// names it with WithQueryCategory for the reads the command does not tell apart. +const ( + // GitQueryReferences are reference reads that follow a repository change without a user + // action, such as the branches of nested repositories. + GitQueryReferences = "references" + // GitQueryReload are the reads that reload views after an operation the user ran. + GitQueryReload = "reload" + // GitQueryDiffRefresh are diffs read again because a file they show was saved. + GitQueryDiffRefresh = "diffRefresh" + // GitQueryDiff are the file, commit, comparison and stash diffs the user opened. + GitQueryDiff = "diff" + // GitQueryLog are the history, references and commit details the log shows. + GitQueryLog = "log" + // GitQueryLogPathFilter are the per-commit file lists a log path filter reads. + GitQueryLogPathFilter = "logPathFilter" + // GitQueryAnnotate are annotation and line history. + GitQueryAnnotate = "annotate" + // GitQueryPanels are lists and panels: worktrees, stashes, remotes, pull requests and + // settings. + GitQueryPanels = "panels" + // GitQueryChecks are previews, preflights, plans and the queries of operations themselves. + GitQueryChecks = "checks" +) + +// GitConsolePreferences are the user's choices of what the Git console shows. The zero value +// is IntelliJ IDEA's console: it records no internal query and draws each record as IDEA does. +// The commands the user ran, failed requests and unexpected exit codes always show. +type GitConsolePreferences struct { + // The Show*Queries fields record the internal queries of one category. + ShowReferenceQueries bool `json:"showReferenceQueries,omitempty"` + ShowReloadQueries bool `json:"showReloadQueries,omitempty"` + ShowDiffRefreshQueries bool `json:"showDiffRefreshQueries,omitempty"` + ShowDiffQueries bool `json:"showDiffQueries,omitempty"` + ShowLogQueries bool `json:"showLogQueries,omitempty"` + ShowLogPathFilterQueries bool `json:"showLogPathFilterQueries,omitempty"` + ShowAnnotateQueries bool `json:"showAnnotateQueries,omitempty"` + ShowPanelQueries bool `json:"showPanelQueries,omitempty"` + ShowCheckQueries bool `json:"showCheckQueries,omitempty"` + // FoldSingleLineQueries folds a query's output even when it is a single line. + FoldSingleLineQueries bool `json:"foldSingleLineQueries,omitempty"` + // ShowCompletedWithoutOutput notes a command that finished without writing anything. + ShowCompletedWithoutOutput bool `json:"showCompletedWithoutOutput,omitempty"` + // HideTemporaryConfig omits Lithe's temporary -c configuration instead of folding it. + HideTemporaryConfig bool `json:"hideTemporaryConfig,omitempty"` + // HideRepository omits the repository each record ran in. + HideRepository bool `json:"hideRepository,omitempty"` +} + +// QueryCategories returns the query categories p records, in the order Core lists them. +func (p GitConsolePreferences) QueryCategories() []string { + var categories []string + for _, c := range []struct { + show bool + category string + }{ + {p.ShowReferenceQueries, GitQueryReferences}, + {p.ShowReloadQueries, GitQueryReload}, + {p.ShowDiffRefreshQueries, GitQueryDiffRefresh}, + {p.ShowDiffQueries, GitQueryDiff}, + {p.ShowLogQueries, GitQueryLog}, + {p.ShowLogPathFilterQueries, GitQueryLogPathFilter}, + {p.ShowAnnotateQueries, GitQueryAnnotate}, + {p.ShowPanelQueries, GitQueryPanels}, + {p.ShowCheckQueries, GitQueryChecks}, + } { + if c.show { + categories = append(categories, c.category) + } + } + return categories +} + +// Display returns the display options git.consolePresentation draws records with under p. +func (p GitConsolePreferences) Display() GitConsoleDisplay { + return GitConsoleDisplay{ + FoldSingleLineQueries: p.FoldSingleLineQueries, + ShowCompletedWithoutOutput: p.ShowCompletedWithoutOutput, + HideTemporaryConfig: p.HideTemporaryConfig, + HideRepository: p.HideRepository, + } +} + +// GitConsoleDisplay is how git.consolePresentation draws records (Display in the Rust +// contract). The zero value is IntelliJ IDEA's console. +type GitConsoleDisplay struct { + // FoldSingleLineQueries folds a successful query's output even when it is a single line. + FoldSingleLineQueries bool `json:"foldSingleLineQueries"` + // ShowCompletedWithoutOutput notes a command that finished without writing anything. + ShowCompletedWithoutOutput bool `json:"showCompletedWithoutOutput"` + // HideTemporaryConfig omits Lithe's temporary configuration; -c arguments the operation + // itself passed stay folded in place. + HideTemporaryConfig bool `json:"hideTemporaryConfig"` + // HideRepository leaves each entry's repository label empty and out of search. + HideRepository bool `json:"hideRepository"` +} + // gitConsoleRetention is the journal's budget, as requestStarted carries it. type gitConsoleRetention struct { MaxRecords int `json:"maxRecords"` @@ -145,6 +244,8 @@ type GitConsole struct { omitted bool revision uint64 nextID uint64 + // preferences say which query categories are recorded and how records are drawn. + preferences GitConsolePreferences now func() time.Time // changed is called after the console changed, outside the lock. changed func() @@ -188,6 +289,21 @@ func NewGitConsole(changed func()) *GitConsole { } } +// SetPreferences sets which query categories the console records from the next request on, +// and how its records are drawn. Records already kept stay. +func (c *GitConsole) SetPreferences(preferences GitConsolePreferences) { + c.mu.Lock() + defer c.mu.Unlock() + c.preferences = preferences +} + +// Preferences returns the console's preferences. +func (c *GitConsole) Preferences() GitConsolePreferences { + c.mu.Lock() + defer c.mu.Unlock() + return c.preferences +} + // Revision returns the console's revision, which grows each time it changes. func (c *GitConsole) Revision() uint64 { c.mu.Lock() @@ -645,27 +761,46 @@ func WithGitConsole(ctx context.Context, console *GitConsole, root string) conte type gitRefreshKey struct{} // AutomaticRefresh returns a context whose Git requests are automatic refreshes, which run -// on every file or repository change: their internal queries stay out of the console, which -// records every other Git command a request runs. The commands the user started still -// appear. +// on every file or repository change: their internal queries stay out of the console unless +// WithQueryCategory names a category its preferences show. The commands the user started +// still appear. func AutomaticRefresh(ctx context.Context) context.Context { return context.WithValue(ctx, gitRefreshKey{}, true) } +type gitQueryCategoryKey struct{} + +// WithQueryCategory returns a context whose Git requests read category (GitQueryReload and the +// rest), for a read whose request command does not tell it apart, such as the status a view +// reloads after an operation. The console records the request's queries when its preferences +// show category, even in an automatic refresh. +func WithQueryCategory(ctx context.Context, category string) context.Context { + return context.WithValue(ctx, gitQueryCategoryKey{}, category) +} + // gitExecutionOf is the Git policy of a request: a Git request of a context with a console -// asks Core to report its internal queries, unless the context is an automatic refresh. -// Other requests keep Core's defaults. +// asks Core to report the internal queries of the categories the console's preferences show, +// names the category the context gives, and marks an automatic refresh. Other requests, and +// a request with nothing to ask, keep Core's defaults. func gitExecutionOf(ctx context.Context, command string) *gitExecution { if !strings.HasPrefix(command, "git.") || gitConsoleUnrecorded[command] { return nil } - if sink, _ := ctx.Value(gitConsoleKey{}).(*gitConsoleSink); sink == nil { + sink, _ := ctx.Value(gitConsoleKey{}).(*gitConsoleSink) + if sink == nil { return nil } + execution := gitExecution{ConsoleQueries: sink.console.Preferences().QueryCategories()} + if len(execution.ConsoleQueries) > 0 { + execution.QueryCategory, _ = ctx.Value(gitQueryCategoryKey{}).(string) + } if refresh, _ := ctx.Value(gitRefreshKey{}).(bool); refresh { - return &gitExecution{Source: "background"} + execution.Source = "background" + } + if len(execution.ConsoleQueries) == 0 && execution.Source == "" { + return nil } - return &gitExecution{ReportQueries: true} + return &execution } // gitConsoleUnrecorded are the git commands that never run Git: they parse, plan or present @@ -816,6 +951,7 @@ type gitConsoleWireRecord struct { type gitConsolePresentationRequest struct { Records []gitConsoleWireRecord `json:"records"` Search string `json:"search"` + Display GitConsoleDisplay `json:"display"` } type gitConsoleGroup struct { @@ -884,14 +1020,15 @@ func (r *GitConsoleRecord) wire() (gitConsoleWireRecord, int) { return wire, size } -// GitConsolePresentation asks Core how to draw records, matching search case-insensitively -// when it is not empty. Records are sent in as many requests as Core's limits need, so any -// number may be asked for; search must be at most GitConsoleSearchLimit bytes. +// GitConsolePresentation asks Core how to draw records with display, matching search +// case-insensitively when it is not empty. Records are sent in as many requests as Core's +// limits need, so any number may be asked for; search must be at most GitConsoleSearchLimit +// bytes. // // GitConsolePresentation blocks; call it from a background goroutine. -func (c *Client) GitConsolePresentation(ctx context.Context, records []GitConsoleRecord, search string) (GitConsolePresentation, error) { +func (c *Client) GitConsolePresentation(ctx context.Context, records []GitConsoleRecord, search string, display GitConsoleDisplay) (GitConsolePresentation, error) { var presentation GitConsolePresentation - request := gitConsolePresentationRequest{Search: search, Records: []gitConsoleWireRecord{}} + request := gitConsolePresentationRequest{Search: search, Display: display, Records: []gitConsoleWireRecord{}} size := 0 send := func() error { var response gitConsolePresentationResponse diff --git a/desktop/internal/core/gitconsole_test.go b/desktop/internal/core/gitconsole_test.go index 351dbf6e0a..c70aea8a56 100644 --- a/desktop/internal/core/gitconsole_test.go +++ b/desktop/internal/core/gitconsole_test.go @@ -215,6 +215,8 @@ func TestGitWorktreesAreManagedAndRecordedInTheConsole(t *testing.T) { repo := committedRepository(t) client := NewClient() console := NewGitConsole(nil) + // The worktree list queries of the operations and of the panel show only when asked for. + console.SetPreferences(GitConsolePreferences{ShowCheckQueries: true, ShowPanelQueries: true}) ctx := WithGitConsole(testContext(t), console, repo) destination := filepath.Join(t.TempDir(), "linked") @@ -280,7 +282,7 @@ func TestGitWorktreesAreManagedAndRecordedInTheConsole(t *testing.T) { t.Fatalf("removal refused before Git ran = %+v, want an unconfirmed failure of %s", locked, repo) } - presentation, err := client.GitConsolePresentation(testContext(t), snapshot.Records, "worktree") + presentation, err := client.GitConsolePresentation(testContext(t), snapshot.Records, "worktree", GitConsoleDisplay{}) if err != nil { t.Fatalf("GitConsolePresentation() error: %v", err) } @@ -319,7 +321,7 @@ func TestGitConsoleRecordsNothingForADetachedContext(t *testing.T) { t.Fatalf("detached request recorded %+v", records) } // An unrecorded command leaves the console alone even when it fails. - if _, err := client.GitConsolePresentation(attached, []GitConsoleRecord{{ID: "x", State: "running"}}, strings.Repeat("x", GitConsoleSearchLimit+1)); err == nil { + if _, err := client.GitConsolePresentation(attached, []GitConsoleRecord{{ID: "x", State: "running"}}, strings.Repeat("x", GitConsoleSearchLimit+1), GitConsoleDisplay{}); err == nil { t.Fatal("GitConsolePresentation() accepted a search over the limit") } if records := console.Snapshot().Records; len(records) != 0 { @@ -346,50 +348,75 @@ func consoleCommands(console *GitConsole) []string { return commands } -// The console records the queries a request runs, as it records the commands the user -// started, except those of an automatic refresh, which runs on every change. -func TestGitConsoleRecordsQueriesButNotAutomaticRefreshes(t *testing.T) { +// The console records no internal query by default, as IDEA's console does, and records the +// queries of the categories its preferences show; an automatic refresh, which runs on every +// change, records its queries only under a category the host names. +func TestGitConsoleRecordsTheQueriesOfTheCategoriesItShows(t *testing.T) { repo := committedRepository(t) client := NewClient() console := NewGitConsole(nil) ctx := WithGitConsole(testContext(t), console, repo) + if _, err := client.GitStatus(ctx, repo); err != nil { + t.Fatalf("GitStatus() error: %v", err) + } + if _, err := client.GitReferences(ctx, repo); err != nil { + t.Fatalf("GitReferences() error: %v", err) + } + if records := console.Snapshot().Records; len(records) != 0 { + t.Fatalf("the default preferences recorded %+v", records) + } + + console.SetPreferences(GitConsolePreferences{ShowCheckQueries: true, ShowReferenceQueries: true}) if _, err := client.GitStatus(AutomaticRefresh(ctx), repo); err != nil { t.Fatalf("GitStatus(refresh) error: %v", err) } if records := console.Snapshot().Records; len(records) != 0 { - t.Fatalf("an automatic refresh recorded %+v", records) + t.Fatalf("an automatic refresh without a category recorded %+v", records) + } + if _, err := client.GitReferences(ctx, repo); err != nil { + t.Fatalf("GitReferences() error: %v", err) + } + if records := console.Snapshot().Records; len(records) != 0 { + t.Fatalf("log queries the console does not show were recorded: %+v", records) } if _, err := client.GitStatus(ctx, repo); err != nil { t.Fatalf("GitStatus() error: %v", err) } - if _, err := client.GitReferences(ctx, repo); err != nil { - t.Fatalf("GitReferences() error: %v", err) + if _, err := client.GitReferences(WithQueryCategory(AutomaticRefresh(ctx), GitQueryReferences), repo); err != nil { + t.Fatalf("GitReferences(references) error: %v", err) } commands := consoleCommands(console) if !slices.Contains(commands, "status") || !slices.Contains(commands, "for-each-ref") { t.Fatalf("console commands = %q, want the status and reference queries", commands) } for _, record := range console.Snapshot().Records { - if record.State != GitConsoleCompleted || (record.ExitCode != 0 && !record.ExpectedExit) { - t.Fatalf("query record %+v did not complete normally", record) + if !record.Query || record.State != GitConsoleCompleted || (record.ExitCode != 0 && !record.ExpectedExit) { + t.Fatalf("query record %+v did not complete normally as a query", record) } } } -// Only a Git request with a console asks Core to report its queries, and an automatic -// refresh names its provenance instead. -func TestGitExecutionOfAsksForQueriesOnlyWithAConsole(t *testing.T) { - console := NewGitConsole(nil) - ctx := WithGitConsole(context.Background(), console, "/repo") +// Only a Git request with a console asks Core to report queries, of the categories the +// console's preferences show and under the category the context names; an automatic refresh +// names its provenance. +func TestGitExecutionOfAsksForTheCategoriesTheConsoleShows(t *testing.T) { + idea := WithGitConsole(context.Background(), NewGitConsole(nil), "/repo") + shown := NewGitConsole(nil) + shown.SetPreferences(GitConsolePreferences{ShowDiffQueries: true, ShowCheckQueries: true}) + ctx := WithGitConsole(context.Background(), shown, "/repo") cases := []struct { name string ctx context.Context command string want string }{ - {"console", ctx, "git.status", `{"reportQueries":true}`}, - {"refresh", AutomaticRefresh(ctx), "git.status", `{"source":"background"}`}, + {"default console", idea, "git.status", `null`}, + {"default refresh", AutomaticRefresh(idea), "git.status", `{"source":"background"}`}, + {"default category", WithQueryCategory(idea, GitQueryReload), "git.status", `null`}, + {"shown", ctx, "git.status", `{"consoleQueries":["diff","checks"]}`}, + {"named", WithQueryCategory(ctx, GitQueryReload), "git.status", `{"consoleQueries":["diff","checks"],"queryCategory":"reload"}`}, + {"named refresh", WithQueryCategory(AutomaticRefresh(ctx), GitQueryReferences), "git.references", `{"consoleQueries":["diff","checks"],"queryCategory":"references","source":"background"}`}, {"no console", context.Background(), "git.status", `null`}, {"detached", WithGitConsole(ctx, nil, ""), "git.status", `null`}, {"never runs Git", ctx, "git.consolePresentation", `null`}, @@ -403,6 +430,37 @@ func TestGitExecutionOfAsksForQueriesOnlyWithAConsole(t *testing.T) { } } +// Every preference starts as IDEA's console, and each one turns on the category or display +// option it names. +func TestGitConsolePreferencesMapToCategoriesAndDisplay(t *testing.T) { + var idea GitConsolePreferences + if got := idea.QueryCategories(); len(got) != 0 { + t.Fatalf("default categories = %q, want none", got) + } + if got := idea.Display(); got != (GitConsoleDisplay{}) { + t.Fatalf("default display = %+v, want IDEA's", got) + } + if encoded, err := json.Marshal(idea); err != nil || string(encoded) != `{}` { + t.Fatalf("default preferences encode as %s (%v), want {}", encoded, err) + } + all := GitConsolePreferences{ + ShowReferenceQueries: true, ShowReloadQueries: true, ShowDiffRefreshQueries: true, + ShowDiffQueries: true, ShowLogQueries: true, ShowLogPathFilterQueries: true, + ShowAnnotateQueries: true, ShowPanelQueries: true, ShowCheckQueries: true, + FoldSingleLineQueries: true, ShowCompletedWithoutOutput: true, + HideTemporaryConfig: true, HideRepository: true, + } + want := []string{GitQueryReferences, GitQueryReload, GitQueryDiffRefresh, GitQueryDiff, GitQueryLog, + GitQueryLogPathFilter, GitQueryAnnotate, GitQueryPanels, GitQueryChecks} + if got := all.QueryCategories(); !slices.Equal(got, want) { + t.Fatalf("categories = %q, want %q", got, want) + } + display, err := json.Marshal(all.Display()) + if err != nil || string(display) != `{"foldSingleLineQueries":true,"showCompletedWithoutOutput":true,"hideTemporaryConfig":true,"hideRepository":true}` { + t.Fatalf("display = %s (%v)", display, err) + } +} + // A started event says which command is a query and how Core projects it for consoles, and // the record carries both, the query also to Core's presentation of it. func TestGitConsoleRecordsTheQueryAndTheProjectionOfAStartedCommand(t *testing.T) { diff --git a/desktop/internal/i18n/console_messages.go b/desktop/internal/i18n/console_messages.go index e72fbc5f51..c4ec6146de 100644 --- a/desktop/internal/i18n/console_messages.go +++ b/desktop/internal/i18n/console_messages.go @@ -22,8 +22,9 @@ type ConsoleMessages struct { Stop string Clear string CopyAll string - // HideQueries leaves out the read-only queries that did not fail. - HideQueries string + // Settings opens the Version Control settings, which choose the queries the console + // records and how it draws its records. + Settings string // The context menu of a command. CopyCommand string @@ -76,7 +77,7 @@ func consoleMessages(language Language) ConsoleMessages { Stop: Shared(language, "git.console.cancel"), Clear: Shared(language, "native.clearGitConsole"), CopyAll: Shared(language, "native.copyCompleteConsole"), - HideQueries: Shared(language, "desktop.git.console.hideQueries"), + Settings: Shared(language, "desktop.git.console.settings"), CopyCommand: Shared(language, "git.console.copyCommand"), CopyOutput: Shared(language, "git.console.copyOutput"), diff --git a/desktop/internal/i18n/shared.generated.go b/desktop/internal/i18n/shared.generated.go index 7f0a6c7329..ede20bc59c 100644 --- a/desktop/internal/i18n/shared.generated.go +++ b/desktop/internal/i18n/shared.generated.go @@ -540,8 +540,8 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.git.console.exitCode": "Exit code {code}", "desktop.git.console.expand": "Expand", "desktop.git.console.expandConfiguration": "Show {count} temporary settings", - "desktop.git.console.hideQueries": "Hide Read Commands", "desktop.git.console.queryOutput": "Read output, {count} lines", + "desktop.git.console.settings": "Git Console Settings", "desktop.git.decorations": "Show commit decorations", "desktop.git.deleteBranch": "Delete Selected Branch", "desktop.git.excludeFailed": "Could not exclude the item: {reason}", @@ -590,6 +590,36 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.git.settings.blameHelp": "Shows the author, age and commit subject of the line the caret is on, after its text. Git is read when a file is saved or HEAD moves; the previous annotation stays until then. Off by default.", "desktop.git.settings.changeLists": "Show Change Lists", "desktop.git.settings.changeListsHelp": "Groups the Commit window's changes by local change list, with the bar that creates, renames and deletes lists. Turned off, every change is listed in one flat list and all staged changes commit together. The lists and their assignments are kept.", + "desktop.git.settings.console.annotate": "Omit Annotate and Line History", + "desktop.git.settings.console.annotateHelp": "The reads of annotate (blame) and line history. Inline blame refreshes automatically and is never recorded.", + "desktop.git.settings.console.checks": "Omit Checks Before Operations", + "desktop.git.settings.console.checksHelp": "The previews, preflight checks and plans before an operation, and the other queries an operation runs for itself, such as the status.", + "desktop.git.settings.console.completedNotice": "Omit the “No Output” Notice", + "desktop.git.settings.console.completedNoticeHelp": "No notice is shown under a command that succeeded without output. IntelliJ IDEA shows none either.", + "desktop.git.settings.console.diff": "Omit Diff Reads", + "desktop.git.settings.console.diffHelp": "The file and commit diffs, comparisons and stageable change blocks read when a Diff tab opens or changes.", + "desktop.git.settings.console.diffRefresh": "Omit Diff Refreshes After Saving", + "desktop.git.settings.console.diffRefreshHelp": "The open Diff tabs of a file read again after the file is saved.", + "desktop.git.settings.console.display": "Git Console: Display", + "desktop.git.settings.console.displayHelp": "These change only how the Git console draws the commands it recorded, not which it records. Copying the whole console still gives the full commands and repositories. Every switch starts as in IntelliJ IDEA.", + "desktop.git.settings.console.foldSingleLine": "Show Only the Command Line of Queries", + "desktop.git.settings.console.foldSingleLineHelp": "A recorded query's output is folded whole, a single line too, and opens on a click. Turned off, only output of several lines is folded, as in IntelliJ IDEA.", + "desktop.git.settings.console.log": "Omit Log Browsing", + "desktop.git.settings.console.logHelp": "The reads of the Git log: its commit history, branches and tags, graph and commit details.", + "desktop.git.settings.console.logPathFilter": "Omit Log Path Filter Reads", + "desktop.git.settings.console.logPathFilterHelp": "The file lists read commit by commit when the log is filtered by path.", + "desktop.git.settings.console.omitted": "Git Console: Omitted Queries", + "desktop.git.settings.console.omittedHelp": "A kind that is on is not written to the Git console and takes none of the 200 records it keeps. The commands you run, failed Git requests and unexpected exit codes always show. The reads that refresh automatically as repositories change (status, gutter markers, inline blame and so on) are never recorded. Every switch starts as in IntelliJ IDEA: all omitted.", + "desktop.git.settings.console.panels": "Omit Lists and Panels", + "desktop.git.settings.console.panelsHelp": "The reads of lists and panels such as worktrees, stashes, remotes, pull requests, untracked directories and repository setup.", + "desktop.git.settings.console.references": "Omit Background Branch Reads", + "desktop.git.settings.console.referencesHelp": "The branches and references of each repository read again in the background after a repository changes, for the branch popup and the log's repository groups.", + "desktop.git.settings.console.reload": "Omit Reloads After Operations", + "desktop.git.settings.console.reloadHelp": "The status read again after a fetch, a branch update or a branch operation finishes, and the Diff tabs read again after an operation writes to the working tree or the index.", + "desktop.git.settings.console.repository": "Omit Repository Name", + "desktop.git.settings.console.repositoryHelp": "Each command line starts with the time alone, without the [repository] name.", + "desktop.git.settings.console.temporaryConfig": "Hide Temporary -c Configuration", + "desktop.git.settings.console.temporaryConfigHelp": "The command line no longer shows the -c settings Lithe passes for a single command, not even folded. The -c arguments the command itself names still show, folded.", "desktop.git.settings.gutter": "Show Git Change Markers", "desktop.git.settings.gutterHelp": "Marks lines added, changed or removed against the Git index in the editor's gutter. Click a marker to see the earlier text, stage that change, or revert it. Markers update when a file is saved and when the Git status changes.", "desktop.git.settings.parentReferences": "Show Update Parent Repository References", @@ -3239,8 +3269,8 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.git.console.exitCode": "退出码 {code}", "desktop.git.console.expand": "展开", "desktop.git.console.expandConfiguration": "显示 {count} 项临时配置", - "desktop.git.console.hideQueries": "隐藏读取命令", "desktop.git.console.queryOutput": "读取结果,共 {count} 行", + "desktop.git.console.settings": "Git 控制台设置", "desktop.git.decorations": "显示引用标签", "desktop.git.deleteBranch": "删除所选分支", "desktop.git.excludeFailed": "无法排除该项目:{reason}", @@ -3289,6 +3319,36 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.git.settings.blameHelp": "在光标所在行末尾显示作者、时间和提交标题。仅在保存文件或 HEAD 变化时重新读取 Git,刷新期间保留旧注释。默认关闭。", "desktop.git.settings.changeLists": "显示变更列表", "desktop.git.settings.changeListsHelp": "在提交窗口按本地更改列表分组变更,并显示创建、重命名和删除列表的工具栏。关闭后所有变更平铺显示,已暂存的变更可一起提交;列表及其分配会保留。", + "desktop.git.settings.console.annotate": "省略注解与行历史", + "desktop.git.settings.console.annotateHelp": "打开注解(Blame)或查看行历史时的读取。行尾 Blame 随文件自动刷新,从不记录。", + "desktop.git.settings.console.checks": "省略操作前检查", + "desktop.git.settings.console.checksHelp": "操作前的预览、预检和计划,以及操作为自己读取的状态等其他查询。", + "desktop.git.settings.console.completedNotice": "省略“执行成功,没有输出”提示", + "desktop.git.settings.console.completedNoticeHelp": "命令成功结束但没有输出时,不在命令下方显示这条提示。IntelliJ IDEA 也不显示。", + "desktop.git.settings.console.diff": "省略差异读取", + "desktop.git.settings.console.diffHelp": "打开或切换差异标签页时读取的文件差异、提交差异、比较结果和可暂存的变更块。", + "desktop.git.settings.console.diffRefresh": "省略保存后的差异刷新", + "desktop.git.settings.console.diffRefreshHelp": "保存文件后重新读取该文件已打开的差异标签页。", + "desktop.git.settings.console.display": "Git 控制台:显示", + "desktop.git.settings.console.displayHelp": "只改变已记录命令在 Git 控制台里的显示方式,不影响记录哪些命令。复制全部内容时仍包含完整命令和仓库。初始状态与 IntelliJ IDEA 一致。", + "desktop.git.settings.console.foldSingleLine": "查询只显示命令行", + "desktop.git.settings.console.foldSingleLineHelp": "已记录查询的输出全部折叠,只有一行也折叠,点击可展开。关闭时只折叠多行输出,与 IntelliJ IDEA 一致。", + "desktop.git.settings.console.log": "省略日志浏览", + "desktop.git.settings.console.logHelp": "Git 日志的提交历史、分支与标签、提交图和提交详情的读取。", + "desktop.git.settings.console.logPathFilter": "省略日志路径筛选", + "desktop.git.settings.console.logPathFilterHelp": "按路径筛选日志时逐个读取的提交文件列表。", + "desktop.git.settings.console.omitted": "Git 控制台:省略的查询", + "desktop.git.settings.console.omittedHelp": "打开的类别不写入 Git 控制台,也不占用控制台保留的 200 条记录。你执行的命令、失败的 Git 请求和意外的退出码始终显示。随仓库变化自动刷新的读取(状态、行号区标记、行尾 Blame 等)从不记录。初始状态与 IntelliJ IDEA 一致:全部省略。", + "desktop.git.settings.console.panels": "省略列表与面板", + "desktop.git.settings.console.panelsHelp": "工作树、储藏、远程仓库、拉取请求、未跟踪目录和仓库设置等列表与面板的读取。", + "desktop.git.settings.console.references": "省略后台分支读取", + "desktop.git.settings.console.referencesHelp": "仓库变化后在后台重新读取的各仓库分支与引用,供分支弹窗和日志的仓库分组使用。", + "desktop.git.settings.console.reload": "省略操作后的自动重新加载", + "desktop.git.settings.console.reloadHelp": "获取(Fetch)、更新分支或分支操作完成后重新读取的状态,以及操作写入工作区或暂存区后重新读取的差异标签页。", + "desktop.git.settings.console.repository": "省略仓库名", + "desktop.git.settings.console.repositoryHelp": "命令行开头只显示时间,不显示 [仓库名]。", + "desktop.git.settings.console.temporaryConfig": "完全隐藏临时 -c 配置", + "desktop.git.settings.console.temporaryConfigHelp": "命令行不再显示 Lithe 为单次命令传入的 -c 配置,折叠后的提示也不显示。命令本身写明的 -c 参数仍折叠显示。", "desktop.git.settings.gutter": "显示 Git 变更标记", "desktop.git.settings.gutterHelp": "在编辑器行号区标出相对 Git 索引新增、修改或删除的行。点击标记可查看修改前的内容、暂存或回退这处修改。保存文件或 Git 状态变化时更新。", "desktop.git.settings.parentReferences": "显示更新父仓库引用", diff --git a/desktop/internal/settingswindow/controller.go b/desktop/internal/settingswindow/controller.go index afcb07a29c..49ac55c5e0 100644 --- a/desktop/internal/settingswindow/controller.go +++ b/desktop/internal/settingswindow/controller.go @@ -94,6 +94,9 @@ type Values struct { // updates the parent repositories' references in the Commit window; both show by default. HideChangeLists bool HideParentReferences bool + // GitConsole says which internal Git queries the Git console records and how it draws its + // records; the zero value is IntelliJ IDEA's console. + GitConsole core.GitConsolePreferences // HideProjectColors leaves the open project's color out of the workbench's chrome, // which shows it by default. HideProjectColors bool @@ -403,6 +406,9 @@ type Options struct { // Values.HideParentReferences to the settings owner, like SetHideGitGutter. SetHideChangeLists func(bool) SetHideParentReferences func(bool) + // SetGitConsole hands a change of Values.GitConsole to the settings owner, like + // SetHideGitGutter. + SetGitConsole func(core.GitConsolePreferences) // SetProcessTermination hands a change of Values.ProcessTermination to the settings // owner, like SetTabRows. SetProcessTermination func(ProcessTermination) @@ -573,6 +579,12 @@ func (c *Controller) OpenKeymap(application *app.Application, current Values) er return c.open(application, current, pageKeymap) } +// OpenVersionControl shows the window on the Version Control page, where the Git console's +// settings button leads. +func (c *Controller) OpenVersionControl(application *app.Application, current Values) error { + return c.open(application, current, pageVersionControl) +} + // OpenAI shows the window on the Generation page, where the commit area's settings button leads. func (c *Controller) OpenAI(application *app.Application, current Values) error { return c.open(application, current, pageAIGeneration) diff --git a/desktop/internal/settingswindow/git_console_view.go b/desktop/internal/settingswindow/git_console_view.go new file mode 100644 index 0000000000..6f4c33ec5f --- /dev/null +++ b/desktop/internal/settingswindow/git_console_view.go @@ -0,0 +1,86 @@ +package settingswindow + +import ( + "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" + "github.com/vivaui/viva/ui" +) + +// This file is the Git console cards of the Version Control page (matrix id git-history). The +// first card chooses which kinds of internal Git queries the console leaves out: an omitted +// kind is never recorded, so it takes none of the journal's records. The second chooses how +// the console draws the records it keeps. Every switch starts as IntelliJ IDEA's console, +// which records none of these queries and draws everything else, so the stored preferences of +// a user who never touched them are empty. + +// gitConsoleOption is one switch of the Git console cards: the key of its switch, its title +// and help, the preference it changes and whether the switch shows that preference inverted, +// as an omit switch shows a preference that says to show. +type gitConsoleOption struct { + key, title, help string + field *bool + inverted bool +} + +// gitConsoleCards declares the two Git console cards for the preferences the window holds. +func (w *window) gitConsoleCards(c ui.C, language i18n.Language) { + value := w.sess.values.GitConsole + omitted := [...]gitConsoleOption{ + {"references", i18n.Shared(language, "desktop.git.settings.console.references"), i18n.Shared(language, "desktop.git.settings.console.referencesHelp"), &value.ShowReferenceQueries, true}, + {"reload", i18n.Shared(language, "desktop.git.settings.console.reload"), i18n.Shared(language, "desktop.git.settings.console.reloadHelp"), &value.ShowReloadQueries, true}, + {"diffRefresh", i18n.Shared(language, "desktop.git.settings.console.diffRefresh"), i18n.Shared(language, "desktop.git.settings.console.diffRefreshHelp"), &value.ShowDiffRefreshQueries, true}, + {"diff", i18n.Shared(language, "desktop.git.settings.console.diff"), i18n.Shared(language, "desktop.git.settings.console.diffHelp"), &value.ShowDiffQueries, true}, + {"log", i18n.Shared(language, "desktop.git.settings.console.log"), i18n.Shared(language, "desktop.git.settings.console.logHelp"), &value.ShowLogQueries, true}, + {"logPathFilter", i18n.Shared(language, "desktop.git.settings.console.logPathFilter"), i18n.Shared(language, "desktop.git.settings.console.logPathFilterHelp"), &value.ShowLogPathFilterQueries, true}, + {"annotate", i18n.Shared(language, "desktop.git.settings.console.annotate"), i18n.Shared(language, "desktop.git.settings.console.annotateHelp"), &value.ShowAnnotateQueries, true}, + {"panels", i18n.Shared(language, "desktop.git.settings.console.panels"), i18n.Shared(language, "desktop.git.settings.console.panelsHelp"), &value.ShowPanelQueries, true}, + {"checks", i18n.Shared(language, "desktop.git.settings.console.checks"), i18n.Shared(language, "desktop.git.settings.console.checksHelp"), &value.ShowCheckQueries, true}, + } + display := [...]gitConsoleOption{ + {"foldSingleLine", i18n.Shared(language, "desktop.git.settings.console.foldSingleLine"), i18n.Shared(language, "desktop.git.settings.console.foldSingleLineHelp"), &value.FoldSingleLineQueries, false}, + {"completedNotice", i18n.Shared(language, "desktop.git.settings.console.completedNotice"), i18n.Shared(language, "desktop.git.settings.console.completedNoticeHelp"), &value.ShowCompletedWithoutOutput, true}, + {"temporaryConfig", i18n.Shared(language, "desktop.git.settings.console.temporaryConfig"), i18n.Shared(language, "desktop.git.settings.console.temporaryConfigHelp"), &value.HideTemporaryConfig, false}, + {"repository", i18n.Shared(language, "desktop.git.settings.console.repository"), i18n.Shared(language, "desktop.git.settings.console.repositoryHelp"), &value.HideRepository, false}, + } + w.card(c, i18n.Shared(language, "desktop.git.settings.console.omitted"), i18n.Shared(language, "desktop.git.settings.console.omittedHelp"), func() { + for _, option := range omitted { + if w.gitConsoleSwitch(c, option) { + w.setGitConsole(value, false) + } + } + }) + w.card(c, i18n.Shared(language, "desktop.git.settings.console.display"), i18n.Shared(language, "desktop.git.settings.console.displayHelp"), func() { + for _, option := range display { + if w.gitConsoleSwitch(c, option) { + w.setGitConsole(value, false) + } + } + }) +} + +// gitConsoleSwitch declares the switch of option with its help glyph and reports whether the +// user flipped it, which it has then written into the preference. +func (w *window) gitConsoleSwitch(c ui.C, option gitConsoleOption) bool { + on := *option.field != option.inverted + changed := false + ui.Row(c).FillWidth().MinHeight(28).Items(ui.Center).Gap(6).Children(func() { + changed = ui.Switch(c.Part("console-"+option.key), &on, option.title).Changed() + w.infoButton(c, option.help) + }) + if changed { + *option.field = on != option.inverted + } + return changed +} + +// setGitConsole stores a change of the Git console cards and hands it to the settings owner +// at once. +func (w *window) setGitConsole(value core.GitConsolePreferences, force bool) { + if w.sess.finished.Load() || (!force && w.sess.values.GitConsole == value) { + return + } + w.sess.values.GitConsole = value + if w.ctrl.opts.SetGitConsole != nil { + w.ctrl.opts.SetGitConsole(value) + } +} diff --git a/desktop/internal/settingswindow/git_console_view_test.go b/desktop/internal/settingswindow/git_console_view_test.go new file mode 100644 index 0000000000..4b9d34edf8 --- /dev/null +++ b/desktop/internal/settingswindow/git_console_view_test.go @@ -0,0 +1,60 @@ +package settingswindow + +import ( + "testing" + + "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" + "github.com/vivaui/viva/app" + "github.com/vivaui/viva/gfx" +) + +// The Git console cards start as IntelliJ IDEA does: every omit switch on, and of the display +// switches only the one that omits the no-output notice. A switch the user flips reaches the +// settings owner as the preference it stands for, and Restore Defaults brings the IDEA state +// back. +func TestGitConsoleCardsStartAsIDEAAndHandOnTheirChanges(t *testing.T) { + var changes []core.GitConsolePreferences + w := newWindow(NewController(Options{ + SetGitConsole: func(preferences core.GitConsolePreferences) { changes = append(changes, preferences) }, + }), Values{}) + w.sess.page = pageVersionControl + d := openWindow(t, w, func(config *app.Config) { config.Height = 1800 }) + switchOf := func(key string) gfx.Hit { + t.Helper() + hit := d.hit(i18n.Shared(i18n.English, "desktop.git.settings.console."+key)) + if hit.Role != gfx.RoleSwitch { + t.Fatalf("%s is a %v, want a switch", key, hit.Role) + } + return hit + } + expect := func(when string, on map[string]bool) { + t.Helper() + for _, key := range []string{"references", "reload", "diffRefresh", "diff", "log", "logPathFilter", "annotate", "panels", "checks", "foldSingleLine", "completedNotice", "temporaryConfig", "repository"} { + want := key != "foldSingleLine" && key != "temporaryConfig" && key != "repository" + if flipped, ok := on[key]; ok { + want = flipped + } + if got := switchOf(key).Checked; got != want { + t.Fatalf("%s: switch %s is %v, want %v", when, key, got, want) + } + } + } + expect("at first", nil) + + d.click(i18n.Shared(i18n.English, "desktop.git.settings.console.diff")) + d.click(i18n.Shared(i18n.English, "desktop.git.settings.console.repository")) + want := core.GitConsolePreferences{ShowDiffQueries: true, HideRepository: true} + if len(changes) != 2 || changes[1] != want || w.sess.values.GitConsole != want { + t.Fatalf("changes %+v, window %+v, want %+v", changes, w.sess.values.GitConsole, want) + } + d.pump() + expect("after the clicks", map[string]bool{"diff": false, "repository": true}) + + d.click("Restore Defaults") + if last := changes[len(changes)-1]; len(changes) != 3 || last != (core.GitConsolePreferences{}) || w.sess.values.GitConsole != last { + t.Fatalf("Restore Defaults handed on %+v and kept %+v", changes, w.sess.values.GitConsole) + } + d.pump() + expect("after Restore Defaults", nil) +} diff --git a/desktop/internal/settingswindow/version_control_view.go b/desktop/internal/settingswindow/version_control_view.go index 96e67c9c13..23ab3bd1f3 100644 --- a/desktop/internal/settingswindow/version_control_view.go +++ b/desktop/internal/settingswindow/version_control_view.go @@ -5,8 +5,9 @@ import ( "github.com/vivaui/viva/ui" ) -// versionControlPage is the Version Control page: the Git switches of the editor. Opening the -// page writes nothing; a switch hands its change to the settings owner at once. +// versionControlPage is the Version Control page: the Git switches of the editor, the Commit +// window and the Git console. Opening the page writes nothing; a switch hands its change to +// the settings owner at once. func (w *window) versionControlPage(c ui.C) { language := w.marketLanguage() if w.ctrl.opts.GitHub != nil { @@ -41,5 +42,6 @@ func (w *window) versionControlPage(c ui.C) { w.setHideParentReferences(!parents, false) } }) + w.gitConsoleCards(c, language) }) } diff --git a/desktop/internal/settingswindow/visual_capture_test.go b/desktop/internal/settingswindow/visual_capture_test.go index ea0c787c20..f0bfc0bffb 100644 --- a/desktop/internal/settingswindow/visual_capture_test.go +++ b/desktop/internal/settingswindow/visual_capture_test.go @@ -42,7 +42,7 @@ func TestVisualSettings(t *testing.T) { }{ {"20-settings-general", pageGeneral}, {"22-settings-editor", pageEditor}, {"23-settings-keymap", pageKeymap}, {"24-settings-network", pageNetwork}, - {"25-settings-process", pageProcessTermination}, {"26-settings-git", pageVersionControl}, + {"25-settings-process", pageProcessTermination}, {"26-settings-git", pageVersionControl}, {"26-settings-git-console", pageVersionControl}, {"27-settings-terminal", pageTerminal}, {"28-plugins-installed", pagePlugins}, {"29-marketplace-empty", pagePlugins}, {"31-settings-updates", pageUpdates}, {"33-settings-toolchains", pageBuild}, {"m44-toolchain-directory-menu", pageBuild}, {"m45-toolchain-custom-directory", pageBuild}, @@ -103,6 +103,10 @@ func TestVisualSettings(t *testing.T) { d.click(w.text.Settings.TabsShowIn) case "21-settings-language-popup": d.click(w.text.Settings.Language) + case "26-settings-git-console": + if err := d.driver.Scroll(gfx.ScrollEvent{X: 700, Y: 500, DeltaY: 900, Viewport: gfx.Size{Width: 900, Height: 700}}); err != nil { + t.Fatal(err) + } case "30-settings-history": if err := d.driver.Scroll(gfx.ScrollEvent{X: 700, Y: 500, DeltaY: 500, Viewport: gfx.Size{Width: 900, Height: 700}}); err != nil { t.Fatal(err) diff --git a/desktop/internal/settingswindow/window_view.go b/desktop/internal/settingswindow/window_view.go index 3f5704d303..5888c5d328 100644 --- a/desktop/internal/settingswindow/window_view.go +++ b/desktop/internal/settingswindow/window_view.go @@ -1,6 +1,7 @@ package settingswindow import ( + "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/fontprefs" "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" "github.com/1lck/Lithe-IDEA/desktop/internal/icons" @@ -533,6 +534,7 @@ func (w *window) footer(c ui.C) { w.setTerminalShell("", true) w.setTerminalBehavior(TerminalBehavior{}, true) w.setFonts(fontprefs.Default(), true) + w.setGitConsole(core.GitConsolePreferences{}, true) } ui.Spacer(c) if ui.Button(c, settings.Cancel).Outline().Clicked() { diff --git a/desktop/internal/workbench/app.go b/desktop/internal/workbench/app.go index 702fec263c..87e48f4a71 100644 --- a/desktop/internal/workbench/app.go +++ b/desktop/internal/workbench/app.go @@ -184,7 +184,7 @@ type Kernel interface { GitUnlockWorktree(ctx context.Context, root, path string) error GitPruneWorktrees(ctx context.Context, root string) error GitRepairWorktrees(ctx context.Context, root string) error - GitConsolePresentation(ctx context.Context, records []core.GitConsoleRecord, search string) (core.GitConsolePresentation, error) + GitConsolePresentation(ctx context.Context, records []core.GitConsoleRecord, search string, display core.GitConsoleDisplay) (core.GitConsolePresentation, error) ListDirectories(ctx context.Context, root string, paths []string) ([]core.DirectoryListing, error) PlanDocumentSaveBatch(ctx context.Context, documents []core.SaveBatchDocument) (core.SaveBatchPlan, error) ReduceDocumentSaveBatch(ctx context.Context, members []string, results []core.SaveBatchResult, documents []core.SaveBatchDocument) (core.SaveBatchDecision, error) @@ -304,6 +304,9 @@ type settings struct { // HideParentReferences hides the option that records submodule commits in the parent // repositories; while it is hidden every commit updates them. The option shows by default. HideParentReferences bool `json:"hideParentReferences,omitempty"` + // GitConsole says which internal Git queries the Git console records and how it draws its + // records; the zero value is IntelliJ IDEA's console (gitconsole_settings.go). + GitConsole core.GitConsolePreferences `json:"gitConsole,omitzero"` // DisableSemanticHighlight keeps the syntax colors alone; semantic coloring is on by default. DisableSemanticHighlight bool `json:"disableSemanticHighlight,omitempty"` // VimMode turns on the Vim keys of every editor; off by default (vim_mode.go). @@ -777,6 +780,7 @@ func New(options Options) *App { // the rest loaded. It is logged below with the failures, and the notice tells it is kept. settingsUnread := a.store.Unread(settingsFile) a.settings.Keymap = shortcuts.Normalize(a.settings.Keymap) + a.gitConsole.SetPreferences(a.settings.GitConsole) a.loadEditorEssentials() a.initRecovery() a.applyNetwork() diff --git a/desktop/internal/workbench/branch.go b/desktop/internal/workbench/branch.go index e740568689..05529a909a 100644 --- a/desktop/internal/workbench/branch.go +++ b/desktop/internal/workbench/branch.go @@ -202,7 +202,7 @@ func (a *App) runBranchWrite(p *project, operation string, failed func(reason st err := write(ctx, kernel, root) var status core.GitStatus if err == nil { - status, err = kernel.GitStatus(core.AutomaticRefresh(ctx), root) + status, err = kernel.GitStatus(core.WithQueryCategory(core.AutomaticRefresh(ctx), core.GitQueryReload), root) } return func(a *App) { b := &a.branch diff --git a/desktop/internal/workbench/difftab.go b/desktop/internal/workbench/difftab.go index d8c99a98aa..27ca6b3119 100644 --- a/desktop/internal/workbench/difftab.go +++ b/desktop/internal/workbench/difftab.go @@ -438,6 +438,12 @@ func (p *project) live(t *diffTab, gen int) bool { // change, for a comparison's file and for a file the plan has no section for. A stash's or a // shelf's file was read with it, so it shows at once. func (a *App) loadDiff(p *project, t *diffTab) { + a.loadDiffAs(p, t, "") +} + +// loadDiffAs is loadDiff with the console query category its reads are recorded under, one of +// core's GitQuery categories, or empty for the diff reads Core recognizes by their commands. +func (a *App) loadDiffAs(p *project, t *diffTab, category string) { kernel, ok := a.reviewKernel() if !ok { return @@ -460,6 +466,9 @@ func (a *App) loadDiff(p *project, t *diffTab) { // ignores whitespace reads its file instead; its blocks cannot be staged meanwhile. ignore := t.ignoreSpace a.background(p, reviewTimeout, func(ctx context.Context) func(*App) { + if category != "" { + ctx = core.WithQueryCategory(ctx, category) + } var ( file *core.GitDiffFile plan *core.DiffBlockPlan @@ -544,10 +553,11 @@ func (a *App) readDiff(t *diffTab, file *core.GitDiffFile, plan *core.DiffBlockP // reloadDiffs reads again every tab that shows a change of the working tree or the index of the // checkout at root, a comparison with the working tree among them, after something wrote to it. +// The console records these reads with the reloads that follow operations. func (a *App) reloadDiffs(p *project, root string) { for _, t := range p.diffs.list { if t.root == root && (t.commit == "" || (t.compare != nil && t.compare.target == nil)) { - a.loadDiff(p, t) + a.loadDiffAs(p, t, core.GitQueryReload) } } } diff --git a/desktop/internal/workbench/difftab_edit.go b/desktop/internal/workbench/difftab_edit.go index 7f40599124..34586c06af 100644 --- a/desktop/internal/workbench/difftab_edit.go +++ b/desktop/internal/workbench/difftab_edit.go @@ -4,6 +4,7 @@ import ( "path/filepath" "runtime" + "github.com/1lck/Lithe-IDEA/desktop/internal/core" "github.com/1lck/Lithe-IDEA/desktop/internal/editorview" "github.com/vivaui/viva/gfx" ) @@ -106,11 +107,12 @@ func (a *App) diffUndoChord(t *diffTab, event gfx.KeyEvent) bool { } // reloadDiffsOfPath reads again every Diff tab of the file at path, after the document of it was -// saved, so the change the tabs show is the one on disk. +// saved, so the change the tabs show is the one on disk. The console records these reads only +// when it shows the diff refreshes after saving. func (a *App) reloadDiffsOfPath(p *project, path string) { for _, t := range p.diffs.list { if t.saved == nil && diffTabPath(t) == path { - a.loadDiff(p, t) + a.loadDiffAs(p, t, core.GitQueryDiffRefresh) } } } diff --git a/desktop/internal/workbench/gitconsole.go b/desktop/internal/workbench/gitconsole.go index fe354954dd..6e5875e48c 100644 --- a/desktop/internal/workbench/gitconsole.go +++ b/desktop/internal/workbench/gitconsole.go @@ -167,10 +167,12 @@ type consolePresented struct { entry core.GitConsoleEntry hits []core.GitConsoleHit // revision and lines are the record's revision and number of lines the presentation - // was made for; search is the search it matched. + // was made for; search is the search it matched and display the display choices it + // followed. revision uint64 lines int search string + display core.GitConsoleDisplay // raw says Core gave no entry for the record, which is then drawn from its lines; it // keeps the record from being asked for again until it changes. raw bool @@ -188,23 +190,25 @@ type consoleView struct { presented map[string]*consolePresented // presenting says a presentation request is in flight; only one ever is. presenting bool - // failed says the last request failed, for the snapshot revision and search it names, - // which are not asked for again; the records are drawn from their lines meanwhile. + // failed says the last request failed, for the snapshot revision, search and display + // choices it names, which are not asked for again; the records are drawn from their + // lines meanwhile. failed bool failedRevision uint64 failedSearch string + failedDisplay core.GitConsoleDisplay search ui.Field // searchFor is the search the rows were flattened for: the field's text, cut to what // Core accepts. searchFor string + // display is the display choices of the Version Control settings the rows were + // flattened for, which Core presents the records with. + display core.GitConsoleDisplay // open holds the folds the user opened. open map[consoleFold]bool // wrap says long lines break into several instead of ending in an ellipsis. wrap bool - // hideQueries says the internal read-only queries Core reported are left out, except - // those that failed, so only the commands the workflows ran visibly are shown. - hideQueries bool - list ui.ListState + list ui.ListState // drawRow is drawConsoleRow, made once because a method value made in each paint // allocates. drawRow func(ui.ListRow) @@ -254,8 +258,8 @@ func (a *App) gitConsoleChanged() { } // syncConsole brings the rows up to date before a paint draws them: it takes a snapshot when -// the journal changed, takes in a new search, asks Core to present what changed and flattens -// the rows again when anything they show did. +// the journal changed, takes in a new search and new display choices, asks Core to present +// what changed and flattens the rows again when anything they show did. func (a *App) syncConsole() { v := &a.consoleView if v.stale.Swap(false) || !v.read { @@ -268,6 +272,9 @@ func (a *App) syncConsole() { if search := consoleSearchText(v.search.Text()); search != v.searchFor { v.searchFor, v.dirty, v.hasCurrent = search, true, false } + if display := a.settings.GitConsole.Display(); display != v.display { + v.display, v.dirty, v.hasCurrent = display, true, false + } a.presentConsole() if v.dirty { v.flatten(&a.text.Console, time.Local) @@ -275,39 +282,40 @@ func (a *App) syncConsole() { } // presentConsole asks Core, in the background, to present the records whose presentation is -// missing or was made for another revision or search. One request is in flight at a time: -// when it lands, the paint that follows asks for what changed meanwhile. A request that -// failed is not repeated until the journal or the search changes. +// missing or was made for another revision, search or display choices. One request is in +// flight at a time: when it lands, the paint that follows asks for what changed meanwhile. A +// request that failed is not repeated until the journal, the search or the display choices +// change. func (a *App) presentConsole() { v := &a.consoleView - if v.presenting || v.failed && v.failedRevision == v.snapshot.Revision && v.failedSearch == v.searchFor { + if v.presenting || v.failed && v.failedRevision == v.snapshot.Revision && v.failedSearch == v.searchFor && v.failedDisplay == v.display { return } var records []core.GitConsoleRecord for i := range v.snapshot.Records { r := &v.snapshot.Records[i] - if p := v.presented[r.ID]; p == nil || p.revision != r.Revision || p.search != v.searchFor { + if p := v.presented[r.ID]; p == nil || p.revision != r.Revision || p.search != v.searchFor || p.display != v.display { records = append(records, *r) } } if len(records) == 0 { return } - kernel, search, revision := a.kernel, v.searchFor, v.snapshot.Revision + kernel, search, display, revision := a.kernel, v.searchFor, v.display, v.snapshot.Revision v.presenting = true a.background(nil, kernelCallTimeout, func(ctx context.Context) func(*App) { - presentation, err := kernel.GitConsolePresentation(ctx, records, search) - return func(a *App) { a.landConsolePresentation(records, search, revision, presentation, err) } + presentation, err := kernel.GitConsolePresentation(ctx, records, search, display) + return func(a *App) { a.landConsolePresentation(records, search, display, revision, presentation, err) } }) } // landConsolePresentation keeps what a presentation request answered for records, which it -// made for search when the snapshot had revision. -func (a *App) landConsolePresentation(records []core.GitConsoleRecord, search string, revision uint64, presentation core.GitConsolePresentation, err error) { +// made for search and display when the snapshot had revision. +func (a *App) landConsolePresentation(records []core.GitConsoleRecord, search string, display core.GitConsoleDisplay, revision uint64, presentation core.GitConsolePresentation, err error) { v := &a.consoleView v.presenting, v.dirty = false, true if err != nil { - v.failed, v.failedRevision, v.failedSearch = true, revision, search + v.failed, v.failedRevision, v.failedSearch, v.failedDisplay = true, revision, search, display return } v.failed = false @@ -324,7 +332,7 @@ func (a *App) landConsolePresentation(records []core.GitConsoleRecord, search st } for i := range records { r := &records[i] - p := &consolePresented{hits: hits[r.ID], revision: r.Revision, lines: len(r.Lines), search: search} + p := &consolePresented{hits: hits[r.ID], revision: r.Revision, lines: len(r.Lines), search: search, display: display} if at, ok := entries[r.ID]; ok { p.entry = presentation.Entries[at] } else { @@ -447,13 +455,15 @@ func (v *consoleView) rowSpans(start int) []consoleSpan { } // prefixSpans adds the spans of a header that starts with consoleHeaderParts' stamp and -// repository, joined by a space, and is n bytes long, the rest of it the command, and returns -// them. +// repository, joined by a space unless the repository is left out, and is n bytes long, the +// rest of it the command, and returns them. func (v *consoleView) prefixSpans(stamp, repository string, n int) []consoleSpan { start := len(v.spans) v.endSpan(start, len(stamp), consoleSpanStamp) - v.endSpan(start, len(stamp)+1, consoleSpanText) - v.endSpan(start, len(stamp)+1+len(repository), consoleSpanRepository) + if repository != "" { + v.endSpan(start, len(stamp)+1, consoleSpanText) + v.endSpan(start, len(stamp)+1+len(repository), consoleSpanRepository) + } v.endSpan(start, n, consoleSpanCommand) return v.rowSpans(start) } @@ -526,9 +536,6 @@ func (v *consoleView) flattenRecord(old map[consoleRowID]int, index int, r *core use := p != nil && !p.raw && !v.failed && (p.revision == r.Revision || !r.Truncated && p.lines <= len(r.Lines)) exact := use && p.revision == r.Revision failed := consoleFailed(r, p, exact) - if v.hideQueries && r.Query && !failed { - return - } // A query that answered the workflow is drawn subtle, so the commands the workflows ran // stand out among the reads around them. quiet := r.Query && !failed @@ -544,6 +551,8 @@ func (v *consoleView) flattenRecord(old map[consoleRowID]int, index int, r *core header := consoleRow{id: consoleRowID{record: r.ID, part: consolePartHeader}, record: index} if use { entry := &p.entry + // Core leaves the label out when the display choices hide the repository; a + // presentation made before they changed may still have one, or lack it. label := entry.RepositoryLabel if label == "" { label = r.Root @@ -560,14 +569,16 @@ func (v *consoleView) flattenRecord(old map[consoleRowID]int, index int, r *core } folded := fold.fragment != "" && !v.open[fold] start := len(v.spans) - stamp, repository := consoleHeaderParts(r.Started, label, loc) + stamp, repository := consoleHeaderParts(r.Started, label, v.display.HideRepository, loc) var b strings.Builder b.WriteString(stamp) v.endSpan(start, b.Len(), consoleSpanStamp) - b.WriteByte(' ') - v.endSpan(start, b.Len(), consoleSpanText) - b.WriteString(repository) - v.endSpan(start, b.Len(), consoleSpanRepository) + if repository != "" { + b.WriteByte(' ') + v.endSpan(start, b.Len(), consoleSpanText) + b.WriteString(repository) + v.endSpan(start, b.Len(), consoleSpanRepository) + } if len(entry.Command) > 0 { b.WriteString(" git") } @@ -599,8 +610,8 @@ func (v *consoleView) flattenRecord(old map[consoleRowID]int, index int, r *core } } } else { - header.text = consoleDrawnHeader(r, loc) - stamp, repository := consoleHeaderParts(r.Started, r.Root, loc) + header.text = consoleDrawnHeader(r, v.display.HideRepository, loc) + stamp, repository := consoleHeaderParts(r.Started, r.Root, v.display.HideRepository, loc) header.spans = v.prefixSpans(stamp, repository, len(header.text)) } if r.State == core.GitConsoleRunning { @@ -626,7 +637,9 @@ func (v *consoleView) flattenRecord(old map[consoleRowID]int, index int, r *core } v.addLines(old, index, r, next, start) next = end - if fragment.Kind == consoleFragmentQuery && end-start > 1 { + // Core folds a query's output whole, a single line too when the display choices + // ask for the command line alone. + if fragment.Kind == consoleFragmentQuery { v.addQueryFold(old, index, r, fragment, start, end, text) continue } @@ -656,7 +669,9 @@ func (v *consoleView) flattenRecord(old map[consoleRowID]int, index int, r *core if r.State == core.GitConsoleRunning && r.Progress != "" { progressRow = v.add(old, consoleRow{id: consoleRowID{record: r.ID, part: consolePartProgress}, record: index, text: r.Progress, tone: consoleToneSubtle}) } - if exact { + // A notice the display choices no longer show is left out before Core presents the + // record again. + if exact && p.display == v.display { if notice := consoleNoticeText(text, p.entry.Notice); notice != "" { v.add(old, consoleRow{id: consoleRowID{record: r.ID, part: consolePartNotice}, record: index, text: notice, tone: consoleToneSubtle}) } @@ -817,13 +832,6 @@ func (a *App) closeConsoleSearch() { a.consoleView.search.SetText("") } -// toggleConsoleQueries shows or hides the internal read-only queries that did not fail. -func (a *App) toggleConsoleQueries() { - a.performed("git.console.hideQueries", surfaceButton) - v := &a.consoleView - v.hideQueries, v.dirty, v.hasCurrent = !v.hideQueries, true, false -} - // toggleConsoleWrap switches between breaking long lines and ending them in an ellipsis. func (a *App) toggleConsoleWrap() { a.performed("git.console.wrap", surfaceButton) @@ -938,34 +946,42 @@ func consoleOutput(r *core.GitConsoleRecord) string { } // consoleHeaderPrefix is the start of a header: when the command started, in loc to the -// millisecond, and the name of the repository it ran in, as consoleHeaderParts gives them, -// joined by a space. -func consoleHeaderPrefix(started time.Time, root string, loc *time.Location) string { - stamp, repository := consoleHeaderParts(started, root, loc) +// millisecond, and the name of the repository it ran in unless hide leaves it out, as +// consoleHeaderParts gives them, joined by a space. +func consoleHeaderPrefix(started time.Time, root string, hide bool, loc *time.Location) string { + stamp, repository := consoleHeaderParts(started, root, hide, loc) + if repository == "" { + return stamp + } return stamp + " " + repository } // consoleHeaderParts is the two parts of the start of a header, drawn in colors of their // own: the stamp, when the command started in loc to the millisecond with a colon after it, -// and the name of the repository it ran in, in brackets. -func consoleHeaderParts(started time.Time, root string, loc *time.Location) (stamp, repository string) { +// and the name of the repository it ran in, in brackets. hide, the display choice that leaves +// the repository out, makes the repository empty. +func consoleHeaderParts(started time.Time, root string, hide bool, loc *time.Location) (stamp, repository string) { + stamp = started.In(loc).Format("15:04:05.000") + ":" + if hide { + return stamp, "" + } base := "" if root != "" { base = filepath.Base(root) } - return started.In(loc).Format("15:04:05.000") + ":", "[" + base + "]" + return stamp, "[" + base + "]" } -// consoleDrawnHeader is the header of r drawn before Core presented it: the prefix and the -// command from its subcommand on, as Core projects it for consoles, so that the temporary -// configuration Core folds is not spelled out meanwhile. Without that projection it is the -// raw header. -func consoleDrawnHeader(r *core.GitConsoleRecord, loc *time.Location) string { +// consoleDrawnHeader is the header of r drawn before Core presented it: the prefix, without +// the repository when hide leaves it out, and the command from its subcommand on, as Core +// projects it for consoles, so that the temporary configuration Core folds is not spelled out +// meanwhile. Without that projection it is the raw header. +func consoleDrawnHeader(r *core.GitConsoleRecord, hide bool, loc *time.Location) string { if len(r.DisplayArguments) == 0 { - return consoleRawHeader(r, loc) + return consoleHeader(r, hide, loc) } var b strings.Builder - b.WriteString(consoleHeaderPrefix(r.Started, r.Root, loc)) + b.WriteString(consoleHeaderPrefix(r.Started, r.Root, hide, loc)) b.WriteString(" git") for _, argument := range r.DisplayArguments { b.WriteByte(' ') @@ -978,7 +994,12 @@ func consoleDrawnHeader(r *core.GitConsoleRecord, loc *time.Location) string { // copy of the whole console has: the prefix and the whole command. A failed request that ran // no command has none. func consoleRawHeader(r *core.GitConsoleRecord, loc *time.Location) string { - header := consoleHeaderPrefix(r.Started, r.Root, loc) + return consoleHeader(r, false, loc) +} + +// consoleHeader is the raw header of r, without the repository when hide leaves it out. +func consoleHeader(r *core.GitConsoleRecord, hide bool, loc *time.Location) string { + header := consoleHeaderPrefix(r.Started, r.Root, hide, loc) if len(r.Arguments) > 0 || len(r.TemporaryConfig) > 0 { header += " " + consoleCommand(r) } diff --git a/desktop/internal/workbench/gitconsole_settings.go b/desktop/internal/workbench/gitconsole_settings.go new file mode 100644 index 0000000000..e228171d6d --- /dev/null +++ b/desktop/internal/workbench/gitconsole_settings.go @@ -0,0 +1,30 @@ +package workbench + +import "github.com/1lck/Lithe-IDEA/desktop/internal/core" + +// This file applies the Git console switches of the Version Control settings (matrix id +// git-history). They start as IntelliJ IDEA's console. The query switches say which kinds of +// internal Git queries the console records, which Core then reports for the requests that +// follow; a kind left out is never recorded, so it takes none of the journal's records. The +// display switches say how the console draws the records it keeps, which the next paint asks +// Core to present them with. The commands the user runs, failed Git requests and unexpected +// exit codes are recorded whatever the switches say. + +// setGitConsolePreferences stores the Git console switches and applies them at once: the +// journal records the query kinds they show from the next request on, and the console draws +// its records with their display choices. +func (a *App) setGitConsolePreferences(preferences core.GitConsolePreferences) { + if a.settings.GitConsole == preferences { + return + } + a.settings.GitConsole = preferences + a.saveSettings() + a.gitConsole.SetPreferences(preferences) + a.invalidator.Invalidate() +} + +// openGitConsoleSettings opens the Version Control settings, where the console's switches are, +// from the console's toolbar. +func (a *App) openGitConsoleSettings() { + a.openSettingsPage(surfaceButton, settingsVersionControl) +} diff --git a/desktop/internal/workbench/gitconsole_test.go b/desktop/internal/workbench/gitconsole_test.go index df555877bc..033914507a 100644 --- a/desktop/internal/workbench/gitconsole_test.go +++ b/desktop/internal/workbench/gitconsole_test.go @@ -44,7 +44,7 @@ func (h *harness) openConsole(t *testing.T, dir string) { } // consolePresentedAll says v holds commands and Core's presentation of each, made for the -// record as it is and the search the rows were flattened for. +// record as it is and the search and display choices the rows were flattened for. func consolePresentedAll(v *consoleView) bool { if v.presenting || v.failed || len(v.snapshot.Records) == 0 { return false @@ -52,7 +52,7 @@ func consolePresentedAll(v *consoleView) bool { for i := range v.snapshot.Records { r := &v.snapshot.Records[i] p := v.presented[r.ID] - if p == nil || p.revision != r.Revision || p.search != v.searchFor { + if p == nil || p.revision != r.Revision || p.search != v.searchFor || p.display != v.display { return false } } @@ -93,6 +93,32 @@ func TestConsoleListsTheRecordedCommands(t *testing.T) { } } +// The display switches of the Version Control settings take effect at once: the console asks +// Core to present its records again with them, and they are kept with the settings. +func TestConsoleRedrawsWithTheDisplayChoices(t *testing.T) { + dir := newTestRepository(t) + h := newHarness(t, gitKernel{core.NewClient()}) + h.openConsole(t, dir) + repository := "[" + filepath.Base(dir) + "] git " + h.await("a recorded git command", func() bool { return h.showsWrapped(repository) }) + + h.app.setGitConsolePreferences(core.GitConsolePreferences{HideRepository: true}) + h.app.invalidator.Invalidate() + h.settle() + v := &h.app.consoleView + h.await("the commands presented without their repository", func() bool { + return v.display.HideRepository && consolePresentedAll(v) && !h.showsWrapped(repository) + }) + for _, row := range v.rows { + if row.id.part == consolePartHeader && strings.Contains(row.text, "["+filepath.Base(dir)+"]") { + t.Fatalf("header %q still names the repository", row.text) + } + } + if !h.app.settings.GitConsole.HideRepository || !h.app.gitConsole.Preferences().HideRepository { + t.Fatalf("the preferences were not kept: settings %+v, console %+v", h.app.settings.GitConsole, h.app.gitConsole.Preferences()) + } +} + func TestConsoleSearchesAndClears(t *testing.T) { dir := newTestRepository(t) h := newHarness(t, gitKernel{core.NewClient()}) @@ -545,23 +571,16 @@ func TestConsoleStepOpensTheFoldOfAQueryHit(t *testing.T) { } } -func TestConsoleHidesSuccessfulQueriesOnly(t *testing.T) { +// A query that failed is drawn failed with its output open, whatever the presentation of the +// queries around it folds. +func TestConsoleDrawsAFailedQueryOpen(t *testing.T) { text := &i18n.For(i18n.English).Console query, presented := consoleQuery() broken := query broken.ID, broken.ExitCode = "q2", 128 - fetch, fetched := consoleFetch() - v := consoleViewOf([]core.GitConsoleRecord{query, broken, fetch}, map[string]*consolePresented{query.ID: presented, fetch.ID: fetched}) + v := consoleViewOf([]core.GitConsoleRecord{query, broken}, map[string]*consolePresented{query.ID: presented}) - v.hideQueries = true v.flatten(text, time.UTC) - records := map[string]bool{} - for _, row := range v.rows { - records[row.id.record] = true - } - if records[query.ID] || !records[broken.ID] || !records[fetch.ID] { - t.Fatalf("hiding queries drew the records %v, want the failed query and the fetch only", records) - } for _, row := range v.rows { if row.id.record == broken.ID && row.id.part == consolePartHeader && row.tone != consoleToneError { t.Fatalf("the failed query's header is %+v, want it drawn failed", row) @@ -572,16 +591,94 @@ func TestConsoleHidesSuccessfulQueriesOnly(t *testing.T) { } } +// When the display choices fold single-line queries, Core gives the one line a query fold, +// which the console draws closed like any other. +func TestConsoleFoldsASingleLineQueryCoreFolds(t *testing.T) { + text := &i18n.For(i18n.English).Console + record, presented := consoleQuery() + record.Lines = record.Lines[:1] + presented.lines = 1 + presented.entry.Output = []core.GitConsoleOutputFragment{{ID: "output-0", Start: 0, End: 1, Kind: consoleFragmentQuery, Count: 1}} + v := consoleViewOf([]core.GitConsoleRecord{record}, map[string]*consolePresented{record.ID: presented}) + + v.flatten(text, time.UTC) + if len(v.rows) != 2 || v.rows[1].text != text.QueryOutput(1) || !v.rows[1].folded { + t.Fatalf("the rows are %+v, want the header and the closed fold of the one line", v.rows) + } + if consoleHasRow(v, "a1") { + t.Fatalf("the folded line is drawn: %+v", v.rows) + } +} + +// The display choice that hides the repository leaves the bracketed name and its space out of +// every header, presented or not, and the copy of the console keeps it. +func TestConsoleLeavesTheRepositoryOutWhenTheDisplayHidesIt(t *testing.T) { + text := &i18n.For(i18n.English).Console + record, presented := consoleQuery() + presented.entry.RepositoryLabel = "" + presented.display = core.GitConsoleDisplay{HideRepository: true} + raw := record + raw.ID = "q2" + v := consoleViewOf([]core.GitConsoleRecord{record, raw}, map[string]*consolePresented{record.ID: presented}) + v.display = core.GitConsoleDisplay{HideRepository: true} + + v.flatten(text, time.UTC) + const want = "09:08:07.006: git log --format=%H" + for _, row := range v.rows { + if row.id.part != consolePartHeader { + continue + } + if row.text != want { + t.Fatalf("header of %s is %q, want %q", row.id.record, row.text, want) + } + for _, span := range row.spans { + if span.kind == consoleSpanRepository { + t.Fatalf("header of %s has a repository span: %+v", row.id.record, row.spans) + } + } + if last := row.spans[len(row.spans)-1]; last.end != len(row.text) { + t.Fatalf("the spans of %q end at %d", row.text, last.end) + } + } + if copied := consoleCopyAll(v.snapshot.Records, text, time.UTC); !strings.Contains(copied, "[repo]") { + t.Fatalf("the copied console is %q, want the repositories", copied) + } +} + +// A notice the display choices no longer show is left out until Core presents the record +// with them again. +func TestConsoleDropsANoticeTheDisplayNoLongerShows(t *testing.T) { + text := &i18n.For(i18n.English).Console + record, presented := consoleQuery() + record.Lines = nil + presented.lines = 0 + presented.entry.Output = nil + presented.entry.Notice = core.GitConsoleNoticeNoOutput + presented.display = core.GitConsoleDisplay{ShowCompletedWithoutOutput: true} + v := consoleViewOf([]core.GitConsoleRecord{record}, map[string]*consolePresented{record.ID: presented}) + v.display = presented.display + + v.flatten(text, time.UTC) + if !consoleHasRow(v, text.NoOutput) { + t.Fatalf("the rows are %+v, want the notice", v.rows) + } + v.display = core.GitConsoleDisplay{} + v.flatten(text, time.UTC) + if consoleHasRow(v, text.NoOutput) { + t.Fatalf("the rows are %+v, want the notice left out", v.rows) + } +} + func TestConsoleDrawsTheProjectedCommandBeforeItIsPresented(t *testing.T) { record, _ := consoleQuery() - if got := consoleDrawnHeader(&record, time.UTC); got != "09:08:07.006: [repo] git log --format=%H" { + if got := consoleDrawnHeader(&record, false, time.UTC); got != "09:08:07.006: [repo] git log --format=%H" { t.Fatalf("consoleDrawnHeader() = %q, want the projected command", got) } if got := consoleRawHeader(&record, time.UTC); !strings.Contains(got, "core.quotepath=false") { t.Fatalf("consoleRawHeader() = %q, want the whole command for copying", got) } record.DisplayArguments = nil - if got, want := consoleDrawnHeader(&record, time.UTC), consoleRawHeader(&record, time.UTC); got != want { + if got, want := consoleDrawnHeader(&record, false, time.UTC), consoleRawHeader(&record, time.UTC); got != want { t.Fatalf("consoleDrawnHeader() without a projection = %q, want the raw header %q", got, want) } } diff --git a/desktop/internal/workbench/gitconsole_view.go b/desktop/internal/workbench/gitconsole_view.go index 5b683eb4e3..d2a5b16f29 100644 --- a/desktop/internal/workbench/gitconsole_view.go +++ b/desktop/internal/workbench/gitconsole_view.go @@ -81,8 +81,8 @@ func (a *App) drawConsoleToolbar(c ui.C) { } ui.Spacer(c) empty := len(v.snapshot.Records) == 0 - if a.gitIconButton(c, t.HideQueries, icons.EyeOff, v.hideQueries, false) { - c.After(a.toggleConsoleQueries) + if a.gitIconButton(c, t.Settings, icons.Settings, false, false) { + c.After(a.openGitConsoleSettings) } if a.gitIconButton(c, t.Wrap, icons.WrapText, v.wrap, false) { c.After(a.toggleConsoleWrap) diff --git a/desktop/internal/workbench/gitlog.go b/desktop/internal/workbench/gitlog.go index 5da58a251e..1bec045b6d 100644 --- a/desktop/internal/workbench/gitlog.go +++ b/desktop/internal/workbench/gitlog.go @@ -485,7 +485,9 @@ func (in logProjection) run(ctx context.Context, kernel Kernel, root string, dat files, ok := in.pathFiles[c.Hash] if !ok { var err error - if files, err = kernel.GitCommitFiles(ctx, root, c.Hash); err != nil { + // The path filter reads the files of commit after commit, which the + // console records only when it shows these reads. + if files, err = kernel.GitCommitFiles(core.WithQueryCategory(ctx, core.GitQueryLogPathFilter), root, c.Hash); err != nil { return core.Graph{}, in.pathFiles, err } in.pathFiles[c.Hash] = files diff --git a/desktop/internal/workbench/gitsync.go b/desktop/internal/workbench/gitsync.go index 8f6e161ec3..07b1376c90 100644 --- a/desktop/internal/workbench/gitsync.go +++ b/desktop/internal/workbench/gitsync.go @@ -156,7 +156,7 @@ func (a *App) runSyncAt(p *project, root, operation, label string, failed func(r done, err := work(ctx, kernel, root) readCtx, readCancel := context.WithTimeout(p.ctx, gitTimeout) defer readCancel() - status, statusErr := kernel.GitStatus(core.AutomaticRefresh(readCtx), p.root) + status, statusErr := kernel.GitStatus(core.WithQueryCategory(core.AutomaticRefresh(readCtx), core.GitQueryReload), p.root) return func(a *App) { s := &p.log.sync s.busy, s.cancel, s.relay, s.hasProgress = false, nil, nil, false diff --git a/desktop/internal/workbench/nested_refs.go b/desktop/internal/workbench/nested_refs.go index ae2c4f87db..fae9c99170 100644 --- a/desktop/internal/workbench/nested_refs.go +++ b/desktop/internal/workbench/nested_refs.go @@ -50,6 +50,9 @@ func (a *App) loadNestedReferences(p *project) { } ids := p.workspaceRepositoryIDs() a.background(p, gitTimeout, func(ctx context.Context) func(*App) { + // The references are read again whenever a repository changes, so the console records + // these reads only when it shows background branch reads. + ctx = core.WithQueryCategory(ctx, core.GitQueryReferences) out := make(map[string]nestedReferences, len(reads)) for _, repo := range reads { refs, err := kernel.GitReferences(ctx, repo.root) diff --git a/desktop/internal/workbench/settings.go b/desktop/internal/workbench/settings.go index 6ff05669e5..2b15e42118 100644 --- a/desktop/internal/workbench/settings.go +++ b/desktop/internal/workbench/settings.go @@ -187,6 +187,9 @@ func (a *App) newSettingsWindow() *settingswindow.Controller { SetHideParentReferences: func(value bool) { a.post(func(a *App) { a.setHideParentReferences(value) }) }, + SetGitConsole: func(value core.GitConsolePreferences) { + a.post(func(a *App) { a.setGitConsolePreferences(value) }) + }, SetDisableSemanticHighlight: func(value bool) { a.post(func(a *App) { a.setDisableSemanticHighlight(value) }) }, @@ -383,6 +386,9 @@ const ( settingsAI // settingsKeymap is the Keymap page, which the gear menu's Keymap item opens. settingsKeymap + // settingsVersionControl is the Version Control page, which the Git console's settings + // button opens. + settingsVersionControl ) func (a *App) openSettingsPage(surface actionSurface, page settingsPage) { @@ -415,6 +421,7 @@ func (a *App) openSettingsPageWith(surface actionSurface, page settingsPage, que HideProjectColors: a.settings.HideProjectColors, ProjectOpenDestination: a.settings.ProjectOpenDestination, HideGitGutter: a.settings.HideGitGutter, InlineGitBlame: a.settings.InlineGitBlame, HideChangeLists: a.settings.HideChangeLists, HideParentReferences: a.settings.HideParentReferences, + GitConsole: a.settings.GitConsole, DisableSemanticHighlight: a.settings.DisableSemanticHighlight, VimMode: a.settings.VimMode, DisableAutoSave: a.settings.DisableAutoSave, @@ -441,6 +448,8 @@ func (a *App) openSettingsPageWith(surface actionSurface, page settingsPage, que err = a.settingsWindow.OpenKeymap(a.application, current) case settingsAI: err = a.settingsWindow.OpenAI(a.application, current) + case settingsVersionControl: + err = a.settingsWindow.OpenVersionControl(a.application, current) default: err = a.settingsWindow.Open(a.application, current) } diff --git a/scripts/desktop/build-desktop-core.sh b/scripts/desktop/build-desktop-core.sh index 9b2a626ded..0031776ce6 100755 --- a/scripts/desktop/build-desktop-core.sh +++ b/scripts/desktop/build-desktop-core.sh @@ -27,8 +27,12 @@ native_path() { fi } -# Lithe-core-rust #63, squash-merged into main as ad148ec: a Unix process group whose members have -# all exited but are not reaped yet is killed without error, so disposing a language server or +# Lithe-core-rust feat/console-filters at 9fc6468, a merge of main ad148ec into the branch: +# gitExecution.consoleQueries names the query categories the Git console records and queryCategory +# names a read the command does not tell apart; git.consolePresentation takes display options, all +# false by default as in IDEA (#2025). Its main side is #63, squash-merged into main as ad148ec: +# a Unix process group whose members have all exited but are not reaped yet is killed without +# error, so disposing a language server or # closing an SSH session on macOS no longer reports EPERM (#2017). It is on top of #62, # squash-merged into main as b401949: a backslash or colon in a Unix file name stays part of the # name, so a folder named D:\logs is one level below the project root and the project tree rows @@ -128,7 +132,7 @@ PINNED_CORE_REPOSITORY="https://github.com/Lithe-IDEA/Lithe-core-rust.git" # the contract, plugin guides, reference and SDKs live only in shared/plugins; on top of #16 (reported Git queries folded in the console), # #15 (git.write cherryPick, revert and reset fields), #14 (word-level changed ranges of diff # rows), #13, #8, #7, #6 and #4. -PINNED_CORE_REVISION="ad148ecd0c2ae1159c39b721e38ce7afe50f7de2" +PINNED_CORE_REVISION="9fc64687c1b3acc76bc6bdfb2e5b5f209d77d431" PROFILE="debug" while [[ $# -gt 0 ]]; do case "$1" in diff --git a/shared/i18n/locales/en-US.json b/shared/i18n/locales/en-US.json index 4d89ffd1f1..53258e86bd 100644 --- a/shared/i18n/locales/en-US.json +++ b/shared/i18n/locales/en-US.json @@ -10716,6 +10716,36 @@ "desktop.git.settings.changeListsHelp": "Groups the Commit window's changes by local change list, with the bar that creates, renames and deletes lists. Turned off, every change is listed in one flat list and all staged changes commit together. The lists and their assignments are kept.", "desktop.git.settings.parentReferences": "Show Update Parent Repository References", "desktop.git.settings.parentReferencesHelp": "Shows the option that records the new commits of submodules in their parent repositories. Turned off, the option is hidden and every commit updates the parent references.", + "desktop.git.settings.console.omitted": "Git Console: Omitted Queries", + "desktop.git.settings.console.omittedHelp": "A kind that is on is not written to the Git console and takes none of the 200 records it keeps. The commands you run, failed Git requests and unexpected exit codes always show. The reads that refresh automatically as repositories change (status, gutter markers, inline blame and so on) are never recorded. Every switch starts as in IntelliJ IDEA: all omitted.", + "desktop.git.settings.console.references": "Omit Background Branch Reads", + "desktop.git.settings.console.referencesHelp": "The branches and references of each repository read again in the background after a repository changes, for the branch popup and the log's repository groups.", + "desktop.git.settings.console.reload": "Omit Reloads After Operations", + "desktop.git.settings.console.reloadHelp": "The status read again after a fetch, a branch update or a branch operation finishes, and the Diff tabs read again after an operation writes to the working tree or the index.", + "desktop.git.settings.console.diffRefresh": "Omit Diff Refreshes After Saving", + "desktop.git.settings.console.diffRefreshHelp": "The open Diff tabs of a file read again after the file is saved.", + "desktop.git.settings.console.diff": "Omit Diff Reads", + "desktop.git.settings.console.diffHelp": "The file and commit diffs, comparisons and stageable change blocks read when a Diff tab opens or changes.", + "desktop.git.settings.console.log": "Omit Log Browsing", + "desktop.git.settings.console.logHelp": "The reads of the Git log: its commit history, branches and tags, graph and commit details.", + "desktop.git.settings.console.logPathFilter": "Omit Log Path Filter Reads", + "desktop.git.settings.console.logPathFilterHelp": "The file lists read commit by commit when the log is filtered by path.", + "desktop.git.settings.console.annotate": "Omit Annotate and Line History", + "desktop.git.settings.console.annotateHelp": "The reads of annotate (blame) and line history. Inline blame refreshes automatically and is never recorded.", + "desktop.git.settings.console.panels": "Omit Lists and Panels", + "desktop.git.settings.console.panelsHelp": "The reads of lists and panels such as worktrees, stashes, remotes, pull requests, untracked directories and repository setup.", + "desktop.git.settings.console.checks": "Omit Checks Before Operations", + "desktop.git.settings.console.checksHelp": "The previews, preflight checks and plans before an operation, and the other queries an operation runs for itself, such as the status.", + "desktop.git.settings.console.display": "Git Console: Display", + "desktop.git.settings.console.displayHelp": "These change only how the Git console draws the commands it recorded, not which it records. Copying the whole console still gives the full commands and repositories. Every switch starts as in IntelliJ IDEA.", + "desktop.git.settings.console.foldSingleLine": "Show Only the Command Line of Queries", + "desktop.git.settings.console.foldSingleLineHelp": "A recorded query's output is folded whole, a single line too, and opens on a click. Turned off, only output of several lines is folded, as in IntelliJ IDEA.", + "desktop.git.settings.console.completedNotice": "Omit the “No Output” Notice", + "desktop.git.settings.console.completedNoticeHelp": "No notice is shown under a command that succeeded without output. IntelliJ IDEA shows none either.", + "desktop.git.settings.console.temporaryConfig": "Hide Temporary -c Configuration", + "desktop.git.settings.console.temporaryConfigHelp": "The command line no longer shows the -c settings Lithe passes for a single command, not even folded. The -c arguments the command itself names still show, folded.", + "desktop.git.settings.console.repository": "Omit Repository Name", + "desktop.git.settings.console.repositoryHelp": "Each command line starts with the time alone, without the [repository] name.", "desktop.nested.collapse": "Collapse Repository", "desktop.nested.expand": "Expand Repository", "desktop.git.repo.current": "Repository: {name}", @@ -11121,7 +11151,7 @@ "desktop.rebase.action.reword": "Reword", "desktop.rebase.action.edit": "Edit", "desktop.rebase.action.squash": "Squash", - "desktop.git.console.hideQueries": "Hide Read Commands", + "desktop.git.console.settings": "Git Console Settings", "desktop.git.console.queryOutput": "Read output, {count} lines", "desktop.git.console.expand": "Expand", "desktop.gitHistory.undoCommit": "Undo Commit…", diff --git a/shared/i18n/locales/zh-CN.json b/shared/i18n/locales/zh-CN.json index 0cfb3beffd..5132e6cfe7 100644 --- a/shared/i18n/locales/zh-CN.json +++ b/shared/i18n/locales/zh-CN.json @@ -10716,6 +10716,36 @@ "desktop.git.settings.changeListsHelp": "在提交窗口按本地更改列表分组变更,并显示创建、重命名和删除列表的工具栏。关闭后所有变更平铺显示,已暂存的变更可一起提交;列表及其分配会保留。", "desktop.git.settings.parentReferences": "显示更新父仓库引用", "desktop.git.settings.parentReferencesHelp": "显示是否在父仓库中记录子模块新提交的选项。关闭后隐藏该选项,每次提交都会更新父仓库引用。", + "desktop.git.settings.console.omitted": "Git 控制台:省略的查询", + "desktop.git.settings.console.omittedHelp": "打开的类别不写入 Git 控制台,也不占用控制台保留的 200 条记录。你执行的命令、失败的 Git 请求和意外的退出码始终显示。随仓库变化自动刷新的读取(状态、行号区标记、行尾 Blame 等)从不记录。初始状态与 IntelliJ IDEA 一致:全部省略。", + "desktop.git.settings.console.references": "省略后台分支读取", + "desktop.git.settings.console.referencesHelp": "仓库变化后在后台重新读取的各仓库分支与引用,供分支弹窗和日志的仓库分组使用。", + "desktop.git.settings.console.reload": "省略操作后的自动重新加载", + "desktop.git.settings.console.reloadHelp": "获取(Fetch)、更新分支或分支操作完成后重新读取的状态,以及操作写入工作区或暂存区后重新读取的差异标签页。", + "desktop.git.settings.console.diffRefresh": "省略保存后的差异刷新", + "desktop.git.settings.console.diffRefreshHelp": "保存文件后重新读取该文件已打开的差异标签页。", + "desktop.git.settings.console.diff": "省略差异读取", + "desktop.git.settings.console.diffHelp": "打开或切换差异标签页时读取的文件差异、提交差异、比较结果和可暂存的变更块。", + "desktop.git.settings.console.log": "省略日志浏览", + "desktop.git.settings.console.logHelp": "Git 日志的提交历史、分支与标签、提交图和提交详情的读取。", + "desktop.git.settings.console.logPathFilter": "省略日志路径筛选", + "desktop.git.settings.console.logPathFilterHelp": "按路径筛选日志时逐个读取的提交文件列表。", + "desktop.git.settings.console.annotate": "省略注解与行历史", + "desktop.git.settings.console.annotateHelp": "打开注解(Blame)或查看行历史时的读取。行尾 Blame 随文件自动刷新,从不记录。", + "desktop.git.settings.console.panels": "省略列表与面板", + "desktop.git.settings.console.panelsHelp": "工作树、储藏、远程仓库、拉取请求、未跟踪目录和仓库设置等列表与面板的读取。", + "desktop.git.settings.console.checks": "省略操作前检查", + "desktop.git.settings.console.checksHelp": "操作前的预览、预检和计划,以及操作为自己读取的状态等其他查询。", + "desktop.git.settings.console.display": "Git 控制台:显示", + "desktop.git.settings.console.displayHelp": "只改变已记录命令在 Git 控制台里的显示方式,不影响记录哪些命令。复制全部内容时仍包含完整命令和仓库。初始状态与 IntelliJ IDEA 一致。", + "desktop.git.settings.console.foldSingleLine": "查询只显示命令行", + "desktop.git.settings.console.foldSingleLineHelp": "已记录查询的输出全部折叠,只有一行也折叠,点击可展开。关闭时只折叠多行输出,与 IntelliJ IDEA 一致。", + "desktop.git.settings.console.completedNotice": "省略“执行成功,没有输出”提示", + "desktop.git.settings.console.completedNoticeHelp": "命令成功结束但没有输出时,不在命令下方显示这条提示。IntelliJ IDEA 也不显示。", + "desktop.git.settings.console.temporaryConfig": "完全隐藏临时 -c 配置", + "desktop.git.settings.console.temporaryConfigHelp": "命令行不再显示 Lithe 为单次命令传入的 -c 配置,折叠后的提示也不显示。命令本身写明的 -c 参数仍折叠显示。", + "desktop.git.settings.console.repository": "省略仓库名", + "desktop.git.settings.console.repositoryHelp": "命令行开头只显示时间,不显示 [仓库名]。", "desktop.nested.collapse": "折叠仓库", "desktop.nested.expand": "展开仓库", "desktop.git.repo.current": "仓库:{name}", @@ -11121,7 +11151,7 @@ "desktop.rebase.action.reword": "改写消息", "desktop.rebase.action.edit": "编辑", "desktop.rebase.action.squash": "压缩", - "desktop.git.console.hideQueries": "隐藏读取命令", + "desktop.git.console.settings": "Git 控制台设置", "desktop.git.console.queryOutput": "读取结果,共 {count} 行", "desktop.git.console.expand": "展开", "desktop.gitHistory.undoCommit": "撤销提交…", diff --git a/shared/i18n/messages.json b/shared/i18n/messages.json index 277eed7ccf..83f25659a1 100644 --- a/shared/i18n/messages.json +++ b/shared/i18n/messages.json @@ -9780,8 +9780,8 @@ } }, { - "id": "desktop.git.console.hideQueries", - "description": "Desktop Git console: toolbar toggle that hides the read-only Git queries that succeeded, leaving the commands workflows ran.", + "id": "desktop.git.console.settings", + "description": "Desktop Git console: toolbar button that opens the Version Control settings, which choose the queries the console records and how it draws them.", "platforms": [ "desktop" ] @@ -10182,6 +10182,216 @@ "desktop" ] }, + { + "id": "desktop.git.settings.console.omitted", + "description": "Version Control settings: title of the card that chooses which internal Git queries the Git console leaves out", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.omittedHelp", + "description": "Help of the Git console omitted-queries card: what an omitted kind means and what always shows", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.references", + "description": "Git console switch: leave out the branch and reference reads that run in the background", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.referencesHelp", + "description": "Help of the Git console switch that leaves out background branch reads", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.reload", + "description": "Git console switch: leave out the reads that reload state after an operation", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.reloadHelp", + "description": "Help of the Git console switch that leaves out reloads after operations", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.diffRefresh", + "description": "Git console switch: leave out the diff reads that follow saving a file", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.diffRefreshHelp", + "description": "Help of the Git console switch that leaves out diff refreshes after saving", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.diff", + "description": "Git console switch: leave out diff reads", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.diffHelp", + "description": "Help of the Git console switch that leaves out diff reads", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.log", + "description": "Git console switch: leave out the reads of the Git log", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.logHelp", + "description": "Help of the Git console switch that leaves out the reads of the Git log", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.logPathFilter", + "description": "Git console switch: leave out the reads the log's path filter runs", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.logPathFilterHelp", + "description": "Help of the Git console switch that leaves out the log's path filter reads", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.annotate", + "description": "Git console switch: leave out annotate (blame) and line history reads", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.annotateHelp", + "description": "Help of the Git console switch that leaves out annotate and line history reads", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.panels", + "description": "Git console switch: leave out the reads of Git lists and panels", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.panelsHelp", + "description": "Help of the Git console switch that leaves out the reads of Git lists and panels", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.checks", + "description": "Git console switch: leave out the queries an operation runs before and while it writes", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.checksHelp", + "description": "Help of the Git console switch that leaves out the checks of operations", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.display", + "description": "Version Control settings: title of the card that chooses how the Git console draws its records", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.displayHelp", + "description": "Help of the Git console display card", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.foldSingleLine", + "description": "Git console switch: show only the command line of a recorded query, folding even single-line output", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.foldSingleLineHelp", + "description": "Help of the Git console switch that folds single-line query output", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.completedNotice", + "description": "Git console switch: leave out the notice under a command that completed without output", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.completedNoticeHelp", + "description": "Help of the Git console switch that leaves out the no-output notice", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.temporaryConfig", + "description": "Git console switch: hide the temporary -c configuration Lithe passes to a command entirely", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.temporaryConfigHelp", + "description": "Help of the Git console switch that hides the temporary -c configuration", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.repository", + "description": "Git console switch: leave the repository name out of each command line", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.git.settings.console.repositoryHelp", + "description": "Help of the Git console switch that leaves the repository name out", + "platforms": [ + "desktop" + ] + }, { "id": "desktop.git.showAll", "description": "Desktop Git: ShowAll", diff --git a/shared/platform-feature-matrix/features/git-history.json b/shared/platform-feature-matrix/features/git-history.json index d6e4c8f023..25137f9570 100644 --- a/shared/platform-feature-matrix/features/git-history.json +++ b/shared/platform-feature-matrix/features/git-history.json @@ -18,7 +18,10 @@ "desktop/internal/workbench/gitconsole_test.go", "desktop/internal/core/gitconsole.go", "desktop/internal/core/gitconsole_test.go", - "desktop/internal/workbench/git_history_test.go" + "desktop/internal/workbench/git_history_test.go", + "desktop/internal/workbench/gitconsole_settings.go", + "desktop/internal/settingswindow/git_console_view.go", + "desktop/internal/settingswindow/version_control_view.go" ] }, "windows": { @@ -36,12 +39,15 @@ "desktop/internal/workbench/gitconsole_test.go", "desktop/internal/core/gitconsole.go", "desktop/internal/core/gitconsole_test.go", - "desktop/internal/workbench/git_history_test.go" + "desktop/internal/workbench/git_history_test.go", + "desktop/internal/workbench/gitconsole_settings.go", + "desktop/internal/settingswindow/git_console_view.go", + "desktop/internal/settingswindow/version_control_view.go" ] }, "owner": "Git", - "verification": "双端多仓库打开 Git Log:隐藏中间工作树后其余仓库颜色保持,切换工作区不得显示旧颜色;共享 Core fixture、跨页桥接和异步界面测试覆盖,完整原生界面及滚动性能验收 pending。 提交历史由 Core 保留作者时区及绝对时间,macOS 与 Windows 日期展示使用该时间;macOS 日期范围通过 Core 按绝对边界比较,系统日历计算夏令时边界。真实 Git、跨时区、重复小时、23/25 小时日及原生缓存回归覆盖;完整双平台界面人工验收仍 pending。 Windows cherry-pick 资格根据当前 HEAD 标识判断,不能把筛选结果第一行当作 HEAD;真实菜单回归覆盖其他分支首行可操作和非首行 HEAD 禁用。分页浏览提交历史、分支图谱和提交详情,确认日期、作者和文件列表一致;macOS Git Log 工具窗口标签悬停有反馈,点击窗口内外时选中标签背景在活动色与非活动色之间切换,标签文字保持相同颜色与常规字重,按下时不变暗;分支最新提交的图谱连线从提交圆点开始,不超出到圆点上方;在双端使用同一包含本地分支、远端引用、标签和合并提交的仓库,核对永久图布局、图头引用排序、合并边投影及跨越 30 行的紧凑长边;在本地分支新增提交后确认分支颜色保持稳定,且不会因共用屏幕泳道直接沿用父分支颜色。双端使用 Community 完整颜色 ID 及明暗主题 RGB 规则;macOS Git Log 不再显示单独的 Fetch/Compare/Checkout/Cherry-pick 横向操作栏,分支树与竖向工具栏分离;检查 Fetch、分支比较、分支右键 Checkout、提交右键 Cherry-pick 和 Fetch 设置仍可用,分支搜索可筛选嵌套路径,并隐藏无匹配项的分组、显示无结果提示;定位按钮滚动到当前所选分支的首个可见提交而不重新加载历史;Git Log 的分支和提交搜索框复用 全局唯一的 LitheSearchFieldStyle,对照 IDEA SearchFieldWithExtension,核对 13pt 常规提示文字、Islands 明暗控件底色与边框色、36pt 外框内的 30pt 可见高度、3pt 外层留白、1pt 常态内描边、向外扩 1pt 的 2pt 聚焦描边及 4pt 圆角;图标与文字间距为 2pt,输入框清除按钮复用已有 16pt IDEA SVG 和 20pt 按钮区域,按上游预留清除图标宽度,移除分支搜索框重复外层水平内边距,提交搜索框按 15 列字体度量和 150pt 最小宽度布局,Search 与 Database 搜索输入框使用相同共享样式;竖栏更新按钮采用 IDEA ExpUI 的明暗 update 图标,按钮与侧边栏图标悬停使用共用工具提示样式,提示的明暗背景、文字色、1pt 内描边、圆角及内边距对齐 IDEA HelpTooltip;隐藏与显示分支使用 IDEA ExpUI 的 chevronLeft/chevronRight 明暗图标;竖栏宽 36pt,展开态按钮为 22pt 且四周保留工具栏内边距,展开态分支树左边框复用与 Commit 标题下边框同源的 1pt 分隔线;收缩态竖栏常态复用展开态侧栏背景,展开与收缩保留提交图谱和详情视图实例、滚动状态及分支宽度,仅切换分支面板与分隔条的占用宽度,按钮占满竖栏,深色 hover 使用 Islands Dark 的 #FFFFFF17,浅色 hover 使用 ExpUI Gray12,不在右侧显示 Show Branches 浮层提示,图标在顶部留 8pt 并使用常规小字号文字;展开后恢复分支树宽度。 使用原生 NSHostingView 渲染验证共享 LitheSearchTextField 的占位文字在深浅主题均为 IDEA Component.infoForeground 对应的 #73767C、13pt 常规字重;空输入框单独绘制占位文字,避免 SwiftUI 原生 prompt 替换其颜色与字重,有内容时占位文字消失并保留原生编辑和主文字色。 Git Log 分支树按 IDEA Community Islands 普通密度核对 24pt 行高、无行间额外间距、13pt 常规文字、12pt 次要计数与 4/12pt 树边距;展开箭头、路径文件夹、普通分支、当前分支和标签使用上游 16pt 明暗 SVG,Local/Remote/Tags 标题不附加图标,当前分支不显示额外蓝色勾选;HEAD 与当前分支是两个互斥选中节点,点击分支、HEAD、清除筛选和切换仓库时核对选中状态;深浅主题核对树行焦点/失焦选中色及 hover,保留多仓库名称、圆点、数量和只读菜单,移除分支行仓库色条;Windows 多仓库分支树的仓库行与 macOS 一致,仓库行使用中性色文件夹图标,并只在图标与名称之间显示 8px 仓库色点,仓库名保持普通文字色,不出现整组着色卡片底色、左侧色条或彩色名称,截断名称通过共享工具提示显示全名,行悬停为箭头光标;确认搜索、分组折叠、右键操作、缓存行比较和滚动状态正常。 Git Log 分支树右侧分隔线与 Commit 标题下边框共用 LitheTheme.toolWindowBorder 和 1pt 厚度,深色为 #26282C、浅色为 #E9EAEE;悬停、拖动开始/移动/结束均保持同色,不高亮,保留原生调整光标、命中区域、拖动尺寸约束及提交宽度行为。 Git Log 中间栏按 IDEA Community FilterComponent、VcsLogGraphTable 和 PaintParameters 核对四个筛选器的 13pt 常规文字、4pt 内边距、16pt 箭头和仅文字悬停反馈;工具栏使用 16pt IDEA 明暗 SVG、22pt 点击区域和共享提示,保留动作及禁用条件;提交列表为 26pt 连续行,图谱尺寸同比缩放,作者与日期同为 13pt 主文字色,日期列按打包字体度量,核对深浅主题行 hover、焦点/失焦选中色及选中覆盖 hover,筛选、分页、箭头命中、上下键导航和右键操作不回归。 分支竖栏设置齿轮复用 LitheIconButtonStyle 的 22pt 点击区域、4pt 圆角和主题 hover/按下背景;点击使用 LitheContextMenuPresenter 的共享操作菜单背景、1pt 边框、行 hover 与键盘导航,保留 Fetch Options 对话框、Show Worktree Repositories 勾选和无工作树时禁用行为,点击外部或按 Esc 关闭菜单。 macOS 下拉菜单仅保留 Project 同源的一套全局共享样式,移除 settingsStyle 切换;Project、Git Log 设置、Terminal、欢迎页及右键子菜单统一使用 8pt 外框圆角、1pt 内描边、24pt 行高、12.5pt 文字、6pt 外留白和 8pt 行内边距,设置选择下拉框共享同一外框与尺寸定义; Git Log 顶部按 IDEA 恢复 Branch: 已选分支名称,保留 Branch 筛选、清除和菜单内勾选;Branch、User、Date、Paths 按 IDEA FilterComponent 保留 4pt 内边距、3pt 箭头间距和 13pt 常规文字,四项文字 hover 为白色且不增加底色。Date 使用共享菜单呈现器,Branch/User 的可搜索列表与分组子菜单使用共享 LitheDropdownRowStyle、24pt 行高和共享菜单外框,Paths 输入面板复用共享菜单外框及搜索输入框样式,保留搜索、选项选中、路径 Apply/Cancel/Clear 和时间范围计算。 Branch/User/Paths 原生弹窗锚点不参与鼠标命中,核对按钮与文字收到 hover/点击、菜单正确弹出且关闭后可再次打开;Date 保持共享菜单呈现器。共享下拉外框裁剪内部内容,明暗主题下 Branch/User 搜索条不能覆盖圆角;Paths 输入框复用共享输入样式并显示正确焦点边框,Clear/Cancel/Apply 复用共享次按钮/主按钮,保留路径应用和清除行为。Branch、User、Paths 的可搜索内容同样使用 LitheContextMenuPresenter 的透明无边框面板,去掉 NSPopover 系统外框,复用 Project 共享背景、1pt 边框和圆角;分组展开与搜索动态调整弹窗尺寸,Esc、点击外部和切换菜单正确关闭。选择分支后清除筛选,确认 Branch 恢复默认标题且关闭按钮消失;关闭按钮保留 16pt closeSmall 明暗 SVG、22pt hover 区域及 4pt 圆角。展开分支树左侧固定线、中间分隔线和右侧详情拖动线均使用 toolWindowBorder 的 1pt 边框,右侧 hover 与拖动不高亮。右侧详情展示图标使用 IDEA previewVertically 明暗 SVG,装饰开关使用 show 眼睛而非 hide 工具窗口减号;所有工具栏展示图标复用 22pt、4pt 圆角的共享 hover 背景,保留原动作与提示。深浅主题渲染核对背景和边框,保留可选图标、勾选、快捷键、禁用、子菜单和键盘导航。 Git Log 提交标题、作者和日期使用 Inter 13 Normal,引用标签 12pt;核对至少 26pt 的字体度量行高、含 leading 的整数基线、长标题与中文/emoji 截断,以及选中合并提交的文字颜色。 所选分支存在时 Log 标签显示 Log: 分支短名(包含 codex/ 路径),选择另一分支立即更新;清除分支筛选后恢复 Log,保留本地化标题、原始分支名和原标签选择/焦点行为。 macOS 标题起点按缩放图谱列距、图文间距和 2pt 文字内边距计算,为对齐参考截图至少预留六列,密集行继续扩宽,不改变图谱节点、连线和箭头命中;在 SwiftUI/AppKit 两条渲染路径核对未选中的合并提交标题、作者、日期统一使用合并灰色,选中后恢复普通文字色,合并判定仅依赖至少两个父节点。 Git Log 右侧文件树使用共享 24pt 行高、19pt 层级缩进、常规字重、文件类型图标和 IDEA FileStatus 文件名颜色,无逐行横线及工具栏重复总数;核对文件夹折叠、文件打开 diff、长名称 hover 展开与横向滚动,拖动宽度不重建行内容。提交详情使用 14pt 外边距、10pt 内间距、等宽 bold 标题、同段作者邮箱时间与引用标签,长内容可滚动;文件树/详情之间分隔线复用共享边框,hover/拖动不高亮。左侧分支树从 180pt 专用下限改为共享 30pt 下限,独立 36pt 竖栏保持原宽,窄树裁剪后可拖回原宽,收缩/展开不重建图谱。 图谱圆点、连线、箭头按 SimpleGraphCellPainter/ PaintUtil 的 FLOOR/ODD 物理像素规则对齐;在 1×/2× 原生位图验证圆点与线宽,在真实 NSHostingView 检查对齐后的上下斜向箭头尖端及内侧描边可导航,切换屏幕只重绘且绘制/命中坐标一致。 时间列复用 Inter 13 常规字体的等宽数字与固定 AM/PM 区域,按应用语言使用英文 12h AM/PM 或中文 24h 格式;核对午夜、正午、未知日期回退、行起点一致及切换语言后的原生日期缓存失效,列表两条渲染路径和提交详情使用相同格式。 连续上下拖动 Git Log,包含上方长 Diff:原生列表只调整可见区域,保持文档身份、滚动位置、Shift/Command 多选、焦点色、键盘与箭头导航、分页和辅助功能;收缩再恢复后列表宽高正确。GitGraphInteractionTests 使用 300 条提交、80 次原生尺寸变化和共享分隔条事件验证,局部新旧路径计时作为诊断,不代替目标工作区帧率验证。 共享分隔容器按已有宽高直接分配两个面板与分隔条的确定矩形,避免 HStack/VStack 最小及理想尺寸探测;splitPaneBounds 覆盖横纵方向、leading/trailing、折叠、子视图身份和有限尺寸,达到尺寸限制后的相同结果不重复写状态。 通过键盘或程序化切换焦点时 Git 标签活动态双向更新;挂载或重新显示 Git Log 不主动抢走编辑器焦点。 在包含展开分支树的 Git Log 中连续拖动外层高度和内部宽度:共享分隔器只在拖动开始/结束传播环境状态,嵌套容器继承祖先状态;拖动期间共享行悬停不更新、提示不登记几何锚点、右键覆盖层暂停,松开后恢复菜单和提示,行内容及滚动状态不重挂载。69 行原生分隔条事件回归检查覆盖层暂停/恢复及内容身份;未悬停控件在平时同样不登记提示锚点。用目标工作区 Time Profiler/Animation Hitches 对照 Terminal 核对持续更新成本及起止开销,split.drag 整次手势时长不能当作单帧延迟;本次仅前端共享交互装饰调整,不修改后端及默认详情高度行为。 中文输入法组词期间,即使绑定文本仍为空,共享 LitheSearchTextField 占位文字立即隐藏;取消组词或删空后恢复,确认中文后仍隐藏。原生 setMarkedText 回归覆盖明暗主题和两个输入框互不影响;保留焦点、键盘提交、搜索/过滤语义及占位字号颜色。原生背景观察视图卸载和移出窗口时清理通知,匹配当前窗口的字段编辑器及所属输入区域,不修改业务绑定。 四个筛选弹窗均以各自按钮左下角为定位锚点,Date 不依赖鼠标点击坐标;空间不足时限制在屏幕可见范围内。原生面板回归核对操作菜单/可搜索内容相同锚点下的左上角、无展开动画和 Esc 关闭回调。共享搜索字段在未聚焦时悬停也显示文本编辑光标,离开或禁用时恢复箭头。 Git Console 左侧六个现有动作使用 Community 原始 16pt 明暗 SVG;22pt 背景、竖向 2/1 按钮留白、5/7 外边距和默认箭头光标。核对查找、软换行、跟随、停止、清空、复制的原有动作与禁用状态,组件资源检查不替代完整应用验收。 按 Community CurrentBranchHighlighter 标出当前本地分支可达的所有父提交,包含合并父节点;深色 #1D2336、浅色 #EDF3FF,选中背景优先,仅已加载图谱可证明的祖先被标记,当前分支/HEAD 单独筛选时不重复染色。引用默认显示并按 GitRefManager/SimpleRefGroup 紧凑合组:本地与上游同提交显示 remote & branch,HEAD/本地/远端/标签使用官方黄/绿/紫/灰轮廓及叠层,标签单独存在时默认只显示图标;长名称按列宽和 22 字符下限缩写,原生可见区 tooltip 保留所有完整名称,滚动后按当前鼠标位置解析。明暗原生渲染检查颜色、宽度、选择优先级及完整名称;GitLogReferenceResizeTests 在真实 GitLogView 中加载 1000 个分支并拖动外层高度,检查可见右键覆盖层数量和挂载生命周期,计时仅作诊断。最新正式预览已进入该工作树,观察全部引用下的深色背景、叠层缩写标签和多次上边缘拖动后的布局恢复;用户随后在本机明确确认“现在不卡顿了”,本次报告的高度拖动卡顿通过用户实机验收;组件计时和混合工作区采样不用于推断唯一根因或量化通用帧延迟,其他主题/悬浮等视觉项继续按各自范围验收。 在 Windows Git Log 选中带多行正文的提交,确认右侧详情在标题下方完整显示正文(保留空行与缩进),复制提交信息和打开提交 Diff 时也包含正文;分支最新提交的图谱连线从提交圆点开始,不超出到圆点上方;在双端使用同一包含本地分支、远端引用、标签和合并提交的仓库,核对永久图布局、图头引用排序、合并边投影及跨越 30 行的紧凑长边;在本地分支新增提交后确认分支颜色保持稳定,且不会因共用屏幕泳道直接沿用父分支颜色。双端使用 Community 完整颜色 ID 及明暗主题 RGB 规则。 读取提交正文期间切换仓库、重新打开另一提交或关闭面板,确认迟到结果不会打开旧 Diff 或覆盖新请求的加载状态。 Windows 另验证:单击提交后编辑区预览该提交第一个文件的 diff;单击或双击 Commit files 中的文件只显示该文件的 diff(不含提交说明,也不显示文件列表),并复用同一个预览标签;Commit files 树中过长的文件或目录名不折叠为省略号,区域随最宽行横向展开,可通过横向滚动条或触控板侧滑左右滑动查看完整名称(与源代码管理变更树一致);Git Log 刚打开、尚未点击提交时不会自动打开 diff;日期列将有 UTC 偏移的提交转换到本机时区后显示相对时间(刚刚、N 分钟前、今天/昨天);英文绝对日期和时间通过 Windows 原生接口遵循系统短日期/时间及用户自定义格式,中文使用中文地区格式,未知偏移仍显示绝对日期;验证美式月/日/年、英式日/月/年、自定义分隔符、12/24 小时制、跨时区相对时间和迟到原生结果保护,真实 WebView2 产品验收为 pending;鼠标移入行时刷新相对时间;作者/日期列可在行内列边缘拖动调整宽度并在重启后保留。 非连续多选提交修改同一路径时,预览保留每个提交的 diff 和提交标识,可通过文件导航分别查看;延迟请求返回前取消选择、隐藏 Git Log、切换仓库或卸载工具窗,确认旧请求不会重新打开或激活预览标签。 Windows 端提交历史仅通过 Git Log 工具窗浏览:源代码管理侧栏入口已更名为 Commit 面板,其 History 标签已移除,面板固定显示变更列表与提交区。命令面板中的 Git: Show History 入口同步移除。 Windows Commit Files 单文件预览使用独立页面:上下箭头导航差异,下箭头在当前文件最后一处后继续进入下一文件并在比较完成后定位第一处差异,整个文件集合末尾禁用且不循环;图片、二进制和无文本差异文件也允许下箭头继续,比较未就绪时禁用以防连续点击跳过文件。左右箭头直接切换当前比较集合的上一文件/下一文件;标签使用 IDEA 的 Repository Diff: 文件名并跟随导航更新,不附加提交 hash。Jump to Source 按最后聚焦侧的补丁位置打开预览所属仓库的文件,重命名使用新路径、删除行映射邻近保留行、已删除文件禁用源跳转;模型更新期间禁用差异动作。保留并排/统一视图、空白显示、Monaco 查找、图片和二进制呈现,普通全量提交比较仍使用多文件页面。真实 WebView2 内核及源文件打开还需目标产品运行验收。 Windows 单文件历史 Diff 外观验证:并排视图使用独立外侧 12px 滚动轨道、8px 滑块和概览,通常的统一视图保留 Monaco 原生 Diff 组件,整文件新增使用真实新行流的独立只读控件,深浅主题检查常态/悬停/拖动色、圆角及边框;实际拖动任一并排滑块后按差异边界同步对应行且模型身份保持。工具栏使用现有 Button,核对 40px 高度和 22px 图标按钮;保留用户字体与字号,默认行距按 14px 字号对应 22px 并随缩放,自定义行距不覆盖。词级高亮开关复用现有 Monaco 装饰能力,关闭只隐藏字符差异、保留整行差异,切换文件保留词级和空白开关。旧/新版本标题显示真实第一父提交、范围基线/目标或非连续提交各自身份,根提交旧侧为空树,重命名显示旧/新路径;短 hash 和截断路径的 tooltip 保留全文。并排标题列宽由独立布局所有者更新 CSS,拖动分隔条时标题跟随且不重建模型;统一视图标题纵向排列。以上浏览器真实组件验证不替代目标 WebView2 产品验收。 Windows 单文件 Diff 滚动条回归:两侧横纵滚动条默认显示,鼠标移到工具栏后仍可见,不依赖悬停;差异概览不绘制重复的宽矩形视口指示,并排由独立外侧轨道负责点击、拖动和滚轮,统一视图保留原生委托。明暗主题、并排/统一视图及长文本双向溢出下检查唯一可见滑块、并排横向同像素偏移同步、纵向对应行同步和模型身份。 历史 Diff 两侧滚动轨道与代码编辑器概览画布背景透明,鼠标不悬停时滑块仍显示;关闭代码编辑器重复概览通道,但保留 Diff 专用差异色条。横向轨道不额外增加内容高度,检查代码能显示在滑块后、底部内容与滚动位置正确,拖动命中保留,并排两侧横向同像素偏移同步、纵向对应行同步。 Windows 并排单文件 Diff 使用两个独立只读 Monaco 代码控件,取消 DiffEditor 的补空白对齐。左右横向滚动按同一像素偏移双向同步,较短侧由 Monaco 钳制到真实内容边界且不反向拉回主动侧;纵向原生代码区、外侧滑块拖动/点击、轨道键盘、滚轮和查找以视口三分之一处为锚点,按 Git 差异块起止边界同步对应行并保留行内偏移,短侧在不等长块内钳制、共同上下文恢复对齐。同步有重入与微小方向保护;双模型替换、布局、字体配置和显式上下导航期间暂停同步。新增旧侧/删除新侧画横跨可见代码区的双像素零行边界,修改区画上下单像素边界;两列行号背景为直边,曲线只在两列之间弯曲,实际偏移改变端点形状。检查文件开头/末尾零行、三态、明暗主题和窄列,代码不补空白、不扩展横向范围;连接面覆盖两列历史行号背景,行号选择和源映射正确。左右外侧各显示透明常显纵向滑块与增删改概览,横向保留原生滚动条,滚动范围截止真实最长代码行。验证深浅主题、折叠展开、Ctrl/Cmd+F 搜索折叠文本、词级开关和预算、统一视图及跨文件首处定位、连续拖动和窄窗口非负尺寸。高频帧二分筛选可见差异,缓存像素边界及概览,不扫描全文、不更新 React;卸载和迟到语言准备清理所有帧、监听、观察器、拖动、两个编辑器和模型。浏览器生产组件验证使用平台记录器,真实 WebView2 产品验收仍为 pending。 外侧轨道预留独立空间,不显示代码;左轨道距面板边缘、右轨道距代码视口各留 4px 间隙,窄列随可用宽度缩减,右侧文字与轨道不重叠;并排和统一预览关闭缩进及括号引导线,保留语法颜色;中央行号缩小边距和曲线间隙,整数布局边界及上下半像素描边消除与代码区的垂直接缝。滚轮在代码、行号和轨道统一加快到两倍,拖动仍映射各侧真实进度,纵向同步对应行;方向键按用户行高移动。有词级结果时修改正文底色按 40% 修改色与 60% 页面背景混合,完整修改色突出替换词的两侧,纯新增和纯删除词分别使用完整增删色,语法前景色和文字透明度保持;关闭词级或超限保留整行底色。验证三态与开头末尾、双向对应行同步、明暗主题、轨道无遮挡、宽窄字体布局和预算回退。 单文件并排及统一视图隐藏补丁 @@ 标题,但保留真正以 @@ 开头的源码、行 ID、源行映射和原始补丁;默认多文件与暂存投影不变。Islands Dark 继承 Darcula 背景,Islands Light 使用 Light 方案,独立差异轨道标记与连接、代码边界共用对应差异背景色。底部保留五个用户实际行高的 padding,模型不增加假行;从任意侧滚到底部验证共同末行对齐与五行留白,字号/行距变化同步更新。 Windows 单文件 Diff 首次打开、左右切文件和同路径新比较均在模型/比较准备完成后定位第一处改动;定位只消费一次,调整词级、空白、字号或主题保持用户当前位置。统一视图的原生 Monaco 增删行、字符与行号栏使用该预览相同的 Islands 背景变量,移除默认字符边框;新增整文件应为深色 #294436 或浅色 #BEE6BE,删除为 #484A4A 或 #D6D6D6,语法前景色不变且其他编辑器主题不被覆盖。 整文件新增采用单流只读代码控件,隐藏不存在的旧侧与连接带,新增背景覆盖行号、代码和底部留白,避免空旧模型的灰色删除行及外圈;新增仅显示新版本、删除仅显示旧版本的一组 hash 与路径。并排两侧及新增单流轨道的增删改标记与对应内容背景共用颜色;原生统一预览关闭 renderIndicators,历史行号旁不显示 +/-。这组新增显示修复按用户要求延后运行验证,提交或 PR 前核对新增文件、普通修改、删除、深浅主题、查找、源跳转与底部留白。 Windows Git Log 单文件和 Commit 文件 Diff 的词级高亮、显示空白符、统一/并排切换均在左侧,最右侧统计当前文件差异,区分无差异/单数/复数;Commit 勾选、部分包含、取消及刷新后 included 数同步变化,全部包含仍显示数量;加载、切换文件及图片/二进制不显示文本差异统计。核对中英文、明暗主题、窄窗口和按钮选中/禁用状态。 Windows 单文件 Diff 上箭头在首处继续进入上一文件最后一处,下箭头在末处进入下一文件首处,集合首尾不循环、加载中禁用;Commit 文件列表随跨文件导航更新选中行并展开祖先、滚动到可见位置,保留编辑器焦点和 include 状态;同文件刷新、历史 Diff、无关仓库和迟到读取不扰动列表。 Windows Git Log 右下角 Commit files 列表同样跟随 Diff 的上一/下一文件导航:选中行移到当前文件,被折叠的父目录自动展开,行滚动到可见位置;预览属于其他提交或范围时不改变选中,点击行不会改变横向滚动。 Windows Git Log 筛选后基于完整已加载历史投影可见祖先:隐藏中间提交以虚线连接,直接父子保持实线,无关分支不误连;合并路径去重并保留永久颜色,未加载父提交经隐藏节点传播,分页补齐后解除缺失标记;清空筛选恢复原图,核对文本、作者、分支名称三种范围、空结果与选择行为。算法和真实表格组件回归通过不代替 WebView2 原生验收,原生验证保持 pending。 Windows 未筛选图与筛选图共用上下半边打印元素:普通浏览的跨行泳道换列必须在共同中点连续连接,合流入边保留各自颜色到提交圆点;核对原始 IDEA 200 条历史输出的列号、方向、终止和颜色身份;截图/原生交互验收仍为 pending,组件输出和 golden 对照不代替 WebView2 验收。 Windows Git Graph 外观:核对明暗主题真实 IDEA RGB、实心节点、直线与筛选虚线、终止箭头及至少六列标题预留;默认 26px 行高,用户字号变化时虚拟行与 SVG 同步扩高;在 100%/125%/150%/200%/300% 缩放及跨屏 DPI 变化下核对奇数物理像素和相邻半边连续性,普通视口调整不重建历史图。箭头能跳到已加载且可见的父/子提交,未加载父节点没有可点击目标;浏览器生产组件验证不代替目标 WebView2 运行验收,原生验证保持 pending。 Windows 历史排序和图导航:在交错分支仓库核对首批/分页/回退及全引用上下文均使用日期顺序,切换分支保持可证明的永久颜色和基础顺序;上下文最多 5000 条,覆盖不完整或哈希重复时保留可见页并回退。核对 upstream/backup 等非 origin 远程引用分类及本地含斜杠分支;背景上下文不阻塞 50 条可见页,分页不取消或重读上下文,切仓库/刷新/卸载取消旧操作且关闭迟到游标。长边开关展开/收起不改变提交、筛选、选择和游标;验证 30/1000 行边界。点击或用 Enter/空格激活上下箭头,选择并滚动到屏幕外端点,挂载后键盘焦点随目标;不误选源行、不误开源行 Diff,保持普通选择/多选/双击/右键和原预览入口。明暗主题及 1x/1.25x/2x 检查箭头尖端与命中范围,真实 WebView2 运行验收保持 pending。 图谱颜色必须跟随 ThemeRegistry 根 data-theme-type 切换;不依赖页面存在 dark class。复用真实 Lithe 明暗主题检查同一已挂载节点与连线的颜色变化、布局不因主题重算,结合主题回归和浏览器真实切换验证。 Windows 分页稳定性:选中顶部提交后向下滚动触发连续分页,确认滚动位置不跳回已选提交,Commit Files 不清空或重读,已选文件及树折叠保持;更新引用、背景上下文和相同 hash 的元数据同样不导航。定位分支头通过独立请求仍能定位已经选中的头提交一次;新选择或切仓库仍读取新文件并丢弃旧结果。组件回归与真实浏览器虚拟列表/IntersectionObserver 验证通过,目标 WebView2 实机验收保持 pending。 Windows Git Log 标题栏不显示固定 Read-only/只读文字,关闭按钮保持靠右,刷新、设置及隐藏操作正常。 Windows Git Log 单个提交右键 New Tag… 输入非空且无空白的标签名,创建指向右键提交完整 hash 的轻量标签并刷新引用和历史;取消不写入,失败保留名称可重试,双击/Enter 不重复创建,多选和写操作期间禁用。仓库或工作区切换关闭旧弹窗,旧请求迟到不得刷新或关闭新弹窗。 Windows 提交区域点击后上下箭头更新可见提交选择和详情,焦点不随虚拟行移除而丢失;筛选、首尾边界、Home/End、Shift 范围选择和 Enter 正常,菜单与输入框保留自己的方向键。 Windows Git Log 鼠标或上下键选择提交后,异步 Diff 自动定位第一处改动但保持提交列表键盘焦点;并排与统一预览均不调用初始 focus。双击/Enter 打开完整 Diff、主动差异跳转及跨文件导航仍进入编辑器。 Windows Git Log 提交右键 New Tag 使用与 Tags 节点同源的 TagIcon(沿用现有标签轮廓图案),核对 16px 图标、菜单对齐和禁用反馈;新补图标的实机视觉确认待完成。 Windows 提交列表菜单键和 Shift+F10 打开当前选中提交的真实菜单;关闭后列表继续上下键导航,菜单操作仍针对所选提交。New Tag 在 tag.gpgSign=true 下生成轻量标签,不运行签名器或消息编辑器,不修改配置。 Windows 提交行高亮和紧凑引用组:在全部引用和其他分支视图核对当前检出分支全父祖先背景,当前分支/HEAD 视图关闭重复高亮;合并提交的说明、作者、日期未选中时弱化、选中后恢复,选中背景优先于分支并区分列表/文件树/窗口焦点。核对明暗主题固定基准色、真实 upstream 合并名称、游离 HEAD、每种最多两个叠加图标、仅标签图标和完整汇总悬停/无障碍提示。宽窄列及字号变化时按至少 22 字符缩略规则布局,只有一个视口尺寸观察器,列拖动不逐行读取宽度,卸载清理;分页不丢滚动/选择,成功后不重读 Commit Files;文件读取失败时 Commit Files 面板显示重试入口,重新选择同一提交或刷新历史也会重试一次,长边导航和新建标签原入口保持。组件与浏览器验证通过,目标 WebView2 实机验收 pending。 Windows Git Log 分支树和提交列表的普通滚轮使用 Community Windows 默认 200ms 和 (0.5,0.505,0.5,1) 曲线;连续同向累积、反向从当前位置重启。核对两处列表的中间帧、Shift 横向滚动、分页保持、顶底边界、键盘定位和滑块拖动取消惯性、关闭工具窗清理帧以及减少动态效果偏好。确定性动画与 DOM 回归通过,真实 WebView2 设备手感验收保持 pending。 Windows graph 标题不再固定预留六列:建议宽度取可见图边数的加权均值与标准差,最多以六列作统一基线,每行按节点与斜边中点扩展,密集行不把其他简单行扩成最大列宽。验证单线/少分支、罕见密集合并、超过六列、筛选、长边开关、引用标签可用宽度及字号/DPI,保持图谱颜色/连线/导航不变。 Windows Git Log 的 Commit Files 文件树沿用 IDEA Windows 默认 200ms 滚轮动画;在文件行、竖向/横向滚动条区域连续滚动、反向及 Shift 横向滚动,确认共用真实视口的动画目标,长文件名保持自然宽度;按下滚动条取消未完成惯性,减少动态效果时直接滚动,切换提交及卸载不残留帧。其它 ScrollArea 默认行为不变。真实 WebView2 交互验收 pending。 Windows Git Log 右键 New Tag 打开弹窗后焦点直接位于标签名输入框,无需点击即可输入,Enter 提交、Esc 关闭。 macOS Git Log 空状态:在非 Git 项目检查明暗主题、窄窗口和键盘操作:13pt 常规文字按 IDEA 左对齐,整组位于内容区上方三分之一处;显示 To track changes to code、GitHub/GitLab 官网链接、Initialize Git repository…、Open Git Settings 和带原始 ContextHelp 图标的 Version control integration(打开 Git 官方文档)。初始化仍先确认,不自动暂存或提交;设置打开既有 Git 设置。未提交仓库、无匹配提交、加载失败及重试保持原动作,所有空状态操作采用文字按钮。 非 Git 项目空状态隐藏 Log/Worktrees/Console 标签、添加按钮、分支树与动作条、筛选/搜索工具栏及提交详情,提示占满工具窗内容区;GitHub、GitLab、初始化、设置及帮助链接悬停仅给当前文字加主题强调色下划线并显示手形,离开后恢复;初始化或切换至真实仓库后恢复原有三栏布局,真实仓库无匹配提交仍保留筛选入口。 空状态字体与间距对照 Community c7f91397:按钮标签显式使用 Inter 13pt Regular;行首破折号按首行基线对齐,21pt 行高加 2pt 间隔,帮助图标间隔 2pt;灰字与链接分别沿 Component.infoForeground 和 Islands Link.activeForeground 核对明暗主题,悬停下划线仍使用当前主题强调色。 macOS 右侧提交详情的分支标签按可见区域懒加载,全部引用仍可滚动查看。重开面板初始化时恢复匹配的提交图和分支树,第一次布局即可读取全部已缓存数据,不依赖出现后的异步任务回填。重开面板复用未变化的分支树,单仓库不重复构建分组副本,多仓库活动根复用已有三类行;引用、仓库、工作树开关、折叠状态改变后拒绝旧树。原生绘制与无障碍日期文本复用缓存,语言改变后刷新。 macOS 大量引用首屏:同提交放置 1,500 个本地分支和 1,500 个远程引用,核对真实 upstream 优先、同名远程自然排序回退、完整提示及每类图标上限;反复切换 Terminal/Git Log,数据版本相同应复用已准备图,改变分支/筛选/图显示选项后不得复用旧图。运行 GitGraphInteractionTests 的 manyReferenceGroups 和 presentationCache;组件耗时仅诊断,整机卡顿以相同数据实测为准。 macOS Git Log 及终端按需创建后由工作台持有实际原生宿主;隐藏再重开及移动停靠位置复用控件。运行 GitLogReferenceResizeTests,验证同一工作台隐藏再重开时,固定原生表面上的提交文档和滚动容器对象身份不变,恢复可见性且尺寸正确,工作台释放后宿主释放;核对语言、主题、搜索、分支操作和终端会话。 Git Log 与终端同时停靠时,从外层横向和纵向分隔条中央及向面板两侧偏移 4pt 处,经窗口发送按下、拖动、松开,确认完整 10pt 命中区仍能提交尺寸、宿主身份保持,面板中央正常交互。;macOS 保留宿主圆角需在明暗主题、侧栏顶部与移动后、项目辉光改变、渐变开关及背景图切换时,与原工作台树四角像素一致(WorkbenchSurfaceBackgroundTests.retainedPaneCornersMatchWorkbenchGradient)。 Windows HEAD 按 Community HeadNodePainter 核对外圈、背景间隔和中心实点:26px 行高、100% 缩放时三层直径为 13/9/5px,125%/150%/200%/300% 按物理像素 FLOOR/ODD 对齐;深浅主题、悬停、当前分支及活动/非活动选择均透出真实行底色,穿过 HEAD 的连线不侵入间隔。普通节点及分叉、筛选、长边展开保持;同边双向终止元素键唯一。目标 WebView2 实机验收保持 pending。 macOS 在明暗主题的窄 Git Log 工具栏中选择长用户名、分支和路径,确认名称与选中值以同一行尾部截断,文字不重叠,清除按钮和重新选择仍可用。 macOS Git Log 接近底部时自动追加较早提交,正常浏览不出现必须点击的加载更多按钮;单一页面最多发起一次边缘请求,追加保留选择和原生视口偏移。无新提交或缺失后续游标时停止并释放游标;失败暂停自动读取,显式刷新重开历史而不重用失败游标。运行 GitGraphInteractionTests.automaticHistoryPaging 与 GitModuleTests.continuousHistoryPagingStopsOnDuplicatePagesAndRefreshesAfterFailure,真实大仓库连续滚动和 Windows WebView2 验收仍 pending。 macOS 深层历史后台刷新:文件状态变化不重开首批,元数据刷新保留已加载窗口和后续页占位,未变结果不重建提交图;外部新提交按可见 hash 与行内偏移保持原生视口,按新行位移补齐旧尾部,保留尾部选择。当前仓库引用只读取一次,多仓库仍独立加载。后台刷新打断自动分页后,即使历史相同也能继续读取新游标;失败仍暂停自动重试。运行 GitModuleTests.backgroundRefreshRetainsDeepHistoryAndSelectionWhileExternalCommitsStillAppear、引用聚合回归及 GitGraphInteractionTests.backgroundHistoryRefreshAnchorsVisibleCommitInsteadOfSelectedCommit/automaticHistoryPaging;真实大仓库长时间滚动仍待用户验收,原生进程 cleanup 超时未独立复现,不将减少重复查询等同于修复所有进程失败。 macOS #1542:显示保留的 Git Log/终端时,横纵分隔条中央及两侧偏移 4pt 仍经窗口事件完成拖动且只提交一次,宿主身份不变;根命中查询深度始终为 1,面板内部连续 100 次查询不产生额外根查询,鼠标移动不回查祖先 SwiftUI。验证禁用、收起(含嵌套分隔条)、恢复、卸载、跨窗口与登记表隔离、实时移动/裁剪、隐藏/透明和弱引用释放;保留宿主内部仍正常命中,外层边缘优先。Diff 两端收起后在普通与保留侧栏下均能经窗口拖回,不触发外层拖动。运行 GitLogReferenceResizeTests、SplitHandleHitTestTests 和 DiffScrollSynchronizationTests;旧实现先出现嵌套命中断言失败,新实现通过。较新 macOS 原生组件回归不替代 macOS 13 Intel 原报告崩溃验收,目标环境验证保持 pending。 历史菜单资格使用 Core 读取真实 HEAD 与第一父链;在筛选/分页、旁支首行、跳选、切换仓库、HEAD 变化和关闭菜单时验证动作状态及迟到结果隔离;两端原生界面验收 pending。 Git 控制台执行日志的记录状态(completed / unconfirmed)、单条与总量保留预算和脱敏由 Core 事件携带,两端不再各自归约或二次脱敏,单条输出预算统一为 32768 字符。 历史刷新的窗口大小、头部新增后保留旧尾部的延伸读取、翻页合并去重与上限、选中提交/焦点/范围锚点的保留统一由 Core `git.historyWindow` 决定;Windows 监听刷新不再把深层历史缩回第一页,选中与锚点在仍已加载时保留,像素级滚动锚点仍留在视图。滚动到深处后触发后台刷新,确认窗口深度、选中行与 Shift 范围起点不变;两端原生界面验收 pending。 Viva 改动文件折叠:运行 scripts/desktop/desktop-go.sh test ./internal/workbench -run 'TestLogChangedFiles|TestGroupLogFiles' -count=1;实机选择一个改动多个目录的提交,收起与展开文件夹、用方向键和双击操作,切换提交后文件夹重新展开。 Viva 提交详情改动文件横向滚动:运行 scripts/desktop/desktop-go.sh test ./internal/workbench -run TestLogChangedFiles -count=1 和 scripts/desktop/desktop-go.sh test ./internal/hscroll -count=1;实机选中路径很长的提交,确认改动文件列表可左右滚动、底部显示细滚动条,暗色主题下删除的文件显示为红色而不是灰色。 Viva 提交详情的哈希、作者、邮箱和日期不截断:运行 scripts/desktop/desktop-go.sh test ./internal/workbench -run TestLogCommitDetails -count=1;实机把详情面板拖到最窄,选中作者名和邮箱都很长的提交,确认放不下时换行显示,超长邮箱独占一行并在行内折行,没有省略号。 Viva 控制台:执行提交、推送或工作树清理等写操作后打开 Git 工具窗口的“控制台”页,核对命令、输出、退出码、搜索跳转、折叠、复制和清空;desktop/internal/workbench/gitconsole_test.go 覆盖列表、搜索和清空。 Viva 行标识回归 TestLogCommitKeysKeepFooterInRangeAndSeparate:加载页脚使用独立的合法标识 0,提交从 1 编号,重新排序保留提交标识;升级后的 List/Tree 范围检查不得因分页页脚崩溃。原生三平台长历史分页验收仍 pending。 Git 控制台 TestConsoleRowKeysReserveValidMissingRowIdentity 覆盖列表刷新期间缺失行的保留标识,不与真实行冲突。", - "notes": "Viva 的 Git Log 已有提交列表、分支面板和提交详情,其余能力尚未逐项盘点。提交详情的改动文件按文件夹分组,文件夹先于文件,使用与项目树相同的 desktop/internal/treelist 折叠列表:单击箭头、双击文件夹或方向键展开收起,Enter 打开文件差异;切换提交后所有文件夹重新展开。2026-11-14 起分组由 Core git.changedFileGroups 计算(#1814):目录按段比较、文件按项目树的自然顺序排列(v0.1.4 在 v0.1.12 前),顶层目录为空字符串;Stash 和 Shelf 页同样适用。legacy 是迁移前基线,不代表当前实现。 Viva 提交详情的改动文件列表与项目树共用 desktop/internal/hscroll 横向滚动:列宽取最长一行,滚轮或触控板横向滚动,底部细滚动条显示位置;删除的文件在明暗主题下都用红色(Deleted),不再用暗色下发灰的次要文字色,Commit 工具窗口同样适用。 Git 工具窗口新增“控制台”页:按时间列出 Core 记录的 Git 写操作命令、输出和退出码,支持搜索与上下跳转命中、折叠长输出、复制命令或输出和清空;只读命令不进入记录(Core 只记录 git.write 类命令)。", + "verification": "双端多仓库打开 Git Log:隐藏中间工作树后其余仓库颜色保持,切换工作区不得显示旧颜色;共享 Core fixture、跨页桥接和异步界面测试覆盖,完整原生界面及滚动性能验收 pending。 提交历史由 Core 保留作者时区及绝对时间,macOS 与 Windows 日期展示使用该时间;macOS 日期范围通过 Core 按绝对边界比较,系统日历计算夏令时边界。真实 Git、跨时区、重复小时、23/25 小时日及原生缓存回归覆盖;完整双平台界面人工验收仍 pending。 Windows cherry-pick 资格根据当前 HEAD 标识判断,不能把筛选结果第一行当作 HEAD;真实菜单回归覆盖其他分支首行可操作和非首行 HEAD 禁用。分页浏览提交历史、分支图谱和提交详情,确认日期、作者和文件列表一致;macOS Git Log 工具窗口标签悬停有反馈,点击窗口内外时选中标签背景在活动色与非活动色之间切换,标签文字保持相同颜色与常规字重,按下时不变暗;分支最新提交的图谱连线从提交圆点开始,不超出到圆点上方;在双端使用同一包含本地分支、远端引用、标签和合并提交的仓库,核对永久图布局、图头引用排序、合并边投影及跨越 30 行的紧凑长边;在本地分支新增提交后确认分支颜色保持稳定,且不会因共用屏幕泳道直接沿用父分支颜色。双端使用 Community 完整颜色 ID 及明暗主题 RGB 规则;macOS Git Log 不再显示单独的 Fetch/Compare/Checkout/Cherry-pick 横向操作栏,分支树与竖向工具栏分离;检查 Fetch、分支比较、分支右键 Checkout、提交右键 Cherry-pick 和 Fetch 设置仍可用,分支搜索可筛选嵌套路径,并隐藏无匹配项的分组、显示无结果提示;定位按钮滚动到当前所选分支的首个可见提交而不重新加载历史;Git Log 的分支和提交搜索框复用 全局唯一的 LitheSearchFieldStyle,对照 IDEA SearchFieldWithExtension,核对 13pt 常规提示文字、Islands 明暗控件底色与边框色、36pt 外框内的 30pt 可见高度、3pt 外层留白、1pt 常态内描边、向外扩 1pt 的 2pt 聚焦描边及 4pt 圆角;图标与文字间距为 2pt,输入框清除按钮复用已有 16pt IDEA SVG 和 20pt 按钮区域,按上游预留清除图标宽度,移除分支搜索框重复外层水平内边距,提交搜索框按 15 列字体度量和 150pt 最小宽度布局,Search 与 Database 搜索输入框使用相同共享样式;竖栏更新按钮采用 IDEA ExpUI 的明暗 update 图标,按钮与侧边栏图标悬停使用共用工具提示样式,提示的明暗背景、文字色、1pt 内描边、圆角及内边距对齐 IDEA HelpTooltip;隐藏与显示分支使用 IDEA ExpUI 的 chevronLeft/chevronRight 明暗图标;竖栏宽 36pt,展开态按钮为 22pt 且四周保留工具栏内边距,展开态分支树左边框复用与 Commit 标题下边框同源的 1pt 分隔线;收缩态竖栏常态复用展开态侧栏背景,展开与收缩保留提交图谱和详情视图实例、滚动状态及分支宽度,仅切换分支面板与分隔条的占用宽度,按钮占满竖栏,深色 hover 使用 Islands Dark 的 #FFFFFF17,浅色 hover 使用 ExpUI Gray12,不在右侧显示 Show Branches 浮层提示,图标在顶部留 8pt 并使用常规小字号文字;展开后恢复分支树宽度。 使用原生 NSHostingView 渲染验证共享 LitheSearchTextField 的占位文字在深浅主题均为 IDEA Component.infoForeground 对应的 #73767C、13pt 常规字重;空输入框单独绘制占位文字,避免 SwiftUI 原生 prompt 替换其颜色与字重,有内容时占位文字消失并保留原生编辑和主文字色。 Git Log 分支树按 IDEA Community Islands 普通密度核对 24pt 行高、无行间额外间距、13pt 常规文字、12pt 次要计数与 4/12pt 树边距;展开箭头、路径文件夹、普通分支、当前分支和标签使用上游 16pt 明暗 SVG,Local/Remote/Tags 标题不附加图标,当前分支不显示额外蓝色勾选;HEAD 与当前分支是两个互斥选中节点,点击分支、HEAD、清除筛选和切换仓库时核对选中状态;深浅主题核对树行焦点/失焦选中色及 hover,保留多仓库名称、圆点、数量和只读菜单,移除分支行仓库色条;Windows 多仓库分支树的仓库行与 macOS 一致,仓库行使用中性色文件夹图标,并只在图标与名称之间显示 8px 仓库色点,仓库名保持普通文字色,不出现整组着色卡片底色、左侧色条或彩色名称,截断名称通过共享工具提示显示全名,行悬停为箭头光标;确认搜索、分组折叠、右键操作、缓存行比较和滚动状态正常。 Git Log 分支树右侧分隔线与 Commit 标题下边框共用 LitheTheme.toolWindowBorder 和 1pt 厚度,深色为 #26282C、浅色为 #E9EAEE;悬停、拖动开始/移动/结束均保持同色,不高亮,保留原生调整光标、命中区域、拖动尺寸约束及提交宽度行为。 Git Log 中间栏按 IDEA Community FilterComponent、VcsLogGraphTable 和 PaintParameters 核对四个筛选器的 13pt 常规文字、4pt 内边距、16pt 箭头和仅文字悬停反馈;工具栏使用 16pt IDEA 明暗 SVG、22pt 点击区域和共享提示,保留动作及禁用条件;提交列表为 26pt 连续行,图谱尺寸同比缩放,作者与日期同为 13pt 主文字色,日期列按打包字体度量,核对深浅主题行 hover、焦点/失焦选中色及选中覆盖 hover,筛选、分页、箭头命中、上下键导航和右键操作不回归。 分支竖栏设置齿轮复用 LitheIconButtonStyle 的 22pt 点击区域、4pt 圆角和主题 hover/按下背景;点击使用 LitheContextMenuPresenter 的共享操作菜单背景、1pt 边框、行 hover 与键盘导航,保留 Fetch Options 对话框、Show Worktree Repositories 勾选和无工作树时禁用行为,点击外部或按 Esc 关闭菜单。 macOS 下拉菜单仅保留 Project 同源的一套全局共享样式,移除 settingsStyle 切换;Project、Git Log 设置、Terminal、欢迎页及右键子菜单统一使用 8pt 外框圆角、1pt 内描边、24pt 行高、12.5pt 文字、6pt 外留白和 8pt 行内边距,设置选择下拉框共享同一外框与尺寸定义; Git Log 顶部按 IDEA 恢复 Branch: 已选分支名称,保留 Branch 筛选、清除和菜单内勾选;Branch、User、Date、Paths 按 IDEA FilterComponent 保留 4pt 内边距、3pt 箭头间距和 13pt 常规文字,四项文字 hover 为白色且不增加底色。Date 使用共享菜单呈现器,Branch/User 的可搜索列表与分组子菜单使用共享 LitheDropdownRowStyle、24pt 行高和共享菜单外框,Paths 输入面板复用共享菜单外框及搜索输入框样式,保留搜索、选项选中、路径 Apply/Cancel/Clear 和时间范围计算。 Branch/User/Paths 原生弹窗锚点不参与鼠标命中,核对按钮与文字收到 hover/点击、菜单正确弹出且关闭后可再次打开;Date 保持共享菜单呈现器。共享下拉外框裁剪内部内容,明暗主题下 Branch/User 搜索条不能覆盖圆角;Paths 输入框复用共享输入样式并显示正确焦点边框,Clear/Cancel/Apply 复用共享次按钮/主按钮,保留路径应用和清除行为。Branch、User、Paths 的可搜索内容同样使用 LitheContextMenuPresenter 的透明无边框面板,去掉 NSPopover 系统外框,复用 Project 共享背景、1pt 边框和圆角;分组展开与搜索动态调整弹窗尺寸,Esc、点击外部和切换菜单正确关闭。选择分支后清除筛选,确认 Branch 恢复默认标题且关闭按钮消失;关闭按钮保留 16pt closeSmall 明暗 SVG、22pt hover 区域及 4pt 圆角。展开分支树左侧固定线、中间分隔线和右侧详情拖动线均使用 toolWindowBorder 的 1pt 边框,右侧 hover 与拖动不高亮。右侧详情展示图标使用 IDEA previewVertically 明暗 SVG,装饰开关使用 show 眼睛而非 hide 工具窗口减号;所有工具栏展示图标复用 22pt、4pt 圆角的共享 hover 背景,保留原动作与提示。深浅主题渲染核对背景和边框,保留可选图标、勾选、快捷键、禁用、子菜单和键盘导航。 Git Log 提交标题、作者和日期使用 Inter 13 Normal,引用标签 12pt;核对至少 26pt 的字体度量行高、含 leading 的整数基线、长标题与中文/emoji 截断,以及选中合并提交的文字颜色。 所选分支存在时 Log 标签显示 Log: 分支短名(包含 codex/ 路径),选择另一分支立即更新;清除分支筛选后恢复 Log,保留本地化标题、原始分支名和原标签选择/焦点行为。 macOS 标题起点按缩放图谱列距、图文间距和 2pt 文字内边距计算,为对齐参考截图至少预留六列,密集行继续扩宽,不改变图谱节点、连线和箭头命中;在 SwiftUI/AppKit 两条渲染路径核对未选中的合并提交标题、作者、日期统一使用合并灰色,选中后恢复普通文字色,合并判定仅依赖至少两个父节点。 Git Log 右侧文件树使用共享 24pt 行高、19pt 层级缩进、常规字重、文件类型图标和 IDEA FileStatus 文件名颜色,无逐行横线及工具栏重复总数;核对文件夹折叠、文件打开 diff、长名称 hover 展开与横向滚动,拖动宽度不重建行内容。提交详情使用 14pt 外边距、10pt 内间距、等宽 bold 标题、同段作者邮箱时间与引用标签,长内容可滚动;文件树/详情之间分隔线复用共享边框,hover/拖动不高亮。左侧分支树从 180pt 专用下限改为共享 30pt 下限,独立 36pt 竖栏保持原宽,窄树裁剪后可拖回原宽,收缩/展开不重建图谱。 图谱圆点、连线、箭头按 SimpleGraphCellPainter/ PaintUtil 的 FLOOR/ODD 物理像素规则对齐;在 1×/2× 原生位图验证圆点与线宽,在真实 NSHostingView 检查对齐后的上下斜向箭头尖端及内侧描边可导航,切换屏幕只重绘且绘制/命中坐标一致。 时间列复用 Inter 13 常规字体的等宽数字与固定 AM/PM 区域,按应用语言使用英文 12h AM/PM 或中文 24h 格式;核对午夜、正午、未知日期回退、行起点一致及切换语言后的原生日期缓存失效,列表两条渲染路径和提交详情使用相同格式。 连续上下拖动 Git Log,包含上方长 Diff:原生列表只调整可见区域,保持文档身份、滚动位置、Shift/Command 多选、焦点色、键盘与箭头导航、分页和辅助功能;收缩再恢复后列表宽高正确。GitGraphInteractionTests 使用 300 条提交、80 次原生尺寸变化和共享分隔条事件验证,局部新旧路径计时作为诊断,不代替目标工作区帧率验证。 共享分隔容器按已有宽高直接分配两个面板与分隔条的确定矩形,避免 HStack/VStack 最小及理想尺寸探测;splitPaneBounds 覆盖横纵方向、leading/trailing、折叠、子视图身份和有限尺寸,达到尺寸限制后的相同结果不重复写状态。 通过键盘或程序化切换焦点时 Git 标签活动态双向更新;挂载或重新显示 Git Log 不主动抢走编辑器焦点。 在包含展开分支树的 Git Log 中连续拖动外层高度和内部宽度:共享分隔器只在拖动开始/结束传播环境状态,嵌套容器继承祖先状态;拖动期间共享行悬停不更新、提示不登记几何锚点、右键覆盖层暂停,松开后恢复菜单和提示,行内容及滚动状态不重挂载。69 行原生分隔条事件回归检查覆盖层暂停/恢复及内容身份;未悬停控件在平时同样不登记提示锚点。用目标工作区 Time Profiler/Animation Hitches 对照 Terminal 核对持续更新成本及起止开销,split.drag 整次手势时长不能当作单帧延迟;本次仅前端共享交互装饰调整,不修改后端及默认详情高度行为。 中文输入法组词期间,即使绑定文本仍为空,共享 LitheSearchTextField 占位文字立即隐藏;取消组词或删空后恢复,确认中文后仍隐藏。原生 setMarkedText 回归覆盖明暗主题和两个输入框互不影响;保留焦点、键盘提交、搜索/过滤语义及占位字号颜色。原生背景观察视图卸载和移出窗口时清理通知,匹配当前窗口的字段编辑器及所属输入区域,不修改业务绑定。 四个筛选弹窗均以各自按钮左下角为定位锚点,Date 不依赖鼠标点击坐标;空间不足时限制在屏幕可见范围内。原生面板回归核对操作菜单/可搜索内容相同锚点下的左上角、无展开动画和 Esc 关闭回调。共享搜索字段在未聚焦时悬停也显示文本编辑光标,离开或禁用时恢复箭头。 Git Console 左侧六个现有动作使用 Community 原始 16pt 明暗 SVG;22pt 背景、竖向 2/1 按钮留白、5/7 外边距和默认箭头光标。核对查找、软换行、跟随、停止、清空、复制的原有动作与禁用状态,组件资源检查不替代完整应用验收。 按 Community CurrentBranchHighlighter 标出当前本地分支可达的所有父提交,包含合并父节点;深色 #1D2336、浅色 #EDF3FF,选中背景优先,仅已加载图谱可证明的祖先被标记,当前分支/HEAD 单独筛选时不重复染色。引用默认显示并按 GitRefManager/SimpleRefGroup 紧凑合组:本地与上游同提交显示 remote & branch,HEAD/本地/远端/标签使用官方黄/绿/紫/灰轮廓及叠层,标签单独存在时默认只显示图标;长名称按列宽和 22 字符下限缩写,原生可见区 tooltip 保留所有完整名称,滚动后按当前鼠标位置解析。明暗原生渲染检查颜色、宽度、选择优先级及完整名称;GitLogReferenceResizeTests 在真实 GitLogView 中加载 1000 个分支并拖动外层高度,检查可见右键覆盖层数量和挂载生命周期,计时仅作诊断。最新正式预览已进入该工作树,观察全部引用下的深色背景、叠层缩写标签和多次上边缘拖动后的布局恢复;用户随后在本机明确确认“现在不卡顿了”,本次报告的高度拖动卡顿通过用户实机验收;组件计时和混合工作区采样不用于推断唯一根因或量化通用帧延迟,其他主题/悬浮等视觉项继续按各自范围验收。 在 Windows Git Log 选中带多行正文的提交,确认右侧详情在标题下方完整显示正文(保留空行与缩进),复制提交信息和打开提交 Diff 时也包含正文;分支最新提交的图谱连线从提交圆点开始,不超出到圆点上方;在双端使用同一包含本地分支、远端引用、标签和合并提交的仓库,核对永久图布局、图头引用排序、合并边投影及跨越 30 行的紧凑长边;在本地分支新增提交后确认分支颜色保持稳定,且不会因共用屏幕泳道直接沿用父分支颜色。双端使用 Community 完整颜色 ID 及明暗主题 RGB 规则。 读取提交正文期间切换仓库、重新打开另一提交或关闭面板,确认迟到结果不会打开旧 Diff 或覆盖新请求的加载状态。 Windows 另验证:单击提交后编辑区预览该提交第一个文件的 diff;单击或双击 Commit files 中的文件只显示该文件的 diff(不含提交说明,也不显示文件列表),并复用同一个预览标签;Commit files 树中过长的文件或目录名不折叠为省略号,区域随最宽行横向展开,可通过横向滚动条或触控板侧滑左右滑动查看完整名称(与源代码管理变更树一致);Git Log 刚打开、尚未点击提交时不会自动打开 diff;日期列将有 UTC 偏移的提交转换到本机时区后显示相对时间(刚刚、N 分钟前、今天/昨天);英文绝对日期和时间通过 Windows 原生接口遵循系统短日期/时间及用户自定义格式,中文使用中文地区格式,未知偏移仍显示绝对日期;验证美式月/日/年、英式日/月/年、自定义分隔符、12/24 小时制、跨时区相对时间和迟到原生结果保护,真实 WebView2 产品验收为 pending;鼠标移入行时刷新相对时间;作者/日期列可在行内列边缘拖动调整宽度并在重启后保留。 非连续多选提交修改同一路径时,预览保留每个提交的 diff 和提交标识,可通过文件导航分别查看;延迟请求返回前取消选择、隐藏 Git Log、切换仓库或卸载工具窗,确认旧请求不会重新打开或激活预览标签。 Windows 端提交历史仅通过 Git Log 工具窗浏览:源代码管理侧栏入口已更名为 Commit 面板,其 History 标签已移除,面板固定显示变更列表与提交区。命令面板中的 Git: Show History 入口同步移除。 Windows Commit Files 单文件预览使用独立页面:上下箭头导航差异,下箭头在当前文件最后一处后继续进入下一文件并在比较完成后定位第一处差异,整个文件集合末尾禁用且不循环;图片、二进制和无文本差异文件也允许下箭头继续,比较未就绪时禁用以防连续点击跳过文件。左右箭头直接切换当前比较集合的上一文件/下一文件;标签使用 IDEA 的 Repository Diff: 文件名并跟随导航更新,不附加提交 hash。Jump to Source 按最后聚焦侧的补丁位置打开预览所属仓库的文件,重命名使用新路径、删除行映射邻近保留行、已删除文件禁用源跳转;模型更新期间禁用差异动作。保留并排/统一视图、空白显示、Monaco 查找、图片和二进制呈现,普通全量提交比较仍使用多文件页面。真实 WebView2 内核及源文件打开还需目标产品运行验收。 Windows 单文件历史 Diff 外观验证:并排视图使用独立外侧 12px 滚动轨道、8px 滑块和概览,通常的统一视图保留 Monaco 原生 Diff 组件,整文件新增使用真实新行流的独立只读控件,深浅主题检查常态/悬停/拖动色、圆角及边框;实际拖动任一并排滑块后按差异边界同步对应行且模型身份保持。工具栏使用现有 Button,核对 40px 高度和 22px 图标按钮;保留用户字体与字号,默认行距按 14px 字号对应 22px 并随缩放,自定义行距不覆盖。词级高亮开关复用现有 Monaco 装饰能力,关闭只隐藏字符差异、保留整行差异,切换文件保留词级和空白开关。旧/新版本标题显示真实第一父提交、范围基线/目标或非连续提交各自身份,根提交旧侧为空树,重命名显示旧/新路径;短 hash 和截断路径的 tooltip 保留全文。并排标题列宽由独立布局所有者更新 CSS,拖动分隔条时标题跟随且不重建模型;统一视图标题纵向排列。以上浏览器真实组件验证不替代目标 WebView2 产品验收。 Windows 单文件 Diff 滚动条回归:两侧横纵滚动条默认显示,鼠标移到工具栏后仍可见,不依赖悬停;差异概览不绘制重复的宽矩形视口指示,并排由独立外侧轨道负责点击、拖动和滚轮,统一视图保留原生委托。明暗主题、并排/统一视图及长文本双向溢出下检查唯一可见滑块、并排横向同像素偏移同步、纵向对应行同步和模型身份。 历史 Diff 两侧滚动轨道与代码编辑器概览画布背景透明,鼠标不悬停时滑块仍显示;关闭代码编辑器重复概览通道,但保留 Diff 专用差异色条。横向轨道不额外增加内容高度,检查代码能显示在滑块后、底部内容与滚动位置正确,拖动命中保留,并排两侧横向同像素偏移同步、纵向对应行同步。 Windows 并排单文件 Diff 使用两个独立只读 Monaco 代码控件,取消 DiffEditor 的补空白对齐。左右横向滚动按同一像素偏移双向同步,较短侧由 Monaco 钳制到真实内容边界且不反向拉回主动侧;纵向原生代码区、外侧滑块拖动/点击、轨道键盘、滚轮和查找以视口三分之一处为锚点,按 Git 差异块起止边界同步对应行并保留行内偏移,短侧在不等长块内钳制、共同上下文恢复对齐。同步有重入与微小方向保护;双模型替换、布局、字体配置和显式上下导航期间暂停同步。新增旧侧/删除新侧画横跨可见代码区的双像素零行边界,修改区画上下单像素边界;两列行号背景为直边,曲线只在两列之间弯曲,实际偏移改变端点形状。检查文件开头/末尾零行、三态、明暗主题和窄列,代码不补空白、不扩展横向范围;连接面覆盖两列历史行号背景,行号选择和源映射正确。左右外侧各显示透明常显纵向滑块与增删改概览,横向保留原生滚动条,滚动范围截止真实最长代码行。验证深浅主题、折叠展开、Ctrl/Cmd+F 搜索折叠文本、词级开关和预算、统一视图及跨文件首处定位、连续拖动和窄窗口非负尺寸。高频帧二分筛选可见差异,缓存像素边界及概览,不扫描全文、不更新 React;卸载和迟到语言准备清理所有帧、监听、观察器、拖动、两个编辑器和模型。浏览器生产组件验证使用平台记录器,真实 WebView2 产品验收仍为 pending。 外侧轨道预留独立空间,不显示代码;左轨道距面板边缘、右轨道距代码视口各留 4px 间隙,窄列随可用宽度缩减,右侧文字与轨道不重叠;并排和统一预览关闭缩进及括号引导线,保留语法颜色;中央行号缩小边距和曲线间隙,整数布局边界及上下半像素描边消除与代码区的垂直接缝。滚轮在代码、行号和轨道统一加快到两倍,拖动仍映射各侧真实进度,纵向同步对应行;方向键按用户行高移动。有词级结果时修改正文底色按 40% 修改色与 60% 页面背景混合,完整修改色突出替换词的两侧,纯新增和纯删除词分别使用完整增删色,语法前景色和文字透明度保持;关闭词级或超限保留整行底色。验证三态与开头末尾、双向对应行同步、明暗主题、轨道无遮挡、宽窄字体布局和预算回退。 单文件并排及统一视图隐藏补丁 @@ 标题,但保留真正以 @@ 开头的源码、行 ID、源行映射和原始补丁;默认多文件与暂存投影不变。Islands Dark 继承 Darcula 背景,Islands Light 使用 Light 方案,独立差异轨道标记与连接、代码边界共用对应差异背景色。底部保留五个用户实际行高的 padding,模型不增加假行;从任意侧滚到底部验证共同末行对齐与五行留白,字号/行距变化同步更新。 Windows 单文件 Diff 首次打开、左右切文件和同路径新比较均在模型/比较准备完成后定位第一处改动;定位只消费一次,调整词级、空白、字号或主题保持用户当前位置。统一视图的原生 Monaco 增删行、字符与行号栏使用该预览相同的 Islands 背景变量,移除默认字符边框;新增整文件应为深色 #294436 或浅色 #BEE6BE,删除为 #484A4A 或 #D6D6D6,语法前景色不变且其他编辑器主题不被覆盖。 整文件新增采用单流只读代码控件,隐藏不存在的旧侧与连接带,新增背景覆盖行号、代码和底部留白,避免空旧模型的灰色删除行及外圈;新增仅显示新版本、删除仅显示旧版本的一组 hash 与路径。并排两侧及新增单流轨道的增删改标记与对应内容背景共用颜色;原生统一预览关闭 renderIndicators,历史行号旁不显示 +/-。这组新增显示修复按用户要求延后运行验证,提交或 PR 前核对新增文件、普通修改、删除、深浅主题、查找、源跳转与底部留白。 Windows Git Log 单文件和 Commit 文件 Diff 的词级高亮、显示空白符、统一/并排切换均在左侧,最右侧统计当前文件差异,区分无差异/单数/复数;Commit 勾选、部分包含、取消及刷新后 included 数同步变化,全部包含仍显示数量;加载、切换文件及图片/二进制不显示文本差异统计。核对中英文、明暗主题、窄窗口和按钮选中/禁用状态。 Windows 单文件 Diff 上箭头在首处继续进入上一文件最后一处,下箭头在末处进入下一文件首处,集合首尾不循环、加载中禁用;Commit 文件列表随跨文件导航更新选中行并展开祖先、滚动到可见位置,保留编辑器焦点和 include 状态;同文件刷新、历史 Diff、无关仓库和迟到读取不扰动列表。 Windows Git Log 右下角 Commit files 列表同样跟随 Diff 的上一/下一文件导航:选中行移到当前文件,被折叠的父目录自动展开,行滚动到可见位置;预览属于其他提交或范围时不改变选中,点击行不会改变横向滚动。 Windows Git Log 筛选后基于完整已加载历史投影可见祖先:隐藏中间提交以虚线连接,直接父子保持实线,无关分支不误连;合并路径去重并保留永久颜色,未加载父提交经隐藏节点传播,分页补齐后解除缺失标记;清空筛选恢复原图,核对文本、作者、分支名称三种范围、空结果与选择行为。算法和真实表格组件回归通过不代替 WebView2 原生验收,原生验证保持 pending。 Windows 未筛选图与筛选图共用上下半边打印元素:普通浏览的跨行泳道换列必须在共同中点连续连接,合流入边保留各自颜色到提交圆点;核对原始 IDEA 200 条历史输出的列号、方向、终止和颜色身份;截图/原生交互验收仍为 pending,组件输出和 golden 对照不代替 WebView2 验收。 Windows Git Graph 外观:核对明暗主题真实 IDEA RGB、实心节点、直线与筛选虚线、终止箭头及至少六列标题预留;默认 26px 行高,用户字号变化时虚拟行与 SVG 同步扩高;在 100%/125%/150%/200%/300% 缩放及跨屏 DPI 变化下核对奇数物理像素和相邻半边连续性,普通视口调整不重建历史图。箭头能跳到已加载且可见的父/子提交,未加载父节点没有可点击目标;浏览器生产组件验证不代替目标 WebView2 运行验收,原生验证保持 pending。 Windows 历史排序和图导航:在交错分支仓库核对首批/分页/回退及全引用上下文均使用日期顺序,切换分支保持可证明的永久颜色和基础顺序;上下文最多 5000 条,覆盖不完整或哈希重复时保留可见页并回退。核对 upstream/backup 等非 origin 远程引用分类及本地含斜杠分支;背景上下文不阻塞 50 条可见页,分页不取消或重读上下文,切仓库/刷新/卸载取消旧操作且关闭迟到游标。长边开关展开/收起不改变提交、筛选、选择和游标;验证 30/1000 行边界。点击或用 Enter/空格激活上下箭头,选择并滚动到屏幕外端点,挂载后键盘焦点随目标;不误选源行、不误开源行 Diff,保持普通选择/多选/双击/右键和原预览入口。明暗主题及 1x/1.25x/2x 检查箭头尖端与命中范围,真实 WebView2 运行验收保持 pending。 图谱颜色必须跟随 ThemeRegistry 根 data-theme-type 切换;不依赖页面存在 dark class。复用真实 Lithe 明暗主题检查同一已挂载节点与连线的颜色变化、布局不因主题重算,结合主题回归和浏览器真实切换验证。 Windows 分页稳定性:选中顶部提交后向下滚动触发连续分页,确认滚动位置不跳回已选提交,Commit Files 不清空或重读,已选文件及树折叠保持;更新引用、背景上下文和相同 hash 的元数据同样不导航。定位分支头通过独立请求仍能定位已经选中的头提交一次;新选择或切仓库仍读取新文件并丢弃旧结果。组件回归与真实浏览器虚拟列表/IntersectionObserver 验证通过,目标 WebView2 实机验收保持 pending。 Windows Git Log 标题栏不显示固定 Read-only/只读文字,关闭按钮保持靠右,刷新、设置及隐藏操作正常。 Windows Git Log 单个提交右键 New Tag… 输入非空且无空白的标签名,创建指向右键提交完整 hash 的轻量标签并刷新引用和历史;取消不写入,失败保留名称可重试,双击/Enter 不重复创建,多选和写操作期间禁用。仓库或工作区切换关闭旧弹窗,旧请求迟到不得刷新或关闭新弹窗。 Windows 提交区域点击后上下箭头更新可见提交选择和详情,焦点不随虚拟行移除而丢失;筛选、首尾边界、Home/End、Shift 范围选择和 Enter 正常,菜单与输入框保留自己的方向键。 Windows Git Log 鼠标或上下键选择提交后,异步 Diff 自动定位第一处改动但保持提交列表键盘焦点;并排与统一预览均不调用初始 focus。双击/Enter 打开完整 Diff、主动差异跳转及跨文件导航仍进入编辑器。 Windows Git Log 提交右键 New Tag 使用与 Tags 节点同源的 TagIcon(沿用现有标签轮廓图案),核对 16px 图标、菜单对齐和禁用反馈;新补图标的实机视觉确认待完成。 Windows 提交列表菜单键和 Shift+F10 打开当前选中提交的真实菜单;关闭后列表继续上下键导航,菜单操作仍针对所选提交。New Tag 在 tag.gpgSign=true 下生成轻量标签,不运行签名器或消息编辑器,不修改配置。 Windows 提交行高亮和紧凑引用组:在全部引用和其他分支视图核对当前检出分支全父祖先背景,当前分支/HEAD 视图关闭重复高亮;合并提交的说明、作者、日期未选中时弱化、选中后恢复,选中背景优先于分支并区分列表/文件树/窗口焦点。核对明暗主题固定基准色、真实 upstream 合并名称、游离 HEAD、每种最多两个叠加图标、仅标签图标和完整汇总悬停/无障碍提示。宽窄列及字号变化时按至少 22 字符缩略规则布局,只有一个视口尺寸观察器,列拖动不逐行读取宽度,卸载清理;分页不丢滚动/选择,成功后不重读 Commit Files;文件读取失败时 Commit Files 面板显示重试入口,重新选择同一提交或刷新历史也会重试一次,长边导航和新建标签原入口保持。组件与浏览器验证通过,目标 WebView2 实机验收 pending。 Windows Git Log 分支树和提交列表的普通滚轮使用 Community Windows 默认 200ms 和 (0.5,0.505,0.5,1) 曲线;连续同向累积、反向从当前位置重启。核对两处列表的中间帧、Shift 横向滚动、分页保持、顶底边界、键盘定位和滑块拖动取消惯性、关闭工具窗清理帧以及减少动态效果偏好。确定性动画与 DOM 回归通过,真实 WebView2 设备手感验收保持 pending。 Windows graph 标题不再固定预留六列:建议宽度取可见图边数的加权均值与标准差,最多以六列作统一基线,每行按节点与斜边中点扩展,密集行不把其他简单行扩成最大列宽。验证单线/少分支、罕见密集合并、超过六列、筛选、长边开关、引用标签可用宽度及字号/DPI,保持图谱颜色/连线/导航不变。 Windows Git Log 的 Commit Files 文件树沿用 IDEA Windows 默认 200ms 滚轮动画;在文件行、竖向/横向滚动条区域连续滚动、反向及 Shift 横向滚动,确认共用真实视口的动画目标,长文件名保持自然宽度;按下滚动条取消未完成惯性,减少动态效果时直接滚动,切换提交及卸载不残留帧。其它 ScrollArea 默认行为不变。真实 WebView2 交互验收 pending。 Windows Git Log 右键 New Tag 打开弹窗后焦点直接位于标签名输入框,无需点击即可输入,Enter 提交、Esc 关闭。 macOS Git Log 空状态:在非 Git 项目检查明暗主题、窄窗口和键盘操作:13pt 常规文字按 IDEA 左对齐,整组位于内容区上方三分之一处;显示 To track changes to code、GitHub/GitLab 官网链接、Initialize Git repository…、Open Git Settings 和带原始 ContextHelp 图标的 Version control integration(打开 Git 官方文档)。初始化仍先确认,不自动暂存或提交;设置打开既有 Git 设置。未提交仓库、无匹配提交、加载失败及重试保持原动作,所有空状态操作采用文字按钮。 非 Git 项目空状态隐藏 Log/Worktrees/Console 标签、添加按钮、分支树与动作条、筛选/搜索工具栏及提交详情,提示占满工具窗内容区;GitHub、GitLab、初始化、设置及帮助链接悬停仅给当前文字加主题强调色下划线并显示手形,离开后恢复;初始化或切换至真实仓库后恢复原有三栏布局,真实仓库无匹配提交仍保留筛选入口。 空状态字体与间距对照 Community c7f91397:按钮标签显式使用 Inter 13pt Regular;行首破折号按首行基线对齐,21pt 行高加 2pt 间隔,帮助图标间隔 2pt;灰字与链接分别沿 Component.infoForeground 和 Islands Link.activeForeground 核对明暗主题,悬停下划线仍使用当前主题强调色。 macOS 右侧提交详情的分支标签按可见区域懒加载,全部引用仍可滚动查看。重开面板初始化时恢复匹配的提交图和分支树,第一次布局即可读取全部已缓存数据,不依赖出现后的异步任务回填。重开面板复用未变化的分支树,单仓库不重复构建分组副本,多仓库活动根复用已有三类行;引用、仓库、工作树开关、折叠状态改变后拒绝旧树。原生绘制与无障碍日期文本复用缓存,语言改变后刷新。 macOS 大量引用首屏:同提交放置 1,500 个本地分支和 1,500 个远程引用,核对真实 upstream 优先、同名远程自然排序回退、完整提示及每类图标上限;反复切换 Terminal/Git Log,数据版本相同应复用已准备图,改变分支/筛选/图显示选项后不得复用旧图。运行 GitGraphInteractionTests 的 manyReferenceGroups 和 presentationCache;组件耗时仅诊断,整机卡顿以相同数据实测为准。 macOS Git Log 及终端按需创建后由工作台持有实际原生宿主;隐藏再重开及移动停靠位置复用控件。运行 GitLogReferenceResizeTests,验证同一工作台隐藏再重开时,固定原生表面上的提交文档和滚动容器对象身份不变,恢复可见性且尺寸正确,工作台释放后宿主释放;核对语言、主题、搜索、分支操作和终端会话。 Git Log 与终端同时停靠时,从外层横向和纵向分隔条中央及向面板两侧偏移 4pt 处,经窗口发送按下、拖动、松开,确认完整 10pt 命中区仍能提交尺寸、宿主身份保持,面板中央正常交互。;macOS 保留宿主圆角需在明暗主题、侧栏顶部与移动后、项目辉光改变、渐变开关及背景图切换时,与原工作台树四角像素一致(WorkbenchSurfaceBackgroundTests.retainedPaneCornersMatchWorkbenchGradient)。 Windows HEAD 按 Community HeadNodePainter 核对外圈、背景间隔和中心实点:26px 行高、100% 缩放时三层直径为 13/9/5px,125%/150%/200%/300% 按物理像素 FLOOR/ODD 对齐;深浅主题、悬停、当前分支及活动/非活动选择均透出真实行底色,穿过 HEAD 的连线不侵入间隔。普通节点及分叉、筛选、长边展开保持;同边双向终止元素键唯一。目标 WebView2 实机验收保持 pending。 macOS 在明暗主题的窄 Git Log 工具栏中选择长用户名、分支和路径,确认名称与选中值以同一行尾部截断,文字不重叠,清除按钮和重新选择仍可用。 macOS Git Log 接近底部时自动追加较早提交,正常浏览不出现必须点击的加载更多按钮;单一页面最多发起一次边缘请求,追加保留选择和原生视口偏移。无新提交或缺失后续游标时停止并释放游标;失败暂停自动读取,显式刷新重开历史而不重用失败游标。运行 GitGraphInteractionTests.automaticHistoryPaging 与 GitModuleTests.continuousHistoryPagingStopsOnDuplicatePagesAndRefreshesAfterFailure,真实大仓库连续滚动和 Windows WebView2 验收仍 pending。 macOS 深层历史后台刷新:文件状态变化不重开首批,元数据刷新保留已加载窗口和后续页占位,未变结果不重建提交图;外部新提交按可见 hash 与行内偏移保持原生视口,按新行位移补齐旧尾部,保留尾部选择。当前仓库引用只读取一次,多仓库仍独立加载。后台刷新打断自动分页后,即使历史相同也能继续读取新游标;失败仍暂停自动重试。运行 GitModuleTests.backgroundRefreshRetainsDeepHistoryAndSelectionWhileExternalCommitsStillAppear、引用聚合回归及 GitGraphInteractionTests.backgroundHistoryRefreshAnchorsVisibleCommitInsteadOfSelectedCommit/automaticHistoryPaging;真实大仓库长时间滚动仍待用户验收,原生进程 cleanup 超时未独立复现,不将减少重复查询等同于修复所有进程失败。 macOS #1542:显示保留的 Git Log/终端时,横纵分隔条中央及两侧偏移 4pt 仍经窗口事件完成拖动且只提交一次,宿主身份不变;根命中查询深度始终为 1,面板内部连续 100 次查询不产生额外根查询,鼠标移动不回查祖先 SwiftUI。验证禁用、收起(含嵌套分隔条)、恢复、卸载、跨窗口与登记表隔离、实时移动/裁剪、隐藏/透明和弱引用释放;保留宿主内部仍正常命中,外层边缘优先。Diff 两端收起后在普通与保留侧栏下均能经窗口拖回,不触发外层拖动。运行 GitLogReferenceResizeTests、SplitHandleHitTestTests 和 DiffScrollSynchronizationTests;旧实现先出现嵌套命中断言失败,新实现通过。较新 macOS 原生组件回归不替代 macOS 13 Intel 原报告崩溃验收,目标环境验证保持 pending。 历史菜单资格使用 Core 读取真实 HEAD 与第一父链;在筛选/分页、旁支首行、跳选、切换仓库、HEAD 变化和关闭菜单时验证动作状态及迟到结果隔离;两端原生界面验收 pending。 Git 控制台执行日志的记录状态(completed / unconfirmed)、单条与总量保留预算和脱敏由 Core 事件携带,两端不再各自归约或二次脱敏,单条输出预算统一为 32768 字符。 历史刷新的窗口大小、头部新增后保留旧尾部的延伸读取、翻页合并去重与上限、选中提交/焦点/范围锚点的保留统一由 Core `git.historyWindow` 决定;Windows 监听刷新不再把深层历史缩回第一页,选中与锚点在仍已加载时保留,像素级滚动锚点仍留在视图。滚动到深处后触发后台刷新,确认窗口深度、选中行与 Shift 范围起点不变;两端原生界面验收 pending。 Viva 改动文件折叠:运行 scripts/desktop/desktop-go.sh test ./internal/workbench -run 'TestLogChangedFiles|TestGroupLogFiles' -count=1;实机选择一个改动多个目录的提交,收起与展开文件夹、用方向键和双击操作,切换提交后文件夹重新展开。 Viva 提交详情改动文件横向滚动:运行 scripts/desktop/desktop-go.sh test ./internal/workbench -run TestLogChangedFiles -count=1 和 scripts/desktop/desktop-go.sh test ./internal/hscroll -count=1;实机选中路径很长的提交,确认改动文件列表可左右滚动、底部显示细滚动条,暗色主题下删除的文件显示为红色而不是灰色。 Viva 提交详情的哈希、作者、邮箱和日期不截断:运行 scripts/desktop/desktop-go.sh test ./internal/workbench -run TestLogCommitDetails -count=1;实机把详情面板拖到最窄,选中作者名和邮箱都很长的提交,确认放不下时换行显示,超长邮箱独占一行并在行内折行,没有省略号。 Viva 控制台:执行提交、推送或工作树清理等写操作后打开 Git 工具窗口的“控制台”页,核对命令、输出、退出码、搜索跳转、折叠、复制和清空;desktop/internal/workbench/gitconsole_test.go 覆盖列表、搜索和清空。 Viva 行标识回归 TestLogCommitKeysKeepFooterInRangeAndSeparate:加载页脚使用独立的合法标识 0,提交从 1 编号,重新排序保留提交标识;升级后的 List/Tree 范围检查不得因分页页脚崩溃。原生三平台长历史分页验收仍 pending。 Git 控制台 TestConsoleRowKeysReserveValidMissingRowIdentity 覆盖列表刷新期间缺失行的保留标识,不与真实行冲突。 Git 控制台开关:运行 scripts/desktop/desktop-go.sh test ./internal/core ./internal/workbench -run 'TestGitConsole|TestConsole' -count=1;实机打开设置 → 版本控制,逐个切换“省略的查询”里的九个开关,确认关闭的类别出现在控制台、打开的类别不再新增记录,执行的命令和失败请求始终显示;切换“显示”里的四个开关,确认查询折叠、无输出提示、临时 -c 配置和仓库名立即按开关重绘,复制全部内容仍带仓库名;重启后开关保持。", + "notes": "Viva 的 Git Log 已有提交列表、分支面板和提交详情,其余能力尚未逐项盘点。提交详情的改动文件按文件夹分组,文件夹先于文件,使用与项目树相同的 desktop/internal/treelist 折叠列表:单击箭头、双击文件夹或方向键展开收起,Enter 打开文件差异;切换提交后所有文件夹重新展开。2026-11-14 起分组由 Core git.changedFileGroups 计算(#1814):目录按段比较、文件按项目树的自然顺序排列(v0.1.4 在 v0.1.12 前),顶层目录为空字符串;Stash 和 Shelf 页同样适用。legacy 是迁移前基线,不代表当前实现。 Viva 提交详情的改动文件列表与项目树共用 desktop/internal/hscroll 横向滚动:列宽取最长一行,滚轮或触控板横向滚动,底部细滚动条显示位置;删除的文件在明暗主题下都用红色(Deleted),不再用暗色下发灰的次要文字色,Commit 工具窗口同样适用。 Git 工具窗口新增“控制台”页:按时间列出 Core 记录的 Git 写操作命令、输出和退出码,支持搜索与上下跳转命中、折叠长输出、复制命令或输出和清空;记录哪些查询和怎么显示由设置 → 版本控制的“Git 控制台:省略的查询”“Git 控制台:显示”两组共 13 个开关决定,初始状态与 IntelliJ IDEA 一致;省略的查询类别在 Core 记录时就丢弃,不占 200 条记录(类别由 gitExecution.consoleQueries 传给 Core,宿主用 queryCategory 标注后台分支读取、操作后重新加载、保存后差异刷新和日志路径筛选,其余由 Core 按命令归类);用户执行的命令、失败的 Git 请求、意外退出码和未确认的命令始终显示。显示开关由 git.consolePresentation 的 display 参数在 Core 里生效,复制全部内容仍保留完整命令和仓库。控制台工具栏原“隐藏读取命令”开关改为打开这两组设置的按钮。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": { From 45fd4633e6a189c4bbaf3cd02828cf7ec862bcd6 Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Mon, 16 Nov 2026 17:24:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(desktop):=20Git=20=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=8F=B0=2010=20=E8=A1=8C=E4=BB=A5=E5=86=85=E4=B8=8D=E6=8A=98?= =?UTF-8?q?=E5=8F=A0=E3=80=81=E5=88=A0=E9=99=A4=E7=B1=BB=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E4=B8=8D=E6=8A=98=E5=8F=A0=EF=BC=8C=E5=B9=B6=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=AF=84=E5=AE=A1=E9=97=AE=E9=A2=98=20(#2025)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - “查询只显示命令行”改为“折叠 10 行以内的查询输出”(foldShortQueries):成功查询的输出超过 10 行才折叠,打开后短输出也折叠;删除类命令的配置、进度和输出从不折叠(规则在 Core)。 - 省略一个类别时移除已记录的该类成功查询(Core 在 started 事件里带 queryCategory); 查询类别改为 core.GitQueryCategory 类型,并与 Core fixture 的 queryCategories 对照测试。 - Git 操作后重新读取状态统一走 reloadGit,归入“操作后的自动重新加载”类别。 - 显示参数切换后,搜索命中和计数只用当前参数下的展示结果。 - 控制台只保存要记录的类别,显示参数从设置读取;类别用原子指针缓存,不再每个请求加锁。 - 日志路径筛选的类别标注提到循环外;单行输出用“共 1 行”词条;文案去掉“200 条记录”。 - PINNED_CORE_REVISION 升到 Core#64 分支的 5aae479。 --- ...09-12-git-execution-and-project-console.md | 20 ++- desktop/internal/core/client.go | 4 +- desktop/internal/core/gitconsole.go | 154 +++++++++++------- desktop/internal/core/gitconsole_test.go | 88 ++++++++-- desktop/internal/i18n/console_messages.go | 3 + desktop/internal/i18n/shared.generated.go | 18 +- .../settingswindow/git_console_view.go | 9 +- .../settingswindow/git_console_view_test.go | 4 +- desktop/internal/workbench/app.go | 2 +- desktop/internal/workbench/commit.go | 4 +- desktop/internal/workbench/difftab.go | 2 +- desktop/internal/workbench/git.go | 20 ++- desktop/internal/workbench/git_exclude.go | 2 +- desktop/internal/workbench/git_gutter.go | 2 +- desktop/internal/workbench/git_history.go | 2 +- desktop/internal/workbench/git_rebase.go | 2 +- desktop/internal/workbench/gitconsole.go | 13 +- .../internal/workbench/gitconsole_settings.go | 12 +- desktop/internal/workbench/gitconsole_test.go | 8 +- desktop/internal/workbench/github_create.go | 2 +- desktop/internal/workbench/gitlog.go | 7 +- desktop/internal/workbench/gitreview.go | 2 +- desktop/internal/workbench/gitworktree.go | 2 +- desktop/internal/workbench/nested_repos.go | 6 +- desktop/internal/workbench/shelf.go | 2 +- desktop/internal/workbench/stash.go | 2 +- scripts/desktop/build-desktop-core.sh | 12 +- shared/i18n/locales/en-US.json | 9 +- shared/i18n/locales/zh-CN.json | 9 +- shared/i18n/messages.json | 22 ++- .../features/git-history.json | 2 +- 31 files changed, 302 insertions(+), 144 deletions(-) diff --git a/.agents/notes/implemented/architecture/2026-09-12-git-execution-and-project-console.md b/.agents/notes/implemented/architecture/2026-09-12-git-execution-and-project-console.md index 8afbcfd8da..a89e10c6a2 100644 --- a/.agents/notes/implemented/architecture/2026-09-12-git-execution-and-project-console.md +++ b/.agents/notes/implemented/architecture/2026-09-12-git-execution-and-project-console.md @@ -80,13 +80,19 @@ Core 的引用读取保留正常 Git 查询结果;对缺失的上游元数据 内部查询指 Lithe 为了显示状态、日志、差异等自己发起的读命令。它们默认不进控制台,和 IntelliJ IDEA 一致;用户排查问题时,可以在“设置 → 版本控制”的“Git 控制台:省略的查询”里按类别关掉省略。九个类别是:后台分支读取、操作后的自动重新加载、保存后的差异刷新、差异读取、日志浏览、日志路径筛选、注解与行历史、列表与面板、操作前检查。开关写成“省略……”,初始全部打开。 -过滤发生在 Core 记录之前。桌面端把要记录的类别放进 `gitExecution.consoleQueries` 交给 Core,没选的类别 Core 直接不记,因此不占控制台保留的 200 条记录。类别默认由 Core 按命令判断,例如 `git.diff` 归差异读取,`git.history*` 归日志浏览,没有归入其他类的 `git.*` 查询归操作前检查。同一条命令在不同场景下需要不同开关时,宿主才在请求上用 `queryCategory` 显式标注;目前标注的是后台分支读取、操作后重新加载、保存后差异刷新和日志路径筛选。后台请求没有标注就永远不记,所以随仓库变化自动刷新的状态、行号区标记、行尾 Blame 不会把控制台刷满。 +过滤发生在 Core 记录之前。桌面端把要记录的类别放进 `gitExecution.consoleQueries` 交给 Core,没选的类别成功时 Core 直接不报,因此不占控制台保留的记录。类别默认由 Core 按命令判断,例如 `git.diff` 归差异读取,`git.history*` 归日志浏览,没有归入其他类的 `git.*` 查询归操作前检查。同一条命令在不同场景下需要不同开关时,宿主才在请求上用 `queryCategory` 显式标注;目前标注的是后台分支读取、操作后重新加载(获取、分支操作,以及提交、暂存、贮藏、搁置、变基、历史改写等操作之后和手动刷新更改列表时读取的状态,入口是桌面端的 `reloadGit`)、保存后差异刷新和日志路径筛选。后台请求没有标注就永远不记,所以随仓库变化自动刷新的状态、行号区标记、行尾 Blame 不会把控制台刷满。 -用户执行的命令、失败的 Git 请求、意外的退出码和未确认的命令不受这些开关影响,始终记录。 +Core 只接受它列出的类别名,写错一个名字整条 Git 请求都会被拒绝。所以桌面端的类别是 `core.GitQueryCategory` 类型常量,测试拿它和 Core fixture `git/console-queries-v1.json` 的 `queryCategories` 逐项对照,名字或顺序不一致就失败。 -“Git 控制台:显示”里的四个开关(查询只显示命令行、省略无输出提示、完全隐藏临时 `-c` 配置、省略仓库名)只改变已记录内容的画法。它们作为 `git.consolePresentation` 的 `display` 参数在 Core 里生效;切换后,控制台用新参数重新请求展示,旧参数下的展示结果不再使用。复制全部内容仍用完整原文,带仓库名和临时配置。 +用户执行的命令、失败的 Git 请求、意外的退出码和未确认的命令不受这些开关影响,始终记录。没开类别的查询在用户发起的请求里失败时,Core 也会补报它的命令行、stderr 和退出码,按查询的样子显示;后台请求里的查询失败了也不报。 -正确做法:新增一种需要单独开关的读取,而它和已有命令同名时,在调用处用 `core.WithQueryCategory` 标注类别,并在 Core 的类别表登记。不要这样做:桌面端拿到记录后再按命令名隐藏,被藏起来的查询仍占 200 条名额,会把用户真正执行的命令挤出去。 +Core 在已报告查询的 `started` 事件里带上 `queryCategory`。用户打开某个“省略”开关时,控制台把已记录的、该类别的成功查询一并移除,释放它们占的记录和输出预算;失败的查询、可见命令和仍在运行的请求里的查询保留,后者的后续事件还要写进原记录。 + +“Git 控制台:显示”里的四个开关(折叠 10 行以内的查询输出、省略无输出提示、完全隐藏临时 `-c` 配置、省略仓库名)只改变已记录内容的画法。它们作为 `git.consolePresentation` 的 `display` 参数在 Core 里生效;切换后,控制台用新参数重新请求展示。新结果回来之前,旧参数下的折叠和片段照常绘制,避免长输出闪开一帧,但搜索命中、匹配计数和提示只用当前参数下的结果。复制全部内容仍用完整原文,带仓库名和临时配置。显示参数只存在设置里,控制台日志本身只保存要记录的类别。 + +成功查询的输出超过 10 行才整段折叠,10 行以内照常显示;打开“折叠 10 行以内的查询输出”后短输出也折叠。删除类命令一律不折叠:它的 `-c` 配置、进度和输出都完整显示,让用户看清删掉了什么。删除类的判定在 Core 的 `console/deletion.rs`,包括 `rm`、`clean`(含试运行),带 `-d`/`-D`/`--delete` 的 `branch`、`tag`、`update-ref`、`symbolic-ref`,带删除选项或空源 refspec 的 `push`,带修剪选项的 `fetch`/`pull`,`remote remove`/`prune` 和带修剪的 `remote update`,删除配置的 `config`,`stash drop`/`clear`/`pop`,以及 `worktree remove`/`prune`。只看 `--` 之前的选项。`reset`、`checkout --` 这类回退不算删除。“完全隐藏临时 `-c` 配置”对删除类命令仍然生效,因为那是用户明确选的省略,不是折叠。 + +正确做法:新增一种需要单独开关的读取,而它和已有命令同名时,在调用处用 `core.WithQueryCategory` 标注类别,并在 Core 的类别表和 fixture 的 `queryCategories` 登记。不要这样做:桌面端拿到记录后再按命令名隐藏,被藏起来的查询仍占记录名额,会把用户真正执行的命令挤出去。 ## 考虑过的备选方案 @@ -97,19 +103,19 @@ Core 的引用读取保留正常 Git 查询结果;对缺失的上游元数据 - 为远程另建更细粒度的并发队列:Lithe 已有共享仓库与工作树写入许可,本次保留既有互斥边界,不在执行层改写并发策略。 - 把控制台做成持久历史库:需要另外定义存储、清理和隐私契约,本能力只保留内存诊断历史。 - 所有 mutation 后的读取都使用独立清理期限:会截短正常请求的剩余预算并屏蔽其取消,因此只为已经结束的请求使用。 -- 只在显示时隐藏查询(原控制台工具栏的“隐藏读取命令”开关):实现简单,但被隐藏的查询照样占用 200 条记录,频繁的后台读取会挤掉用户执行的命令,因此改为记录前过滤,工具栏开关换成打开版本控制设置的按钮。 +- 只在显示时隐藏查询(原控制台工具栏的“隐藏读取命令”开关):实现简单,但被隐藏的查询照样占用记录名额,频繁的后台读取会挤掉用户执行的命令,因此改为记录前过滤,工具栏开关换成打开版本控制设置的按钮。 - 每条命令一个开关:最精细,但 Core 的 `git.*` 查询有上百个,用户无法判断该关哪个,因此按用户能感知的九个场景分类。 - 由桌面端逐条决定是否记录:归类规则会留在平台层,将来换界面实现时要重写,因此归类在 Core,平台只为场景不同的请求标注类别。 ## 后果 -用户可以跨功能和工作树查到真实执行过程,取消、认证和部分失败也有一致的归属。代价是必须维护请求与子进程两层生命周期,并同时验证 Core 与平台展示。共享展示减少两端规则偏差,但异步回复仍要求界面正确配对快照并丢弃过期结果。内存上限保证长时间使用可控,也意味着控制台不能承担完整审计存档。查询在记录前过滤,打开开关之前发生的查询找不回来;用户要先打开对应开关再重现问题。 +用户可以跨功能和工作树查到真实执行过程,取消、认证和部分失败也有一致的归属。代价是必须维护请求与子进程两层生命周期,并同时验证 Core 与平台展示。共享展示减少两端规则偏差,但异步回复仍要求界面正确配对快照并丢弃过期结果。内存上限保证长时间使用可控,也意味着控制台不能承担完整审计存档。查询在记录前过滤,打开开关之前发生的查询找不回来;用户要先打开对应开关再重现问题。省略一个类别会移除它已记录的成功查询,重新打开也找不回来。 ## 验证 - 共享 fixture 覆盖命令、事件、生命周期、Fetch、远程查询和完整展示结果;Core 的真实 Git 测试对照标签 refspec、无效布尔值与实际 Fetch。 - 认证和重试回归需要包含:本机 HTTP 认证测试服务器直接绑定数字回环地址,不做反向 DNS 查询;认证、重试与取消场景保留 15 秒预算。 -- Viva 侧验证:`scripts/desktop/desktop-go.sh test ./internal/core/...` 覆盖事件桥;`scripts/desktop/desktop-go.sh test ./internal/core ./internal/workbench -run 'TestGitConsole|TestConsole' -count=1` 覆盖查询类别的记录、偏好到类别与显示参数的映射,以及显示开关切换后的重绘。 +- Viva 侧验证:`scripts/desktop/desktop-go.sh test ./internal/core/...` 覆盖事件桥;`scripts/desktop/desktop-go.sh test ./internal/core ./internal/workbench -run 'TestGitConsole|TestConsole' -count=1` 覆盖查询类别的记录、类别与 Core fixture 一致、省略类别时移除已记录的成功查询、偏好到类别与显示参数的映射,以及显示开关切换后的重绘。 - 进程清理和管道排空必须在真实 Windows 与 macOS 产品中验收;静态检查不能替代运行时清理证据。 - `./scripts/agent-notes/verify-agent-notes.sh` diff --git a/desktop/internal/core/client.go b/desktop/internal/core/client.go index 941d4caac0..891936440e 100644 --- a/desktop/internal/core/client.go +++ b/desktop/internal/core/client.go @@ -42,10 +42,10 @@ type gitExecution struct { // ConsoleQueries are the query categories (GitQueryReferences and the rest) whose internal // read-only queries Core reports to the console, as it reports the commands the user // started. Empty reports none, as IntelliJ IDEA's console does. - ConsoleQueries []string `json:"consoleQueries,omitempty"` + ConsoleQueries []GitQueryCategory `json:"consoleQueries,omitempty"` // QueryCategory names what the request reads when its command alone does not tell, such // as a reload after an operation; empty leaves it to the command. - QueryCategory string `json:"queryCategory,omitempty"` + QueryCategory GitQueryCategory `json:"queryCategory,omitempty"` // Source is the request's provenance: "background" for an automatic refresh, whose // queries Core keeps silent unless QueryCategory names them; empty for unknown. Source string `json:"source,omitempty"` diff --git a/desktop/internal/core/gitconsole.go b/desktop/internal/core/gitconsole.go index 59615a2167..8d777dbae7 100644 --- a/desktop/internal/core/gitconsole.go +++ b/desktop/internal/core/gitconsole.go @@ -7,6 +7,7 @@ import ( "strconv" "strings" "sync" + "sync/atomic" "time" "unicode/utf8" ) @@ -16,10 +17,11 @@ import ( // the console stores them in the bounded journal the contract describes, and Core's // git.consolePresentation turns the stored records into what the console draws. Core has // already redacted every text it reports, so nothing here redacts again, and Core decides -// which commands are visible: an internal read-only query reports a started command only when -// its category is one the console's preferences show (gitExecutionOf), and Core marks it as a -// query, whose output git.consolePresentation folds. A query the console does not show is never -// reported, so it takes none of the journal's budget. +// which commands are visible: an internal read-only query reports a started command when its +// category is one the console records (gitExecutionOf), and Core marks it as a query, with its +// category, whose long output git.consolePresentation folds. A query the console does not record +// reports nothing while it succeeds, so it takes none of the journal's budget; one that fails in +// a request the user started reports its command, stderr and exit like a recorded query. // // The lengths of the retention budget are counted in bytes of UTF-8, which is never fewer // than the characters the budget names, so the console keeps at most what it allows. @@ -38,30 +40,35 @@ const ( // GitConsoleSearchLimit is the longest search, in bytes, git.consolePresentation accepts. const GitConsoleSearchLimit = 1024 -// Query categories, as Core names them (QueryCategory in the Rust contract): what a request's -// internal read-only queries read. Core infers the category from the request command; a host -// names it with WithQueryCategory for the reads the command does not tell apart. +// GitQueryCategory is what a request's internal read-only queries read (QueryCategory in the +// Rust contract). Core infers it from the request command; a host names it with +// WithQueryCategory for the reads the command does not tell apart. Core rejects a request that +// names a category it does not know, so only these constants are ever sent. +type GitQueryCategory string + +// The query categories, in the order Core lists them (queryCategories of +// rust/fixtures/git/console-queries-v1.json). const ( // GitQueryReferences are reference reads that follow a repository change without a user // action, such as the branches of nested repositories. - GitQueryReferences = "references" + GitQueryReferences GitQueryCategory = "references" // GitQueryReload are the reads that reload views after an operation the user ran. - GitQueryReload = "reload" + GitQueryReload GitQueryCategory = "reload" // GitQueryDiffRefresh are diffs read again because a file they show was saved. - GitQueryDiffRefresh = "diffRefresh" + GitQueryDiffRefresh GitQueryCategory = "diffRefresh" // GitQueryDiff are the file, commit, comparison and stash diffs the user opened. - GitQueryDiff = "diff" + GitQueryDiff GitQueryCategory = "diff" // GitQueryLog are the history, references and commit details the log shows. - GitQueryLog = "log" + GitQueryLog GitQueryCategory = "log" // GitQueryLogPathFilter are the per-commit file lists a log path filter reads. - GitQueryLogPathFilter = "logPathFilter" + GitQueryLogPathFilter GitQueryCategory = "logPathFilter" // GitQueryAnnotate are annotation and line history. - GitQueryAnnotate = "annotate" + GitQueryAnnotate GitQueryCategory = "annotate" // GitQueryPanels are lists and panels: worktrees, stashes, remotes, pull requests and // settings. - GitQueryPanels = "panels" + GitQueryPanels GitQueryCategory = "panels" // GitQueryChecks are previews, preflights, plans and the queries of operations themselves. - GitQueryChecks = "checks" + GitQueryChecks GitQueryCategory = "checks" ) // GitConsolePreferences are the user's choices of what the Git console shows. The zero value @@ -78,8 +85,9 @@ type GitConsolePreferences struct { ShowAnnotateQueries bool `json:"showAnnotateQueries,omitempty"` ShowPanelQueries bool `json:"showPanelQueries,omitempty"` ShowCheckQueries bool `json:"showCheckQueries,omitempty"` - // FoldSingleLineQueries folds a query's output even when it is a single line. - FoldSingleLineQueries bool `json:"foldSingleLineQueries,omitempty"` + // FoldShortQueries folds a successful query's output of any length, not only output longer + // than ten lines; a deletion's output never folds. + FoldShortQueries bool `json:"foldShortQueries,omitempty"` // ShowCompletedWithoutOutput notes a command that finished without writing anything. ShowCompletedWithoutOutput bool `json:"showCompletedWithoutOutput,omitempty"` // HideTemporaryConfig omits Lithe's temporary -c configuration instead of folding it. @@ -89,11 +97,11 @@ type GitConsolePreferences struct { } // QueryCategories returns the query categories p records, in the order Core lists them. -func (p GitConsolePreferences) QueryCategories() []string { - var categories []string +func (p GitConsolePreferences) QueryCategories() []GitQueryCategory { + var categories []GitQueryCategory for _, c := range []struct { show bool - category string + category GitQueryCategory }{ {p.ShowReferenceQueries, GitQueryReferences}, {p.ShowReloadQueries, GitQueryReload}, @@ -115,7 +123,7 @@ func (p GitConsolePreferences) QueryCategories() []string { // Display returns the display options git.consolePresentation draws records with under p. func (p GitConsolePreferences) Display() GitConsoleDisplay { return GitConsoleDisplay{ - FoldSingleLineQueries: p.FoldSingleLineQueries, + FoldShortQueries: p.FoldShortQueries, ShowCompletedWithoutOutput: p.ShowCompletedWithoutOutput, HideTemporaryConfig: p.HideTemporaryConfig, HideRepository: p.HideRepository, @@ -125,8 +133,9 @@ func (p GitConsolePreferences) Display() GitConsoleDisplay { // GitConsoleDisplay is how git.consolePresentation draws records (Display in the Rust // contract). The zero value is IntelliJ IDEA's console. type GitConsoleDisplay struct { - // FoldSingleLineQueries folds a successful query's output even when it is a single line. - FoldSingleLineQueries bool `json:"foldSingleLineQueries"` + // FoldShortQueries folds a successful query's output of any length; unset, output of ten + // lines or fewer stays visible. Core never folds a deletion. + FoldShortQueries bool `json:"foldShortQueries"` // ShowCompletedWithoutOutput notes a command that finished without writing anything. ShowCompletedWithoutOutput bool `json:"showCompletedWithoutOutput"` // HideTemporaryConfig omits Lithe's temporary configuration; -c arguments the operation @@ -198,8 +207,10 @@ type GitConsoleRecord struct { // follows it, without the global options a presentation folds. Empty when Core sent none. DisplayArguments []string // Query says the command is an internal read-only query Core reported because the request - // asked for queries, rather than a command the workflow runs visibly. + // asked for queries, or because it failed, rather than a command the workflow runs visibly. Query bool + // QueryCategory is the query's category, empty for a visible command and a query of none. + QueryCategory GitQueryCategory // Lines are the retained output, oldest first; Truncated says some of it was dropped. Lines []GitConsoleLine Truncated bool @@ -244,9 +255,10 @@ type GitConsole struct { omitted bool revision uint64 nextID uint64 - // preferences say which query categories are recorded and how records are drawn. - preferences GitConsolePreferences - now func() time.Time + // queries are the query categories recorded, read by every Git request without the lock. + // The slice is never changed after it is stored. + queries atomic.Pointer[[]GitQueryCategory] + now func() time.Time // changed is called after the console changed, outside the lock. changed func() } @@ -289,19 +301,49 @@ func NewGitConsole(changed func()) *GitConsole { } } -// SetPreferences sets which query categories the console records from the next request on, -// and how its records are drawn. Records already kept stay. -func (c *GitConsole) SetPreferences(preferences GitConsolePreferences) { +// RecordQueries sets the query categories the console records from the next request on. The +// successful queries it kept of a category it no longer records leave the journal, so turning +// a category off frees the records it took; a failed query stays, and so does a query of a +// request still running, whose later events keep its record. +func (c *GitConsole) RecordQueries(categories []GitQueryCategory) { + categories = slices.Clone(categories) c.mu.Lock() - defer c.mu.Unlock() - c.preferences = preferences + c.queries.Store(&categories) + kept := c.records[:0] + for _, entry := range c.records { + record := &entry.record + if record.QueryCategory != "" && !slices.Contains(categories, record.QueryCategory) && !record.failed() && c.requests[record.OperationID] == nil { + entry.dropped = true + c.outputBytes -= entry.outputBytes + continue + } + kept = append(kept, entry) + } + removed := len(kept) < len(c.records) + clear(c.records[len(kept):]) + c.records = kept + if removed { + c.revision++ + } + c.mu.Unlock() + if removed { + c.notify() + } } -// Preferences returns the console's preferences. -func (c *GitConsole) Preferences() GitConsolePreferences { - c.mu.Lock() - defer c.mu.Unlock() - return c.preferences +// recordedQueries returns the query categories the console records; the caller must not +// change the slice. +func (c *GitConsole) recordedQueries() []GitQueryCategory { + if categories := c.queries.Load(); categories != nil { + return *categories + } + return nil +} + +// failed says the record failed the way git.consolePresentation reads it: an error, an exit +// that was never confirmed, or a nonzero exit the workflow did not expect. +func (r *GitConsoleRecord) failed() bool { + return r.Error != "" || r.State == GitConsoleUnconfirmed || (r.State == GitConsoleCompleted && (!r.Exited || r.ExitCode != 0) && !r.ExpectedExit) } // Revision returns the console's revision, which grows each time it changes. @@ -414,13 +456,14 @@ type gitConsoleEvent struct { Retention *gitConsoleRetention `json:"retention"` // WorkingDirectory is the started command's directory, or, on requestStarted, the // repository a host's fixture names. - WorkingDirectory string `json:"workingDirectory"` - InvocationID *uint64 `json:"invocationId"` - Arguments []string `json:"arguments"` - TemporaryConfig [][2]string `json:"temporaryConfig"` - Executable *string `json:"executable"` - DisplayArguments []string `json:"displayArguments"` - Query bool `json:"query"` + WorkingDirectory string `json:"workingDirectory"` + InvocationID *uint64 `json:"invocationId"` + Arguments []string `json:"arguments"` + TemporaryConfig [][2]string `json:"temporaryConfig"` + Executable *string `json:"executable"` + DisplayArguments []string `json:"displayArguments"` + Query bool `json:"query"` + QueryCategory GitQueryCategory `json:"queryCategory"` Stream string `json:"stream"` Text string `json:"text"` @@ -589,6 +632,7 @@ func (c *GitConsole) start(request *gitConsoleRequest, event *gitConsoleEvent) { TemporaryConfig: slices.Clone(event.TemporaryConfig), DisplayArguments: slices.Clone(event.DisplayArguments), Query: event.Query, + QueryCategory: event.QueryCategory, State: GitConsoleRunning, ExitCode: -1, } @@ -770,18 +814,18 @@ func AutomaticRefresh(ctx context.Context) context.Context { type gitQueryCategoryKey struct{} -// WithQueryCategory returns a context whose Git requests read category (GitQueryReload and the -// rest), for a read whose request command does not tell it apart, such as the status a view -// reloads after an operation. The console records the request's queries when its preferences -// show category, even in an automatic refresh. -func WithQueryCategory(ctx context.Context, category string) context.Context { +// WithQueryCategory returns a context whose Git requests read category, for a read whose +// request command does not tell it apart, such as the status a view reloads after an +// operation. The console records the request's queries when it records category, even in an +// automatic refresh. +func WithQueryCategory(ctx context.Context, category GitQueryCategory) context.Context { return context.WithValue(ctx, gitQueryCategoryKey{}, category) } // gitExecutionOf is the Git policy of a request: a Git request of a context with a console -// asks Core to report the internal queries of the categories the console's preferences show, -// names the category the context gives, and marks an automatic refresh. Other requests, and -// a request with nothing to ask, keep Core's defaults. +// asks Core to report the internal queries of the categories the console records, names the +// category the context gives, and marks an automatic refresh. Other requests, and a request +// with nothing to ask, keep Core's defaults. func gitExecutionOf(ctx context.Context, command string) *gitExecution { if !strings.HasPrefix(command, "git.") || gitConsoleUnrecorded[command] { return nil @@ -790,9 +834,9 @@ func gitExecutionOf(ctx context.Context, command string) *gitExecution { if sink == nil { return nil } - execution := gitExecution{ConsoleQueries: sink.console.Preferences().QueryCategories()} + execution := gitExecution{ConsoleQueries: sink.console.recordedQueries()} if len(execution.ConsoleQueries) > 0 { - execution.QueryCategory, _ = ctx.Value(gitQueryCategoryKey{}).(string) + execution.QueryCategory, _ = ctx.Value(gitQueryCategoryKey{}).(GitQueryCategory) } if refresh, _ := ctx.Value(gitRefreshKey{}).(bool); refresh { execution.Source = "background" diff --git a/desktop/internal/core/gitconsole_test.go b/desktop/internal/core/gitconsole_test.go index c70aea8a56..2d7e7eb3a2 100644 --- a/desktop/internal/core/gitconsole_test.go +++ b/desktop/internal/core/gitconsole_test.go @@ -216,7 +216,7 @@ func TestGitWorktreesAreManagedAndRecordedInTheConsole(t *testing.T) { client := NewClient() console := NewGitConsole(nil) // The worktree list queries of the operations and of the panel show only when asked for. - console.SetPreferences(GitConsolePreferences{ShowCheckQueries: true, ShowPanelQueries: true}) + console.RecordQueries([]GitQueryCategory{GitQueryChecks, GitQueryPanels}) ctx := WithGitConsole(testContext(t), console, repo) destination := filepath.Join(t.TempDir(), "linked") @@ -367,7 +367,7 @@ func TestGitConsoleRecordsTheQueriesOfTheCategoriesItShows(t *testing.T) { t.Fatalf("the default preferences recorded %+v", records) } - console.SetPreferences(GitConsolePreferences{ShowCheckQueries: true, ShowReferenceQueries: true}) + console.RecordQueries([]GitQueryCategory{GitQueryReferences, GitQueryChecks}) if _, err := client.GitStatus(AutomaticRefresh(ctx), repo); err != nil { t.Fatalf("GitStatus(refresh) error: %v", err) } @@ -398,12 +398,12 @@ func TestGitConsoleRecordsTheQueriesOfTheCategoriesItShows(t *testing.T) { } // Only a Git request with a console asks Core to report queries, of the categories the -// console's preferences show and under the category the context names; an automatic refresh -// names its provenance. +// console records and under the category the context names; an automatic refresh names its +// provenance. func TestGitExecutionOfAsksForTheCategoriesTheConsoleShows(t *testing.T) { idea := WithGitConsole(context.Background(), NewGitConsole(nil), "/repo") shown := NewGitConsole(nil) - shown.SetPreferences(GitConsolePreferences{ShowDiffQueries: true, ShowCheckQueries: true}) + shown.RecordQueries(GitConsolePreferences{ShowDiffQueries: true, ShowCheckQueries: true}.QueryCategories()) ctx := WithGitConsole(context.Background(), shown, "/repo") cases := []struct { name string @@ -447,27 +447,93 @@ func TestGitConsolePreferencesMapToCategoriesAndDisplay(t *testing.T) { ShowReferenceQueries: true, ShowReloadQueries: true, ShowDiffRefreshQueries: true, ShowDiffQueries: true, ShowLogQueries: true, ShowLogPathFilterQueries: true, ShowAnnotateQueries: true, ShowPanelQueries: true, ShowCheckQueries: true, - FoldSingleLineQueries: true, ShowCompletedWithoutOutput: true, + FoldShortQueries: true, ShowCompletedWithoutOutput: true, HideTemporaryConfig: true, HideRepository: true, } - want := []string{GitQueryReferences, GitQueryReload, GitQueryDiffRefresh, GitQueryDiff, GitQueryLog, + want := []GitQueryCategory{GitQueryReferences, GitQueryReload, GitQueryDiffRefresh, GitQueryDiff, GitQueryLog, GitQueryLogPathFilter, GitQueryAnnotate, GitQueryPanels, GitQueryChecks} if got := all.QueryCategories(); !slices.Equal(got, want) { t.Fatalf("categories = %q, want %q", got, want) } display, err := json.Marshal(all.Display()) - if err != nil || string(display) != `{"foldSingleLineQueries":true,"showCompletedWithoutOutput":true,"hideTemporaryConfig":true,"hideRepository":true}` { + if err != nil || string(display) != `{"foldShortQueries":true,"showCompletedWithoutOutput":true,"hideTemporaryConfig":true,"hideRepository":true}` { t.Fatalf("display = %s (%v)", display, err) } } +// The categories the console can ask for are exactly the ones Core lists, in its order, so a +// request never names one Core rejects. +func TestGitQueryCategoriesAreTheOnesCoreLists(t *testing.T) { + data, err := os.ReadFile(contractfixture.CoreFixture("git/console-queries-v1.json")) + if err != nil { + t.Fatalf("read fixture: %v", err) + } + var fixture struct { + QueryCategories []GitQueryCategory `json:"queryCategories"` + } + if err := json.Unmarshal(data, &fixture); err != nil { + t.Fatalf("decode fixture: %v", err) + } + all := GitConsolePreferences{ + ShowReferenceQueries: true, ShowReloadQueries: true, ShowDiffRefreshQueries: true, + ShowDiffQueries: true, ShowLogQueries: true, ShowLogPathFilterQueries: true, + ShowAnnotateQueries: true, ShowPanelQueries: true, ShowCheckQueries: true, + } + if got := all.QueryCategories(); len(fixture.QueryCategories) == 0 || !slices.Equal(got, fixture.QueryCategories) { + t.Fatalf("categories = %q, Core lists %q", got, fixture.QueryCategories) + } +} + +// Turning a category off frees the records its successful queries took, once their request +// finished; a failed query, a visible command, a query of another category and the queries of +// a request still running stay. +func TestGitConsoleDropsTheSuccessfulQueriesOfACategoryTurnedOff(t *testing.T) { + console := newTestConsole() + changes := 0 + console.changed = func() { changes++ } + console.RecordQueries([]GitQueryCategory{GitQueryLog, GitQueryDiff}) + consoleEvents(t, console, "/repo", + `{"operationId":"a","type":"requestStarted"}`, + `{"operationId":"a","type":"started","invocationId":1,"arguments":["log"],"query":true,"queryCategory":"log"}`, + `{"operationId":"a","type":"output","invocationId":1,"stream":"stdout","text":"commit"}`, + `{"operationId":"a","type":"finished","invocationId":1,"state":"completed","exitCode":0}`, + `{"operationId":"a","type":"started","invocationId":2,"arguments":["show"],"query":true,"queryCategory":"log"}`, + `{"operationId":"a","type":"finished","invocationId":2,"state":"completed","exitCode":128}`, + `{"operationId":"a","type":"started","invocationId":3,"arguments":["diff"],"query":true,"queryCategory":"diff"}`, + `{"operationId":"a","type":"finished","invocationId":3,"state":"completed","exitCode":0}`, + `{"operationId":"a","type":"started","invocationId":4,"arguments":["fetch"]}`, + `{"operationId":"a","type":"finished","invocationId":4,"state":"completed","exitCode":0}`, + `{"operationId":"a","type":"requestFinished"}`, + `{"operationId":"b","type":"requestStarted"}`, + `{"operationId":"b","type":"started","invocationId":1,"arguments":["rev-list"],"query":true,"queryCategory":"log"}`, + ) + revision, before := console.Revision(), changes + console.RecordQueries([]GitQueryCategory{GitQueryDiff}) + if got := consoleCommands(console); !slices.Equal(got, []string{"show", "diff", "fetch", "rev-list"}) { + t.Fatalf("console commands = %q, want the failed log query, the diff, the fetch and the running query", got) + } + if console.Revision() == revision || changes != before+1 { + t.Fatalf("revision %d -> %d, %d changes: dropping records did not change the console", revision, console.Revision(), changes-before) + } + if console.outputBytes != 0 { + t.Fatalf("output bytes = %d, want the dropped query's output freed", console.outputBytes) + } + if !slices.Equal(console.recordedQueries(), []GitQueryCategory{GitQueryDiff}) { + t.Fatalf("recorded categories = %q", console.recordedQueries()) + } + console.RecordQueries([]GitQueryCategory{GitQueryDiff}) + if changes != before+1 { + t.Fatal("keeping the same categories changed the console") + } +} + // A started event says which command is a query and how Core projects it for consoles, and // the record carries both, the query also to Core's presentation of it. func TestGitConsoleRecordsTheQueryAndTheProjectionOfAStartedCommand(t *testing.T) { console := newTestConsole() consoleEvents(t, console, "/repo", `{"operationId":"a","type":"requestStarted"}`, - `{"operationId":"a","type":"started","invocationId":1,"arguments":["-c","core.quotepath=false","log"],"displayArguments":["log"],"query":true}`, + `{"operationId":"a","type":"started","invocationId":1,"arguments":["-c","core.quotepath=false","log"],"displayArguments":["log"],"query":true,"queryCategory":"log"}`, `{"operationId":"a","type":"started","invocationId":2,"arguments":["fetch"]}`, ) records := console.Snapshot().Records @@ -475,10 +541,10 @@ func TestGitConsoleRecordsTheQueryAndTheProjectionOfAStartedCommand(t *testing.T t.Fatalf("records = %+v, want two", records) } query, fetch := records[0], records[1] - if !query.Query || !slices.Equal(query.DisplayArguments, []string{"log"}) { + if !query.Query || query.QueryCategory != GitQueryLog || !slices.Equal(query.DisplayArguments, []string{"log"}) { t.Fatalf("the query's record is %+v", query) } - if fetch.Query || fetch.DisplayArguments != nil { + if fetch.Query || fetch.QueryCategory != "" || fetch.DisplayArguments != nil { t.Fatalf("the fetch's record is %+v, want no query and no projection", fetch) } if wire, _ := query.wire(); !wire.Query { diff --git a/desktop/internal/i18n/console_messages.go b/desktop/internal/i18n/console_messages.go index c4ec6146de..67b6e90f99 100644 --- a/desktop/internal/i18n/console_messages.go +++ b/desktop/internal/i18n/console_messages.go @@ -102,6 +102,9 @@ func consoleMessages(language Language) ConsoleMessages { return SharedFormat(language, "desktop.git.console.expandConfiguration", map[string]string{"count": strconv.Itoa(n)}) }, QueryOutput: func(n int) string { + if n == 1 { + return SharedFormat(language, "desktop.git.console.queryOutputOne", map[string]string{"count": strconv.Itoa(n)}) + } return SharedFormat(language, "desktop.git.console.queryOutput", map[string]string{"count": strconv.Itoa(n)}) }, Expand: Shared(language, "desktop.git.console.expand"), diff --git a/desktop/internal/i18n/shared.generated.go b/desktop/internal/i18n/shared.generated.go index ede20bc59c..841faad5f7 100644 --- a/desktop/internal/i18n/shared.generated.go +++ b/desktop/internal/i18n/shared.generated.go @@ -541,6 +541,7 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.git.console.expand": "Expand", "desktop.git.console.expandConfiguration": "Show {count} temporary settings", "desktop.git.console.queryOutput": "Read output, {count} lines", + "desktop.git.console.queryOutputOne": "Read output, {count} line", "desktop.git.console.settings": "Git Console Settings", "desktop.git.decorations": "Show commit decorations", "desktop.git.deleteBranch": "Delete Selected Branch", @@ -602,20 +603,20 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.git.settings.console.diffRefreshHelp": "The open Diff tabs of a file read again after the file is saved.", "desktop.git.settings.console.display": "Git Console: Display", "desktop.git.settings.console.displayHelp": "These change only how the Git console draws the commands it recorded, not which it records. Copying the whole console still gives the full commands and repositories. Every switch starts as in IntelliJ IDEA.", - "desktop.git.settings.console.foldSingleLine": "Show Only the Command Line of Queries", - "desktop.git.settings.console.foldSingleLineHelp": "A recorded query's output is folded whole, a single line too, and opens on a click. Turned off, only output of several lines is folded, as in IntelliJ IDEA.", + "desktop.git.settings.console.foldShortQueries": "Fold Query Output of 10 Lines or Fewer", + "desktop.git.settings.console.foldShortQueriesHelp": "A successful query's output longer than 10 lines is folded whole and opens on a click; turned on, shorter output is folded too. A deletion (of branches, tags, references, remote branches, configuration, files, stashes or worktrees, and clean and prune) never has its output or configuration folded.", "desktop.git.settings.console.log": "Omit Log Browsing", "desktop.git.settings.console.logHelp": "The reads of the Git log: its commit history, branches and tags, graph and commit details.", "desktop.git.settings.console.logPathFilter": "Omit Log Path Filter Reads", "desktop.git.settings.console.logPathFilterHelp": "The file lists read commit by commit when the log is filtered by path.", "desktop.git.settings.console.omitted": "Git Console: Omitted Queries", - "desktop.git.settings.console.omittedHelp": "A kind that is on is not written to the Git console and takes none of the 200 records it keeps. The commands you run, failed Git requests and unexpected exit codes always show. The reads that refresh automatically as repositories change (status, gutter markers, inline blame and so on) are never recorded. Every switch starts as in IntelliJ IDEA: all omitted.", + "desktop.git.settings.console.omittedHelp": "A kind that is on is not written to the Git console and takes none of the records it keeps; turning a kind on also removes the successful queries of it the console already recorded. The commands you run, failed Git requests, the failed queries of the operations you start and unexpected exit codes always show. The reads that refresh automatically as repositories change (status, gutter markers, inline blame and so on) are never recorded. Every switch starts as in IntelliJ IDEA: all omitted.", "desktop.git.settings.console.panels": "Omit Lists and Panels", "desktop.git.settings.console.panelsHelp": "The reads of lists and panels such as worktrees, stashes, remotes, pull requests, untracked directories and repository setup.", "desktop.git.settings.console.references": "Omit Background Branch Reads", "desktop.git.settings.console.referencesHelp": "The branches and references of each repository read again in the background after a repository changes, for the branch popup and the log's repository groups.", "desktop.git.settings.console.reload": "Omit Reloads After Operations", - "desktop.git.settings.console.reloadHelp": "The status read again after a fetch, a branch update or a branch operation finishes, and the Diff tabs read again after an operation writes to the working tree or the index.", + "desktop.git.settings.console.reloadHelp": "The status read again after a Git operation you run (commit, staging, stash, shelf, rebase, branch operations, fetch, update and so on) or when you refresh Changes, and the Diff tabs read again after an operation writes to the working tree or the index.", "desktop.git.settings.console.repository": "Omit Repository Name", "desktop.git.settings.console.repositoryHelp": "Each command line starts with the time alone, without the [repository] name.", "desktop.git.settings.console.temporaryConfig": "Hide Temporary -c Configuration", @@ -3270,6 +3271,7 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.git.console.expand": "展开", "desktop.git.console.expandConfiguration": "显示 {count} 项临时配置", "desktop.git.console.queryOutput": "读取结果,共 {count} 行", + "desktop.git.console.queryOutputOne": "读取结果,共 {count} 行", "desktop.git.console.settings": "Git 控制台设置", "desktop.git.decorations": "显示引用标签", "desktop.git.deleteBranch": "删除所选分支", @@ -3331,20 +3333,20 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.git.settings.console.diffRefreshHelp": "保存文件后重新读取该文件已打开的差异标签页。", "desktop.git.settings.console.display": "Git 控制台:显示", "desktop.git.settings.console.displayHelp": "只改变已记录命令在 Git 控制台里的显示方式,不影响记录哪些命令。复制全部内容时仍包含完整命令和仓库。初始状态与 IntelliJ IDEA 一致。", - "desktop.git.settings.console.foldSingleLine": "查询只显示命令行", - "desktop.git.settings.console.foldSingleLineHelp": "已记录查询的输出全部折叠,只有一行也折叠,点击可展开。关闭时只折叠多行输出,与 IntelliJ IDEA 一致。", + "desktop.git.settings.console.foldShortQueries": "折叠 10 行以内的查询输出", + "desktop.git.settings.console.foldShortQueriesHelp": "成功查询的输出超过 10 行时整段折叠,点击可展开;打开此项后,10 行以内的输出也折叠。删除类命令(删除分支、标签、引用、远程分支、配置、文件、贮藏或工作树,以及 clean、prune)的输出和配置从不折叠。", "desktop.git.settings.console.log": "省略日志浏览", "desktop.git.settings.console.logHelp": "Git 日志的提交历史、分支与标签、提交图和提交详情的读取。", "desktop.git.settings.console.logPathFilter": "省略日志路径筛选", "desktop.git.settings.console.logPathFilterHelp": "按路径筛选日志时逐个读取的提交文件列表。", "desktop.git.settings.console.omitted": "Git 控制台:省略的查询", - "desktop.git.settings.console.omittedHelp": "打开的类别不写入 Git 控制台,也不占用控制台保留的 200 条记录。你执行的命令、失败的 Git 请求和意外的退出码始终显示。随仓库变化自动刷新的读取(状态、行号区标记、行尾 Blame 等)从不记录。初始状态与 IntelliJ IDEA 一致:全部省略。", + "desktop.git.settings.console.omittedHelp": "打开的类别不写入 Git 控制台,也不占用控制台保留的记录;打开某个类别时,控制台已记录的该类成功查询也一并移除。你执行的命令、失败的 Git 请求、你发起的操作中失败的查询和意外的退出码始终显示。随仓库变化自动刷新的读取(状态、行号区标记、行尾 Blame 等)从不记录。初始状态与 IntelliJ IDEA 一致:全部省略。", "desktop.git.settings.console.panels": "省略列表与面板", "desktop.git.settings.console.panelsHelp": "工作树、储藏、远程仓库、拉取请求、未跟踪目录和仓库设置等列表与面板的读取。", "desktop.git.settings.console.references": "省略后台分支读取", "desktop.git.settings.console.referencesHelp": "仓库变化后在后台重新读取的各仓库分支与引用,供分支弹窗和日志的仓库分组使用。", "desktop.git.settings.console.reload": "省略操作后的自动重新加载", - "desktop.git.settings.console.reloadHelp": "获取(Fetch)、更新分支或分支操作完成后重新读取的状态,以及操作写入工作区或暂存区后重新读取的差异标签页。", + "desktop.git.settings.console.reloadHelp": "你执行 Git 操作(提交、暂存、贮藏、搁置、变基、分支操作、获取、更新等)后或刷新更改列表时重新读取的状态,以及操作写入工作区或暂存区后重新读取的差异标签页。", "desktop.git.settings.console.repository": "省略仓库名", "desktop.git.settings.console.repositoryHelp": "命令行开头只显示时间,不显示 [仓库名]。", "desktop.git.settings.console.temporaryConfig": "完全隐藏临时 -c 配置", diff --git a/desktop/internal/settingswindow/git_console_view.go b/desktop/internal/settingswindow/git_console_view.go index 6f4c33ec5f..a1ecca8989 100644 --- a/desktop/internal/settingswindow/git_console_view.go +++ b/desktop/internal/settingswindow/git_console_view.go @@ -7,9 +7,10 @@ import ( ) // This file is the Git console cards of the Version Control page (matrix id git-history). The -// first card chooses which kinds of internal Git queries the console leaves out: an omitted -// kind is never recorded, so it takes none of the journal's records. The second chooses how -// the console draws the records it keeps. Every switch starts as IntelliJ IDEA's console, +// first card chooses which kinds of internal Git queries the console leaves out: the +// successful queries of an omitted kind are never recorded, so they take none of the journal's +// records, and omitting a kind removes those it kept. The second chooses how the console +// draws the records it keeps. Every switch starts as IntelliJ IDEA's console, // which records none of these queries and draws everything else, so the stored preferences of // a user who never touched them are empty. @@ -37,7 +38,7 @@ func (w *window) gitConsoleCards(c ui.C, language i18n.Language) { {"checks", i18n.Shared(language, "desktop.git.settings.console.checks"), i18n.Shared(language, "desktop.git.settings.console.checksHelp"), &value.ShowCheckQueries, true}, } display := [...]gitConsoleOption{ - {"foldSingleLine", i18n.Shared(language, "desktop.git.settings.console.foldSingleLine"), i18n.Shared(language, "desktop.git.settings.console.foldSingleLineHelp"), &value.FoldSingleLineQueries, false}, + {"foldShortQueries", i18n.Shared(language, "desktop.git.settings.console.foldShortQueries"), i18n.Shared(language, "desktop.git.settings.console.foldShortQueriesHelp"), &value.FoldShortQueries, false}, {"completedNotice", i18n.Shared(language, "desktop.git.settings.console.completedNotice"), i18n.Shared(language, "desktop.git.settings.console.completedNoticeHelp"), &value.ShowCompletedWithoutOutput, true}, {"temporaryConfig", i18n.Shared(language, "desktop.git.settings.console.temporaryConfig"), i18n.Shared(language, "desktop.git.settings.console.temporaryConfigHelp"), &value.HideTemporaryConfig, false}, {"repository", i18n.Shared(language, "desktop.git.settings.console.repository"), i18n.Shared(language, "desktop.git.settings.console.repositoryHelp"), &value.HideRepository, false}, diff --git a/desktop/internal/settingswindow/git_console_view_test.go b/desktop/internal/settingswindow/git_console_view_test.go index 4b9d34edf8..c23c09d18b 100644 --- a/desktop/internal/settingswindow/git_console_view_test.go +++ b/desktop/internal/settingswindow/git_console_view_test.go @@ -30,8 +30,8 @@ func TestGitConsoleCardsStartAsIDEAAndHandOnTheirChanges(t *testing.T) { } expect := func(when string, on map[string]bool) { t.Helper() - for _, key := range []string{"references", "reload", "diffRefresh", "diff", "log", "logPathFilter", "annotate", "panels", "checks", "foldSingleLine", "completedNotice", "temporaryConfig", "repository"} { - want := key != "foldSingleLine" && key != "temporaryConfig" && key != "repository" + for _, key := range []string{"references", "reload", "diffRefresh", "diff", "log", "logPathFilter", "annotate", "panels", "checks", "foldShortQueries", "completedNotice", "temporaryConfig", "repository"} { + want := key != "foldShortQueries" && key != "temporaryConfig" && key != "repository" if flipped, ok := on[key]; ok { want = flipped } diff --git a/desktop/internal/workbench/app.go b/desktop/internal/workbench/app.go index 87e48f4a71..3375ca1d27 100644 --- a/desktop/internal/workbench/app.go +++ b/desktop/internal/workbench/app.go @@ -780,7 +780,7 @@ func New(options Options) *App { // the rest loaded. It is logged below with the failures, and the notice tells it is kept. settingsUnread := a.store.Unread(settingsFile) a.settings.Keymap = shortcuts.Normalize(a.settings.Keymap) - a.gitConsole.SetPreferences(a.settings.GitConsole) + a.gitConsole.RecordQueries(a.settings.GitConsole.QueryCategories()) a.loadEditorEssentials() a.initRecovery() a.applyNetwork() diff --git a/desktop/internal/workbench/commit.go b/desktop/internal/workbench/commit.go index c85a8b2b09..74ee7967cb 100644 --- a/desktop/internal/workbench/commit.go +++ b/desktop/internal/workbench/commit.go @@ -642,7 +642,7 @@ func (a *App) writeStaging(p *project, stage bool, paths []string) { // stagingDone reports a staging change that failed and reads the status again either way. func (a *App) stagingDone(p *project, stage bool, err error) { p.commit.busy = false - a.loadGit(p) + a.reloadGit(p) if err != nil { a.stagingFailed(stage, err) } @@ -662,5 +662,5 @@ func (a *App) stagingFailed(stage bool, err error) { // refreshChanges reads the project's status again. func (a *App) refreshChanges(p *project) { a.performed("git.refreshChanges", surfaceButton) - a.loadGit(p) + a.reloadGit(p) } diff --git a/desktop/internal/workbench/difftab.go b/desktop/internal/workbench/difftab.go index 27ca6b3119..b8098a460b 100644 --- a/desktop/internal/workbench/difftab.go +++ b/desktop/internal/workbench/difftab.go @@ -443,7 +443,7 @@ func (a *App) loadDiff(p *project, t *diffTab) { // loadDiffAs is loadDiff with the console query category its reads are recorded under, one of // core's GitQuery categories, or empty for the diff reads Core recognizes by their commands. -func (a *App) loadDiffAs(p *project, t *diffTab, category string) { +func (a *App) loadDiffAs(p *project, t *diffTab, category core.GitQueryCategory) { kernel, ok := a.reviewKernel() if !ok { return diff --git a/desktop/internal/workbench/git.go b/desktop/internal/workbench/git.go index f73714e14e..5631693ce4 100644 --- a/desktop/internal/workbench/git.go +++ b/desktop/internal/workbench/git.go @@ -24,12 +24,26 @@ type gitState struct { } // loadGit asks the kernel for the Git status of p and keeps the answer in p.git. The -// answer is dropped when p is no longer the open project by the time it arrives. +// answer is dropped when p is no longer the open project by the time it arrives. The status +// is read again on every repository change, too often for the console, so its queries belong +// to no category. func (a *App) loadGit(p *project) { + a.readGit(p, core.AutomaticRefresh) +} + +// reloadGit is loadGit after a Git operation the user ran, or the Changes refresh the user +// asked for: the console records its queries when it records reloads (GitQueryReload). +func (a *App) reloadGit(p *project) { + a.readGit(p, func(ctx context.Context) context.Context { + return core.WithQueryCategory(core.AutomaticRefresh(ctx), core.GitQueryReload) + }) +} + +// readGit reads the status of p under the context policy gives its request. +func (a *App) readGit(p *project, policy func(context.Context) context.Context) { kernel, root := a.kernel, p.root a.background(p, gitTimeout, func(ctx context.Context) func(*App) { - // The status is read again on every repository change, too often for the console. - status, err := kernel.GitStatus(core.AutomaticRefresh(ctx), root) + status, err := kernel.GitStatus(policy(ctx), root) return func(a *App) { a.setGit(p, gitState{loaded: true, status: status, err: err}) if err != nil { diff --git a/desktop/internal/workbench/git_exclude.go b/desktop/internal/workbench/git_exclude.go index 76ae61a874..516eeb0dcc 100644 --- a/desktop/internal/workbench/git_exclude.go +++ b/desktop/internal/workbench/git_exclude.go @@ -59,7 +59,7 @@ func (a *App) excludeLocally(p *project, change core.GitChange) { a.notifyError(i18n.SharedFormat(a.language(), "desktop.git.excludeFailed", map[string]string{"reason": reviewReason(err)})) a.operationFailed("git_exclude", err) } - a.loadGit(p) + a.reloadGit(p) } }) } diff --git a/desktop/internal/workbench/git_gutter.go b/desktop/internal/workbench/git_gutter.go index 25b72a8a69..fc2b756c46 100644 --- a/desktop/internal/workbench/git_gutter.go +++ b/desktop/internal/workbench/git_gutter.go @@ -255,7 +255,7 @@ func (a *App) stageGitGutter(p *project, d *document, h gitHunk) { a.background(p, reviewTimeout, func(ctx context.Context) func(*App) { err := kernel.StageGutterChange(ctx, root, rel, h.change) return func(a *App) { - a.loadGit(p) + a.reloadGit(p) if err != nil { a.reviewFailed("git_gutter_stage", err) } diff --git a/desktop/internal/workbench/git_history.go b/desktop/internal/workbench/git_history.go index 5d03b616f5..4c0330baa2 100644 --- a/desktop/internal/workbench/git_history.go +++ b/desktop/internal/workbench/git_history.go @@ -553,7 +553,7 @@ func (a *App) afterHistoryWrite(p *project, root string) { if root != p.git.repositoryRoot(p.root) { p.gitHistory.operationRoot = root } - a.loadGit(p) + a.reloadGit(p) if p.log.started { a.loadLog(p) } diff --git a/desktop/internal/workbench/git_rebase.go b/desktop/internal/workbench/git_rebase.go index 7c45cf466c..46f7dc33ed 100644 --- a/desktop/internal/workbench/git_rebase.go +++ b/desktop/internal/workbench/git_rebase.go @@ -234,7 +234,7 @@ func (a *App) loadRebaseSession(p *project) { // afterRebaseWrite reads the status, the log and the session again after a rebase moved HEAD. func (a *App) afterRebaseWrite(p *project) { - a.loadGit(p) + a.reloadGit(p) if p.log.started { a.loadLog(p) } diff --git a/desktop/internal/workbench/gitconsole.go b/desktop/internal/workbench/gitconsole.go index 6e5875e48c..c50ce76785 100644 --- a/desktop/internal/workbench/gitconsole.go +++ b/desktop/internal/workbench/gitconsole.go @@ -540,8 +540,13 @@ func (v *consoleView) flattenRecord(old map[consoleRowID]int, index int, r *core // stand out among the reads around them. quiet := r.Query && !failed searching := v.searchFor != "" + // The matches and hits of a presentation made under other display choices may name text + // the record no longer draws, such as a hidden repository, so the search waits for Core to + // present it again. Its fragments are still drawn meanwhile, so a long folded output does + // not open for one paint. + searched := p != nil && p.search == v.searchFor && p.display == v.display if searching { - if p != nil && p.search == v.searchFor { + if searched { v.total += p.entry.Matches } else { v.counted = false @@ -637,8 +642,8 @@ func (v *consoleView) flattenRecord(old map[consoleRowID]int, index int, r *core } v.addLines(old, index, r, next, start) next = end - // Core folds a query's output whole, a single line too when the display choices - // ask for the command line alone. + // Core folds a successful query's output longer than ten lines whole, and shorter + // output too when the display choices ask for it; it never folds a deletion's. if fragment.Kind == consoleFragmentQuery { v.addQueryFold(old, index, r, fragment, start, end, text) continue @@ -692,7 +697,7 @@ func (v *consoleView) flattenRecord(old map[consoleRowID]int, index int, r *core } } - if !use || !searching || p.search != v.searchFor { + if !use || !searching || !searched { return } var previous consoleHitKey diff --git a/desktop/internal/workbench/gitconsole_settings.go b/desktop/internal/workbench/gitconsole_settings.go index e228171d6d..f9a831ce1f 100644 --- a/desktop/internal/workbench/gitconsole_settings.go +++ b/desktop/internal/workbench/gitconsole_settings.go @@ -5,10 +5,12 @@ import "github.com/1lck/Lithe-IDEA/desktop/internal/core" // This file applies the Git console switches of the Version Control settings (matrix id // git-history). They start as IntelliJ IDEA's console. The query switches say which kinds of // internal Git queries the console records, which Core then reports for the requests that -// follow; a kind left out is never recorded, so it takes none of the journal's records. The -// display switches say how the console draws the records it keeps, which the next paint asks -// Core to present them with. The commands the user runs, failed Git requests and unexpected -// exit codes are recorded whatever the switches say. +// follow; a kind left out reports nothing while it succeeds, so it takes none of the journal's +// records, and turning a kind off frees the records its successful queries took. The display +// switches say how the console draws the records it keeps, which the next paint asks Core to +// present them with, read from the settings alone. The commands the user runs, failed Git +// requests, the failed queries of the requests the user started and unexpected exit codes are +// recorded whatever the switches say. // setGitConsolePreferences stores the Git console switches and applies them at once: the // journal records the query kinds they show from the next request on, and the console draws @@ -19,7 +21,7 @@ func (a *App) setGitConsolePreferences(preferences core.GitConsolePreferences) { } a.settings.GitConsole = preferences a.saveSettings() - a.gitConsole.SetPreferences(preferences) + a.gitConsole.RecordQueries(preferences.QueryCategories()) a.invalidator.Invalidate() } diff --git a/desktop/internal/workbench/gitconsole_test.go b/desktop/internal/workbench/gitconsole_test.go index 033914507a..247496afa9 100644 --- a/desktop/internal/workbench/gitconsole_test.go +++ b/desktop/internal/workbench/gitconsole_test.go @@ -114,8 +114,8 @@ func TestConsoleRedrawsWithTheDisplayChoices(t *testing.T) { t.Fatalf("header %q still names the repository", row.text) } } - if !h.app.settings.GitConsole.HideRepository || !h.app.gitConsole.Preferences().HideRepository { - t.Fatalf("the preferences were not kept: settings %+v, console %+v", h.app.settings.GitConsole, h.app.gitConsole.Preferences()) + if !h.app.settings.GitConsole.HideRepository { + t.Fatalf("the preferences were not kept: settings %+v", h.app.settings.GitConsole) } } @@ -591,9 +591,9 @@ func TestConsoleDrawsAFailedQueryOpen(t *testing.T) { } } -// When the display choices fold single-line queries, Core gives the one line a query fold, +// When the display choices fold short queries, Core gives even a one-line output a query fold, // which the console draws closed like any other. -func TestConsoleFoldsASingleLineQueryCoreFolds(t *testing.T) { +func TestConsoleFoldsAShortQueryCoreFolds(t *testing.T) { text := &i18n.For(i18n.English).Console record, presented := consoleQuery() record.Lines = record.Lines[:1] diff --git a/desktop/internal/workbench/github_create.go b/desktop/internal/workbench/github_create.go index f2c76a33e5..2d3b3ec2bc 100644 --- a/desktop/internal/workbench/github_create.go +++ b/desktop/internal/workbench/github_create.go @@ -323,7 +323,7 @@ func (a *App) publishCreateBranch(p *project) { } cr.blocked = creationBlockedReason(language, facts) cr.publishable = facts.RequiresPublish && !facts.Detached - a.loadGit(p) + a.reloadGit(p) } }) } diff --git a/desktop/internal/workbench/gitlog.go b/desktop/internal/workbench/gitlog.go index 1bec045b6d..5cec68f66e 100644 --- a/desktop/internal/workbench/gitlog.go +++ b/desktop/internal/workbench/gitlog.go @@ -478,6 +478,9 @@ func (in logProjection) run(ctx context.Context, kernel Kernel, root string, dat } } if in.path != "" { + // The path filter reads the files of commit after commit, which the console + // records only when it records these reads. + filtering := core.WithQueryCategory(ctx, core.GitQueryLogPathFilter) for i, c := range in.commits { if !keep[i] { continue @@ -485,9 +488,7 @@ func (in logProjection) run(ctx context.Context, kernel Kernel, root string, dat files, ok := in.pathFiles[c.Hash] if !ok { var err error - // The path filter reads the files of commit after commit, which the - // console records only when it shows these reads. - if files, err = kernel.GitCommitFiles(core.WithQueryCategory(ctx, core.GitQueryLogPathFilter), root, c.Hash); err != nil { + if files, err = kernel.GitCommitFiles(filtering, root, c.Hash); err != nil { return core.Graph{}, in.pathFiles, err } in.pathFiles[c.Hash] = files diff --git a/desktop/internal/workbench/gitreview.go b/desktop/internal/workbench/gitreview.go index b6356fb710..49462c76b2 100644 --- a/desktop/internal/workbench/gitreview.go +++ b/desktop/internal/workbench/gitreview.go @@ -228,7 +228,7 @@ func (a *App) stageUntracked(p *project, change core.GitChange) { a.background(p, reviewTimeout, func(ctx context.Context) func(*App) { err := kernel.GitStage(ctx, root, change.StagingPaths()) return func(a *App) { - a.loadGit(p) + a.reloadGit(p) if err != nil { a.reviewFailed("git_stage", err) return diff --git a/desktop/internal/workbench/gitworktree.go b/desktop/internal/workbench/gitworktree.go index 7edd3c9c77..40836ff49c 100644 --- a/desktop/internal/workbench/gitworktree.go +++ b/desktop/internal/workbench/gitworktree.go @@ -572,7 +572,7 @@ func (p *project) canCommitWorktree(path string, cs *commitState) bool { // checkoutWritten reads again what a write in the checkout at root changed: the project's // status, and the changes of the worktree at root when its Changes tab read them. func (a *App) checkoutWritten(p *project, root string) { - a.loadGit(p) + a.reloadGit(p) if root == p.git.repositoryRoot(p.root) { // The list names the project's checkout by its canonical path, which a symbolic link // in the project's path makes another. diff --git a/desktop/internal/workbench/nested_repos.go b/desktop/internal/workbench/nested_repos.go index db7c33568e..a17b62126b 100644 --- a/desktop/internal/workbench/nested_repos.go +++ b/desktop/internal/workbench/nested_repos.go @@ -206,7 +206,7 @@ func (a *App) writeNestedStaging(p *project, root string, stage bool, paths []st p.commit.busy = false // The project's status is read with the nested repositories, as the group of its own changes // may be the one that was staged. - a.loadGit(p) + a.reloadGit(p) if err != nil { a.stagingFailed(stage, err) } @@ -222,7 +222,7 @@ func (a *App) nestedCommitTarget(p *project, repo nestedRepo) commitTarget { root: repo.root, repoID: repo.id, written: func(a *App) { - a.loadGit(p) + a.reloadGit(p) }, } } @@ -276,7 +276,7 @@ func (a *App) stageAllRepositories(p *project, stage bool) { } return func(a *App) { p.commit.busy = false - a.loadGit(p) + a.reloadGit(p) a.loadNestedRepos(p) if err != nil { a.stagingFailed(stage, err) diff --git a/desktop/internal/workbench/shelf.go b/desktop/internal/workbench/shelf.go index 999609a94d..82fe87d635 100644 --- a/desktop/internal/workbench/shelf.go +++ b/desktop/internal/workbench/shelf.go @@ -389,7 +389,7 @@ func (a *App) shelfWrite(p *project, operation string, checkout bool, write func s := &p.shelf s.busy = false if checkout { - a.loadGit(p) + a.reloadGit(p) a.reloadDiffs(p, root) } a.loadShelves(p) diff --git a/desktop/internal/workbench/stash.go b/desktop/internal/workbench/stash.go index 78ec2c0cbd..a7844d56fa 100644 --- a/desktop/internal/workbench/stash.go +++ b/desktop/internal/workbench/stash.go @@ -196,7 +196,7 @@ func (a *App) stashWrite(p *project, operation string, write func(ctx context.Co return func(a *App) { s := &p.stash s.busy = false - a.loadGit(p) + a.reloadGit(p) a.loadStashes(p) a.reloadDiffs(p, root) if err != nil { diff --git a/scripts/desktop/build-desktop-core.sh b/scripts/desktop/build-desktop-core.sh index 0031776ce6..979f797e0d 100755 --- a/scripts/desktop/build-desktop-core.sh +++ b/scripts/desktop/build-desktop-core.sh @@ -27,10 +27,12 @@ native_path() { fi } -# Lithe-core-rust feat/console-filters at 9fc6468, a merge of main ad148ec into the branch: -# gitExecution.consoleQueries names the query categories the Git console records and queryCategory -# names a read the command does not tell apart; git.consolePresentation takes display options, all -# false by default as in IDEA (#2025). Its main side is #63, squash-merged into main as ad148ec: +# Lithe-core-rust feat/console-filters at 5aae479 (#64, on top of a merge of main ad148ec into the +# branch): gitExecution.consoleQueries names the query categories the Git console records and +# queryCategory names a read the command does not tell apart; git.consolePresentation takes display +# options, all false by default as in IDEA; output folds only past ten lines and a deletion never +# folds; a failed unrecorded query still reports its command, stderr and exit; a reported query's +# started event carries its queryCategory (#2025). Its main side is #63, squash-merged into main as ad148ec: # a Unix process group whose members have all exited but are not reaped yet is killed without # error, so disposing a language server or # closing an SSH session on macOS no longer reports EPERM (#2017). It is on top of #62, @@ -132,7 +134,7 @@ PINNED_CORE_REPOSITORY="https://github.com/Lithe-IDEA/Lithe-core-rust.git" # the contract, plugin guides, reference and SDKs live only in shared/plugins; on top of #16 (reported Git queries folded in the console), # #15 (git.write cherryPick, revert and reset fields), #14 (word-level changed ranges of diff # rows), #13, #8, #7, #6 and #4. -PINNED_CORE_REVISION="9fc64687c1b3acc76bc6bdfb2e5b5f209d77d431" +PINNED_CORE_REVISION="5aae479ee5ff629248585349efaf4c29541c2d45" PROFILE="debug" while [[ $# -gt 0 ]]; do case "$1" in diff --git a/shared/i18n/locales/en-US.json b/shared/i18n/locales/en-US.json index 53258e86bd..bfc010b1cc 100644 --- a/shared/i18n/locales/en-US.json +++ b/shared/i18n/locales/en-US.json @@ -10717,11 +10717,11 @@ "desktop.git.settings.parentReferences": "Show Update Parent Repository References", "desktop.git.settings.parentReferencesHelp": "Shows the option that records the new commits of submodules in their parent repositories. Turned off, the option is hidden and every commit updates the parent references.", "desktop.git.settings.console.omitted": "Git Console: Omitted Queries", - "desktop.git.settings.console.omittedHelp": "A kind that is on is not written to the Git console and takes none of the 200 records it keeps. The commands you run, failed Git requests and unexpected exit codes always show. The reads that refresh automatically as repositories change (status, gutter markers, inline blame and so on) are never recorded. Every switch starts as in IntelliJ IDEA: all omitted.", + "desktop.git.settings.console.omittedHelp": "A kind that is on is not written to the Git console and takes none of the records it keeps; turning a kind on also removes the successful queries of it the console already recorded. The commands you run, failed Git requests, the failed queries of the operations you start and unexpected exit codes always show. The reads that refresh automatically as repositories change (status, gutter markers, inline blame and so on) are never recorded. Every switch starts as in IntelliJ IDEA: all omitted.", "desktop.git.settings.console.references": "Omit Background Branch Reads", "desktop.git.settings.console.referencesHelp": "The branches and references of each repository read again in the background after a repository changes, for the branch popup and the log's repository groups.", "desktop.git.settings.console.reload": "Omit Reloads After Operations", - "desktop.git.settings.console.reloadHelp": "The status read again after a fetch, a branch update or a branch operation finishes, and the Diff tabs read again after an operation writes to the working tree or the index.", + "desktop.git.settings.console.reloadHelp": "The status read again after a Git operation you run (commit, staging, stash, shelf, rebase, branch operations, fetch, update and so on) or when you refresh Changes, and the Diff tabs read again after an operation writes to the working tree or the index.", "desktop.git.settings.console.diffRefresh": "Omit Diff Refreshes After Saving", "desktop.git.settings.console.diffRefreshHelp": "The open Diff tabs of a file read again after the file is saved.", "desktop.git.settings.console.diff": "Omit Diff Reads", @@ -10738,8 +10738,8 @@ "desktop.git.settings.console.checksHelp": "The previews, preflight checks and plans before an operation, and the other queries an operation runs for itself, such as the status.", "desktop.git.settings.console.display": "Git Console: Display", "desktop.git.settings.console.displayHelp": "These change only how the Git console draws the commands it recorded, not which it records. Copying the whole console still gives the full commands and repositories. Every switch starts as in IntelliJ IDEA.", - "desktop.git.settings.console.foldSingleLine": "Show Only the Command Line of Queries", - "desktop.git.settings.console.foldSingleLineHelp": "A recorded query's output is folded whole, a single line too, and opens on a click. Turned off, only output of several lines is folded, as in IntelliJ IDEA.", + "desktop.git.settings.console.foldShortQueries": "Fold Query Output of 10 Lines or Fewer", + "desktop.git.settings.console.foldShortQueriesHelp": "A successful query's output longer than 10 lines is folded whole and opens on a click; turned on, shorter output is folded too. A deletion (of branches, tags, references, remote branches, configuration, files, stashes or worktrees, and clean and prune) never has its output or configuration folded.", "desktop.git.settings.console.completedNotice": "Omit the “No Output” Notice", "desktop.git.settings.console.completedNoticeHelp": "No notice is shown under a command that succeeded without output. IntelliJ IDEA shows none either.", "desktop.git.settings.console.temporaryConfig": "Hide Temporary -c Configuration", @@ -11153,6 +11153,7 @@ "desktop.rebase.action.squash": "Squash", "desktop.git.console.settings": "Git Console Settings", "desktop.git.console.queryOutput": "Read output, {count} lines", + "desktop.git.console.queryOutputOne": "Read output, {count} line", "desktop.git.console.expand": "Expand", "desktop.gitHistory.undoCommit": "Undo Commit…", "desktop.gitHistory.deleteCommit": "Delete Commit…", diff --git a/shared/i18n/locales/zh-CN.json b/shared/i18n/locales/zh-CN.json index 5132e6cfe7..f3106796ef 100644 --- a/shared/i18n/locales/zh-CN.json +++ b/shared/i18n/locales/zh-CN.json @@ -10717,11 +10717,11 @@ "desktop.git.settings.parentReferences": "显示更新父仓库引用", "desktop.git.settings.parentReferencesHelp": "显示是否在父仓库中记录子模块新提交的选项。关闭后隐藏该选项,每次提交都会更新父仓库引用。", "desktop.git.settings.console.omitted": "Git 控制台:省略的查询", - "desktop.git.settings.console.omittedHelp": "打开的类别不写入 Git 控制台,也不占用控制台保留的 200 条记录。你执行的命令、失败的 Git 请求和意外的退出码始终显示。随仓库变化自动刷新的读取(状态、行号区标记、行尾 Blame 等)从不记录。初始状态与 IntelliJ IDEA 一致:全部省略。", + "desktop.git.settings.console.omittedHelp": "打开的类别不写入 Git 控制台,也不占用控制台保留的记录;打开某个类别时,控制台已记录的该类成功查询也一并移除。你执行的命令、失败的 Git 请求、你发起的操作中失败的查询和意外的退出码始终显示。随仓库变化自动刷新的读取(状态、行号区标记、行尾 Blame 等)从不记录。初始状态与 IntelliJ IDEA 一致:全部省略。", "desktop.git.settings.console.references": "省略后台分支读取", "desktop.git.settings.console.referencesHelp": "仓库变化后在后台重新读取的各仓库分支与引用,供分支弹窗和日志的仓库分组使用。", "desktop.git.settings.console.reload": "省略操作后的自动重新加载", - "desktop.git.settings.console.reloadHelp": "获取(Fetch)、更新分支或分支操作完成后重新读取的状态,以及操作写入工作区或暂存区后重新读取的差异标签页。", + "desktop.git.settings.console.reloadHelp": "你执行 Git 操作(提交、暂存、贮藏、搁置、变基、分支操作、获取、更新等)后或刷新更改列表时重新读取的状态,以及操作写入工作区或暂存区后重新读取的差异标签页。", "desktop.git.settings.console.diffRefresh": "省略保存后的差异刷新", "desktop.git.settings.console.diffRefreshHelp": "保存文件后重新读取该文件已打开的差异标签页。", "desktop.git.settings.console.diff": "省略差异读取", @@ -10738,8 +10738,8 @@ "desktop.git.settings.console.checksHelp": "操作前的预览、预检和计划,以及操作为自己读取的状态等其他查询。", "desktop.git.settings.console.display": "Git 控制台:显示", "desktop.git.settings.console.displayHelp": "只改变已记录命令在 Git 控制台里的显示方式,不影响记录哪些命令。复制全部内容时仍包含完整命令和仓库。初始状态与 IntelliJ IDEA 一致。", - "desktop.git.settings.console.foldSingleLine": "查询只显示命令行", - "desktop.git.settings.console.foldSingleLineHelp": "已记录查询的输出全部折叠,只有一行也折叠,点击可展开。关闭时只折叠多行输出,与 IntelliJ IDEA 一致。", + "desktop.git.settings.console.foldShortQueries": "折叠 10 行以内的查询输出", + "desktop.git.settings.console.foldShortQueriesHelp": "成功查询的输出超过 10 行时整段折叠,点击可展开;打开此项后,10 行以内的输出也折叠。删除类命令(删除分支、标签、引用、远程分支、配置、文件、贮藏或工作树,以及 clean、prune)的输出和配置从不折叠。", "desktop.git.settings.console.completedNotice": "省略“执行成功,没有输出”提示", "desktop.git.settings.console.completedNoticeHelp": "命令成功结束但没有输出时,不在命令下方显示这条提示。IntelliJ IDEA 也不显示。", "desktop.git.settings.console.temporaryConfig": "完全隐藏临时 -c 配置", @@ -11153,6 +11153,7 @@ "desktop.rebase.action.squash": "压缩", "desktop.git.console.settings": "Git 控制台设置", "desktop.git.console.queryOutput": "读取结果,共 {count} 行", + "desktop.git.console.queryOutputOne": "读取结果,共 {count} 行", "desktop.git.console.expand": "展开", "desktop.gitHistory.undoCommit": "撤销提交…", "desktop.gitHistory.deleteCommit": "删除提交…", diff --git a/shared/i18n/messages.json b/shared/i18n/messages.json index 83f25659a1..33455be2d6 100644 --- a/shared/i18n/messages.json +++ b/shared/i18n/messages.json @@ -9788,7 +9788,17 @@ }, { "id": "desktop.git.console.queryOutput", - "description": "Desktop Git console: stands for the folded output of a read-only Git query.", + "description": "Desktop Git console: stands for the folded output of a read-only Git query, count lines, count other than one.", + "platforms": [ + "desktop" + ], + "parameters": { + "count": "string" + } + }, + { + "id": "desktop.git.console.queryOutputOne", + "description": "Desktop Git console: stands for the folded output of a read-only Git query of a single line.", "platforms": [ "desktop" ], @@ -10191,7 +10201,7 @@ }, { "id": "desktop.git.settings.console.omittedHelp", - "description": "Help of the Git console omitted-queries card: what an omitted kind means and what always shows", + "description": "Help of the Git console omitted-queries card: what an omitted kind means, that omitting one removes its recorded successful queries, and what always shows", "platforms": [ "desktop" ] @@ -10337,15 +10347,15 @@ ] }, { - "id": "desktop.git.settings.console.foldSingleLine", - "description": "Git console switch: show only the command line of a recorded query, folding even single-line output", + "id": "desktop.git.settings.console.foldShortQueries", + "description": "Git console switch: fold a successful query's output of ten lines or fewer too, not only longer output", "platforms": [ "desktop" ] }, { - "id": "desktop.git.settings.console.foldSingleLineHelp", - "description": "Help of the Git console switch that folds single-line query output", + "id": "desktop.git.settings.console.foldShortQueriesHelp", + "description": "Help of the Git console switch that folds short query output: when output folds, and that a deletion never folds", "platforms": [ "desktop" ] diff --git a/shared/platform-feature-matrix/features/git-history.json b/shared/platform-feature-matrix/features/git-history.json index 25137f9570..f82b21202d 100644 --- a/shared/platform-feature-matrix/features/git-history.json +++ b/shared/platform-feature-matrix/features/git-history.json @@ -47,7 +47,7 @@ }, "owner": "Git", "verification": "双端多仓库打开 Git Log:隐藏中间工作树后其余仓库颜色保持,切换工作区不得显示旧颜色;共享 Core fixture、跨页桥接和异步界面测试覆盖,完整原生界面及滚动性能验收 pending。 提交历史由 Core 保留作者时区及绝对时间,macOS 与 Windows 日期展示使用该时间;macOS 日期范围通过 Core 按绝对边界比较,系统日历计算夏令时边界。真实 Git、跨时区、重复小时、23/25 小时日及原生缓存回归覆盖;完整双平台界面人工验收仍 pending。 Windows cherry-pick 资格根据当前 HEAD 标识判断,不能把筛选结果第一行当作 HEAD;真实菜单回归覆盖其他分支首行可操作和非首行 HEAD 禁用。分页浏览提交历史、分支图谱和提交详情,确认日期、作者和文件列表一致;macOS Git Log 工具窗口标签悬停有反馈,点击窗口内外时选中标签背景在活动色与非活动色之间切换,标签文字保持相同颜色与常规字重,按下时不变暗;分支最新提交的图谱连线从提交圆点开始,不超出到圆点上方;在双端使用同一包含本地分支、远端引用、标签和合并提交的仓库,核对永久图布局、图头引用排序、合并边投影及跨越 30 行的紧凑长边;在本地分支新增提交后确认分支颜色保持稳定,且不会因共用屏幕泳道直接沿用父分支颜色。双端使用 Community 完整颜色 ID 及明暗主题 RGB 规则;macOS Git Log 不再显示单独的 Fetch/Compare/Checkout/Cherry-pick 横向操作栏,分支树与竖向工具栏分离;检查 Fetch、分支比较、分支右键 Checkout、提交右键 Cherry-pick 和 Fetch 设置仍可用,分支搜索可筛选嵌套路径,并隐藏无匹配项的分组、显示无结果提示;定位按钮滚动到当前所选分支的首个可见提交而不重新加载历史;Git Log 的分支和提交搜索框复用 全局唯一的 LitheSearchFieldStyle,对照 IDEA SearchFieldWithExtension,核对 13pt 常规提示文字、Islands 明暗控件底色与边框色、36pt 外框内的 30pt 可见高度、3pt 外层留白、1pt 常态内描边、向外扩 1pt 的 2pt 聚焦描边及 4pt 圆角;图标与文字间距为 2pt,输入框清除按钮复用已有 16pt IDEA SVG 和 20pt 按钮区域,按上游预留清除图标宽度,移除分支搜索框重复外层水平内边距,提交搜索框按 15 列字体度量和 150pt 最小宽度布局,Search 与 Database 搜索输入框使用相同共享样式;竖栏更新按钮采用 IDEA ExpUI 的明暗 update 图标,按钮与侧边栏图标悬停使用共用工具提示样式,提示的明暗背景、文字色、1pt 内描边、圆角及内边距对齐 IDEA HelpTooltip;隐藏与显示分支使用 IDEA ExpUI 的 chevronLeft/chevronRight 明暗图标;竖栏宽 36pt,展开态按钮为 22pt 且四周保留工具栏内边距,展开态分支树左边框复用与 Commit 标题下边框同源的 1pt 分隔线;收缩态竖栏常态复用展开态侧栏背景,展开与收缩保留提交图谱和详情视图实例、滚动状态及分支宽度,仅切换分支面板与分隔条的占用宽度,按钮占满竖栏,深色 hover 使用 Islands Dark 的 #FFFFFF17,浅色 hover 使用 ExpUI Gray12,不在右侧显示 Show Branches 浮层提示,图标在顶部留 8pt 并使用常规小字号文字;展开后恢复分支树宽度。 使用原生 NSHostingView 渲染验证共享 LitheSearchTextField 的占位文字在深浅主题均为 IDEA Component.infoForeground 对应的 #73767C、13pt 常规字重;空输入框单独绘制占位文字,避免 SwiftUI 原生 prompt 替换其颜色与字重,有内容时占位文字消失并保留原生编辑和主文字色。 Git Log 分支树按 IDEA Community Islands 普通密度核对 24pt 行高、无行间额外间距、13pt 常规文字、12pt 次要计数与 4/12pt 树边距;展开箭头、路径文件夹、普通分支、当前分支和标签使用上游 16pt 明暗 SVG,Local/Remote/Tags 标题不附加图标,当前分支不显示额外蓝色勾选;HEAD 与当前分支是两个互斥选中节点,点击分支、HEAD、清除筛选和切换仓库时核对选中状态;深浅主题核对树行焦点/失焦选中色及 hover,保留多仓库名称、圆点、数量和只读菜单,移除分支行仓库色条;Windows 多仓库分支树的仓库行与 macOS 一致,仓库行使用中性色文件夹图标,并只在图标与名称之间显示 8px 仓库色点,仓库名保持普通文字色,不出现整组着色卡片底色、左侧色条或彩色名称,截断名称通过共享工具提示显示全名,行悬停为箭头光标;确认搜索、分组折叠、右键操作、缓存行比较和滚动状态正常。 Git Log 分支树右侧分隔线与 Commit 标题下边框共用 LitheTheme.toolWindowBorder 和 1pt 厚度,深色为 #26282C、浅色为 #E9EAEE;悬停、拖动开始/移动/结束均保持同色,不高亮,保留原生调整光标、命中区域、拖动尺寸约束及提交宽度行为。 Git Log 中间栏按 IDEA Community FilterComponent、VcsLogGraphTable 和 PaintParameters 核对四个筛选器的 13pt 常规文字、4pt 内边距、16pt 箭头和仅文字悬停反馈;工具栏使用 16pt IDEA 明暗 SVG、22pt 点击区域和共享提示,保留动作及禁用条件;提交列表为 26pt 连续行,图谱尺寸同比缩放,作者与日期同为 13pt 主文字色,日期列按打包字体度量,核对深浅主题行 hover、焦点/失焦选中色及选中覆盖 hover,筛选、分页、箭头命中、上下键导航和右键操作不回归。 分支竖栏设置齿轮复用 LitheIconButtonStyle 的 22pt 点击区域、4pt 圆角和主题 hover/按下背景;点击使用 LitheContextMenuPresenter 的共享操作菜单背景、1pt 边框、行 hover 与键盘导航,保留 Fetch Options 对话框、Show Worktree Repositories 勾选和无工作树时禁用行为,点击外部或按 Esc 关闭菜单。 macOS 下拉菜单仅保留 Project 同源的一套全局共享样式,移除 settingsStyle 切换;Project、Git Log 设置、Terminal、欢迎页及右键子菜单统一使用 8pt 外框圆角、1pt 内描边、24pt 行高、12.5pt 文字、6pt 外留白和 8pt 行内边距,设置选择下拉框共享同一外框与尺寸定义; Git Log 顶部按 IDEA 恢复 Branch: 已选分支名称,保留 Branch 筛选、清除和菜单内勾选;Branch、User、Date、Paths 按 IDEA FilterComponent 保留 4pt 内边距、3pt 箭头间距和 13pt 常规文字,四项文字 hover 为白色且不增加底色。Date 使用共享菜单呈现器,Branch/User 的可搜索列表与分组子菜单使用共享 LitheDropdownRowStyle、24pt 行高和共享菜单外框,Paths 输入面板复用共享菜单外框及搜索输入框样式,保留搜索、选项选中、路径 Apply/Cancel/Clear 和时间范围计算。 Branch/User/Paths 原生弹窗锚点不参与鼠标命中,核对按钮与文字收到 hover/点击、菜单正确弹出且关闭后可再次打开;Date 保持共享菜单呈现器。共享下拉外框裁剪内部内容,明暗主题下 Branch/User 搜索条不能覆盖圆角;Paths 输入框复用共享输入样式并显示正确焦点边框,Clear/Cancel/Apply 复用共享次按钮/主按钮,保留路径应用和清除行为。Branch、User、Paths 的可搜索内容同样使用 LitheContextMenuPresenter 的透明无边框面板,去掉 NSPopover 系统外框,复用 Project 共享背景、1pt 边框和圆角;分组展开与搜索动态调整弹窗尺寸,Esc、点击外部和切换菜单正确关闭。选择分支后清除筛选,确认 Branch 恢复默认标题且关闭按钮消失;关闭按钮保留 16pt closeSmall 明暗 SVG、22pt hover 区域及 4pt 圆角。展开分支树左侧固定线、中间分隔线和右侧详情拖动线均使用 toolWindowBorder 的 1pt 边框,右侧 hover 与拖动不高亮。右侧详情展示图标使用 IDEA previewVertically 明暗 SVG,装饰开关使用 show 眼睛而非 hide 工具窗口减号;所有工具栏展示图标复用 22pt、4pt 圆角的共享 hover 背景,保留原动作与提示。深浅主题渲染核对背景和边框,保留可选图标、勾选、快捷键、禁用、子菜单和键盘导航。 Git Log 提交标题、作者和日期使用 Inter 13 Normal,引用标签 12pt;核对至少 26pt 的字体度量行高、含 leading 的整数基线、长标题与中文/emoji 截断,以及选中合并提交的文字颜色。 所选分支存在时 Log 标签显示 Log: 分支短名(包含 codex/ 路径),选择另一分支立即更新;清除分支筛选后恢复 Log,保留本地化标题、原始分支名和原标签选择/焦点行为。 macOS 标题起点按缩放图谱列距、图文间距和 2pt 文字内边距计算,为对齐参考截图至少预留六列,密集行继续扩宽,不改变图谱节点、连线和箭头命中;在 SwiftUI/AppKit 两条渲染路径核对未选中的合并提交标题、作者、日期统一使用合并灰色,选中后恢复普通文字色,合并判定仅依赖至少两个父节点。 Git Log 右侧文件树使用共享 24pt 行高、19pt 层级缩进、常规字重、文件类型图标和 IDEA FileStatus 文件名颜色,无逐行横线及工具栏重复总数;核对文件夹折叠、文件打开 diff、长名称 hover 展开与横向滚动,拖动宽度不重建行内容。提交详情使用 14pt 外边距、10pt 内间距、等宽 bold 标题、同段作者邮箱时间与引用标签,长内容可滚动;文件树/详情之间分隔线复用共享边框,hover/拖动不高亮。左侧分支树从 180pt 专用下限改为共享 30pt 下限,独立 36pt 竖栏保持原宽,窄树裁剪后可拖回原宽,收缩/展开不重建图谱。 图谱圆点、连线、箭头按 SimpleGraphCellPainter/ PaintUtil 的 FLOOR/ODD 物理像素规则对齐;在 1×/2× 原生位图验证圆点与线宽,在真实 NSHostingView 检查对齐后的上下斜向箭头尖端及内侧描边可导航,切换屏幕只重绘且绘制/命中坐标一致。 时间列复用 Inter 13 常规字体的等宽数字与固定 AM/PM 区域,按应用语言使用英文 12h AM/PM 或中文 24h 格式;核对午夜、正午、未知日期回退、行起点一致及切换语言后的原生日期缓存失效,列表两条渲染路径和提交详情使用相同格式。 连续上下拖动 Git Log,包含上方长 Diff:原生列表只调整可见区域,保持文档身份、滚动位置、Shift/Command 多选、焦点色、键盘与箭头导航、分页和辅助功能;收缩再恢复后列表宽高正确。GitGraphInteractionTests 使用 300 条提交、80 次原生尺寸变化和共享分隔条事件验证,局部新旧路径计时作为诊断,不代替目标工作区帧率验证。 共享分隔容器按已有宽高直接分配两个面板与分隔条的确定矩形,避免 HStack/VStack 最小及理想尺寸探测;splitPaneBounds 覆盖横纵方向、leading/trailing、折叠、子视图身份和有限尺寸,达到尺寸限制后的相同结果不重复写状态。 通过键盘或程序化切换焦点时 Git 标签活动态双向更新;挂载或重新显示 Git Log 不主动抢走编辑器焦点。 在包含展开分支树的 Git Log 中连续拖动外层高度和内部宽度:共享分隔器只在拖动开始/结束传播环境状态,嵌套容器继承祖先状态;拖动期间共享行悬停不更新、提示不登记几何锚点、右键覆盖层暂停,松开后恢复菜单和提示,行内容及滚动状态不重挂载。69 行原生分隔条事件回归检查覆盖层暂停/恢复及内容身份;未悬停控件在平时同样不登记提示锚点。用目标工作区 Time Profiler/Animation Hitches 对照 Terminal 核对持续更新成本及起止开销,split.drag 整次手势时长不能当作单帧延迟;本次仅前端共享交互装饰调整,不修改后端及默认详情高度行为。 中文输入法组词期间,即使绑定文本仍为空,共享 LitheSearchTextField 占位文字立即隐藏;取消组词或删空后恢复,确认中文后仍隐藏。原生 setMarkedText 回归覆盖明暗主题和两个输入框互不影响;保留焦点、键盘提交、搜索/过滤语义及占位字号颜色。原生背景观察视图卸载和移出窗口时清理通知,匹配当前窗口的字段编辑器及所属输入区域,不修改业务绑定。 四个筛选弹窗均以各自按钮左下角为定位锚点,Date 不依赖鼠标点击坐标;空间不足时限制在屏幕可见范围内。原生面板回归核对操作菜单/可搜索内容相同锚点下的左上角、无展开动画和 Esc 关闭回调。共享搜索字段在未聚焦时悬停也显示文本编辑光标,离开或禁用时恢复箭头。 Git Console 左侧六个现有动作使用 Community 原始 16pt 明暗 SVG;22pt 背景、竖向 2/1 按钮留白、5/7 外边距和默认箭头光标。核对查找、软换行、跟随、停止、清空、复制的原有动作与禁用状态,组件资源检查不替代完整应用验收。 按 Community CurrentBranchHighlighter 标出当前本地分支可达的所有父提交,包含合并父节点;深色 #1D2336、浅色 #EDF3FF,选中背景优先,仅已加载图谱可证明的祖先被标记,当前分支/HEAD 单独筛选时不重复染色。引用默认显示并按 GitRefManager/SimpleRefGroup 紧凑合组:本地与上游同提交显示 remote & branch,HEAD/本地/远端/标签使用官方黄/绿/紫/灰轮廓及叠层,标签单独存在时默认只显示图标;长名称按列宽和 22 字符下限缩写,原生可见区 tooltip 保留所有完整名称,滚动后按当前鼠标位置解析。明暗原生渲染检查颜色、宽度、选择优先级及完整名称;GitLogReferenceResizeTests 在真实 GitLogView 中加载 1000 个分支并拖动外层高度,检查可见右键覆盖层数量和挂载生命周期,计时仅作诊断。最新正式预览已进入该工作树,观察全部引用下的深色背景、叠层缩写标签和多次上边缘拖动后的布局恢复;用户随后在本机明确确认“现在不卡顿了”,本次报告的高度拖动卡顿通过用户实机验收;组件计时和混合工作区采样不用于推断唯一根因或量化通用帧延迟,其他主题/悬浮等视觉项继续按各自范围验收。 在 Windows Git Log 选中带多行正文的提交,确认右侧详情在标题下方完整显示正文(保留空行与缩进),复制提交信息和打开提交 Diff 时也包含正文;分支最新提交的图谱连线从提交圆点开始,不超出到圆点上方;在双端使用同一包含本地分支、远端引用、标签和合并提交的仓库,核对永久图布局、图头引用排序、合并边投影及跨越 30 行的紧凑长边;在本地分支新增提交后确认分支颜色保持稳定,且不会因共用屏幕泳道直接沿用父分支颜色。双端使用 Community 完整颜色 ID 及明暗主题 RGB 规则。 读取提交正文期间切换仓库、重新打开另一提交或关闭面板,确认迟到结果不会打开旧 Diff 或覆盖新请求的加载状态。 Windows 另验证:单击提交后编辑区预览该提交第一个文件的 diff;单击或双击 Commit files 中的文件只显示该文件的 diff(不含提交说明,也不显示文件列表),并复用同一个预览标签;Commit files 树中过长的文件或目录名不折叠为省略号,区域随最宽行横向展开,可通过横向滚动条或触控板侧滑左右滑动查看完整名称(与源代码管理变更树一致);Git Log 刚打开、尚未点击提交时不会自动打开 diff;日期列将有 UTC 偏移的提交转换到本机时区后显示相对时间(刚刚、N 分钟前、今天/昨天);英文绝对日期和时间通过 Windows 原生接口遵循系统短日期/时间及用户自定义格式,中文使用中文地区格式,未知偏移仍显示绝对日期;验证美式月/日/年、英式日/月/年、自定义分隔符、12/24 小时制、跨时区相对时间和迟到原生结果保护,真实 WebView2 产品验收为 pending;鼠标移入行时刷新相对时间;作者/日期列可在行内列边缘拖动调整宽度并在重启后保留。 非连续多选提交修改同一路径时,预览保留每个提交的 diff 和提交标识,可通过文件导航分别查看;延迟请求返回前取消选择、隐藏 Git Log、切换仓库或卸载工具窗,确认旧请求不会重新打开或激活预览标签。 Windows 端提交历史仅通过 Git Log 工具窗浏览:源代码管理侧栏入口已更名为 Commit 面板,其 History 标签已移除,面板固定显示变更列表与提交区。命令面板中的 Git: Show History 入口同步移除。 Windows Commit Files 单文件预览使用独立页面:上下箭头导航差异,下箭头在当前文件最后一处后继续进入下一文件并在比较完成后定位第一处差异,整个文件集合末尾禁用且不循环;图片、二进制和无文本差异文件也允许下箭头继续,比较未就绪时禁用以防连续点击跳过文件。左右箭头直接切换当前比较集合的上一文件/下一文件;标签使用 IDEA 的 Repository Diff: 文件名并跟随导航更新,不附加提交 hash。Jump to Source 按最后聚焦侧的补丁位置打开预览所属仓库的文件,重命名使用新路径、删除行映射邻近保留行、已删除文件禁用源跳转;模型更新期间禁用差异动作。保留并排/统一视图、空白显示、Monaco 查找、图片和二进制呈现,普通全量提交比较仍使用多文件页面。真实 WebView2 内核及源文件打开还需目标产品运行验收。 Windows 单文件历史 Diff 外观验证:并排视图使用独立外侧 12px 滚动轨道、8px 滑块和概览,通常的统一视图保留 Monaco 原生 Diff 组件,整文件新增使用真实新行流的独立只读控件,深浅主题检查常态/悬停/拖动色、圆角及边框;实际拖动任一并排滑块后按差异边界同步对应行且模型身份保持。工具栏使用现有 Button,核对 40px 高度和 22px 图标按钮;保留用户字体与字号,默认行距按 14px 字号对应 22px 并随缩放,自定义行距不覆盖。词级高亮开关复用现有 Monaco 装饰能力,关闭只隐藏字符差异、保留整行差异,切换文件保留词级和空白开关。旧/新版本标题显示真实第一父提交、范围基线/目标或非连续提交各自身份,根提交旧侧为空树,重命名显示旧/新路径;短 hash 和截断路径的 tooltip 保留全文。并排标题列宽由独立布局所有者更新 CSS,拖动分隔条时标题跟随且不重建模型;统一视图标题纵向排列。以上浏览器真实组件验证不替代目标 WebView2 产品验收。 Windows 单文件 Diff 滚动条回归:两侧横纵滚动条默认显示,鼠标移到工具栏后仍可见,不依赖悬停;差异概览不绘制重复的宽矩形视口指示,并排由独立外侧轨道负责点击、拖动和滚轮,统一视图保留原生委托。明暗主题、并排/统一视图及长文本双向溢出下检查唯一可见滑块、并排横向同像素偏移同步、纵向对应行同步和模型身份。 历史 Diff 两侧滚动轨道与代码编辑器概览画布背景透明,鼠标不悬停时滑块仍显示;关闭代码编辑器重复概览通道,但保留 Diff 专用差异色条。横向轨道不额外增加内容高度,检查代码能显示在滑块后、底部内容与滚动位置正确,拖动命中保留,并排两侧横向同像素偏移同步、纵向对应行同步。 Windows 并排单文件 Diff 使用两个独立只读 Monaco 代码控件,取消 DiffEditor 的补空白对齐。左右横向滚动按同一像素偏移双向同步,较短侧由 Monaco 钳制到真实内容边界且不反向拉回主动侧;纵向原生代码区、外侧滑块拖动/点击、轨道键盘、滚轮和查找以视口三分之一处为锚点,按 Git 差异块起止边界同步对应行并保留行内偏移,短侧在不等长块内钳制、共同上下文恢复对齐。同步有重入与微小方向保护;双模型替换、布局、字体配置和显式上下导航期间暂停同步。新增旧侧/删除新侧画横跨可见代码区的双像素零行边界,修改区画上下单像素边界;两列行号背景为直边,曲线只在两列之间弯曲,实际偏移改变端点形状。检查文件开头/末尾零行、三态、明暗主题和窄列,代码不补空白、不扩展横向范围;连接面覆盖两列历史行号背景,行号选择和源映射正确。左右外侧各显示透明常显纵向滑块与增删改概览,横向保留原生滚动条,滚动范围截止真实最长代码行。验证深浅主题、折叠展开、Ctrl/Cmd+F 搜索折叠文本、词级开关和预算、统一视图及跨文件首处定位、连续拖动和窄窗口非负尺寸。高频帧二分筛选可见差异,缓存像素边界及概览,不扫描全文、不更新 React;卸载和迟到语言准备清理所有帧、监听、观察器、拖动、两个编辑器和模型。浏览器生产组件验证使用平台记录器,真实 WebView2 产品验收仍为 pending。 外侧轨道预留独立空间,不显示代码;左轨道距面板边缘、右轨道距代码视口各留 4px 间隙,窄列随可用宽度缩减,右侧文字与轨道不重叠;并排和统一预览关闭缩进及括号引导线,保留语法颜色;中央行号缩小边距和曲线间隙,整数布局边界及上下半像素描边消除与代码区的垂直接缝。滚轮在代码、行号和轨道统一加快到两倍,拖动仍映射各侧真实进度,纵向同步对应行;方向键按用户行高移动。有词级结果时修改正文底色按 40% 修改色与 60% 页面背景混合,完整修改色突出替换词的两侧,纯新增和纯删除词分别使用完整增删色,语法前景色和文字透明度保持;关闭词级或超限保留整行底色。验证三态与开头末尾、双向对应行同步、明暗主题、轨道无遮挡、宽窄字体布局和预算回退。 单文件并排及统一视图隐藏补丁 @@ 标题,但保留真正以 @@ 开头的源码、行 ID、源行映射和原始补丁;默认多文件与暂存投影不变。Islands Dark 继承 Darcula 背景,Islands Light 使用 Light 方案,独立差异轨道标记与连接、代码边界共用对应差异背景色。底部保留五个用户实际行高的 padding,模型不增加假行;从任意侧滚到底部验证共同末行对齐与五行留白,字号/行距变化同步更新。 Windows 单文件 Diff 首次打开、左右切文件和同路径新比较均在模型/比较准备完成后定位第一处改动;定位只消费一次,调整词级、空白、字号或主题保持用户当前位置。统一视图的原生 Monaco 增删行、字符与行号栏使用该预览相同的 Islands 背景变量,移除默认字符边框;新增整文件应为深色 #294436 或浅色 #BEE6BE,删除为 #484A4A 或 #D6D6D6,语法前景色不变且其他编辑器主题不被覆盖。 整文件新增采用单流只读代码控件,隐藏不存在的旧侧与连接带,新增背景覆盖行号、代码和底部留白,避免空旧模型的灰色删除行及外圈;新增仅显示新版本、删除仅显示旧版本的一组 hash 与路径。并排两侧及新增单流轨道的增删改标记与对应内容背景共用颜色;原生统一预览关闭 renderIndicators,历史行号旁不显示 +/-。这组新增显示修复按用户要求延后运行验证,提交或 PR 前核对新增文件、普通修改、删除、深浅主题、查找、源跳转与底部留白。 Windows Git Log 单文件和 Commit 文件 Diff 的词级高亮、显示空白符、统一/并排切换均在左侧,最右侧统计当前文件差异,区分无差异/单数/复数;Commit 勾选、部分包含、取消及刷新后 included 数同步变化,全部包含仍显示数量;加载、切换文件及图片/二进制不显示文本差异统计。核对中英文、明暗主题、窄窗口和按钮选中/禁用状态。 Windows 单文件 Diff 上箭头在首处继续进入上一文件最后一处,下箭头在末处进入下一文件首处,集合首尾不循环、加载中禁用;Commit 文件列表随跨文件导航更新选中行并展开祖先、滚动到可见位置,保留编辑器焦点和 include 状态;同文件刷新、历史 Diff、无关仓库和迟到读取不扰动列表。 Windows Git Log 右下角 Commit files 列表同样跟随 Diff 的上一/下一文件导航:选中行移到当前文件,被折叠的父目录自动展开,行滚动到可见位置;预览属于其他提交或范围时不改变选中,点击行不会改变横向滚动。 Windows Git Log 筛选后基于完整已加载历史投影可见祖先:隐藏中间提交以虚线连接,直接父子保持实线,无关分支不误连;合并路径去重并保留永久颜色,未加载父提交经隐藏节点传播,分页补齐后解除缺失标记;清空筛选恢复原图,核对文本、作者、分支名称三种范围、空结果与选择行为。算法和真实表格组件回归通过不代替 WebView2 原生验收,原生验证保持 pending。 Windows 未筛选图与筛选图共用上下半边打印元素:普通浏览的跨行泳道换列必须在共同中点连续连接,合流入边保留各自颜色到提交圆点;核对原始 IDEA 200 条历史输出的列号、方向、终止和颜色身份;截图/原生交互验收仍为 pending,组件输出和 golden 对照不代替 WebView2 验收。 Windows Git Graph 外观:核对明暗主题真实 IDEA RGB、实心节点、直线与筛选虚线、终止箭头及至少六列标题预留;默认 26px 行高,用户字号变化时虚拟行与 SVG 同步扩高;在 100%/125%/150%/200%/300% 缩放及跨屏 DPI 变化下核对奇数物理像素和相邻半边连续性,普通视口调整不重建历史图。箭头能跳到已加载且可见的父/子提交,未加载父节点没有可点击目标;浏览器生产组件验证不代替目标 WebView2 运行验收,原生验证保持 pending。 Windows 历史排序和图导航:在交错分支仓库核对首批/分页/回退及全引用上下文均使用日期顺序,切换分支保持可证明的永久颜色和基础顺序;上下文最多 5000 条,覆盖不完整或哈希重复时保留可见页并回退。核对 upstream/backup 等非 origin 远程引用分类及本地含斜杠分支;背景上下文不阻塞 50 条可见页,分页不取消或重读上下文,切仓库/刷新/卸载取消旧操作且关闭迟到游标。长边开关展开/收起不改变提交、筛选、选择和游标;验证 30/1000 行边界。点击或用 Enter/空格激活上下箭头,选择并滚动到屏幕外端点,挂载后键盘焦点随目标;不误选源行、不误开源行 Diff,保持普通选择/多选/双击/右键和原预览入口。明暗主题及 1x/1.25x/2x 检查箭头尖端与命中范围,真实 WebView2 运行验收保持 pending。 图谱颜色必须跟随 ThemeRegistry 根 data-theme-type 切换;不依赖页面存在 dark class。复用真实 Lithe 明暗主题检查同一已挂载节点与连线的颜色变化、布局不因主题重算,结合主题回归和浏览器真实切换验证。 Windows 分页稳定性:选中顶部提交后向下滚动触发连续分页,确认滚动位置不跳回已选提交,Commit Files 不清空或重读,已选文件及树折叠保持;更新引用、背景上下文和相同 hash 的元数据同样不导航。定位分支头通过独立请求仍能定位已经选中的头提交一次;新选择或切仓库仍读取新文件并丢弃旧结果。组件回归与真实浏览器虚拟列表/IntersectionObserver 验证通过,目标 WebView2 实机验收保持 pending。 Windows Git Log 标题栏不显示固定 Read-only/只读文字,关闭按钮保持靠右,刷新、设置及隐藏操作正常。 Windows Git Log 单个提交右键 New Tag… 输入非空且无空白的标签名,创建指向右键提交完整 hash 的轻量标签并刷新引用和历史;取消不写入,失败保留名称可重试,双击/Enter 不重复创建,多选和写操作期间禁用。仓库或工作区切换关闭旧弹窗,旧请求迟到不得刷新或关闭新弹窗。 Windows 提交区域点击后上下箭头更新可见提交选择和详情,焦点不随虚拟行移除而丢失;筛选、首尾边界、Home/End、Shift 范围选择和 Enter 正常,菜单与输入框保留自己的方向键。 Windows Git Log 鼠标或上下键选择提交后,异步 Diff 自动定位第一处改动但保持提交列表键盘焦点;并排与统一预览均不调用初始 focus。双击/Enter 打开完整 Diff、主动差异跳转及跨文件导航仍进入编辑器。 Windows Git Log 提交右键 New Tag 使用与 Tags 节点同源的 TagIcon(沿用现有标签轮廓图案),核对 16px 图标、菜单对齐和禁用反馈;新补图标的实机视觉确认待完成。 Windows 提交列表菜单键和 Shift+F10 打开当前选中提交的真实菜单;关闭后列表继续上下键导航,菜单操作仍针对所选提交。New Tag 在 tag.gpgSign=true 下生成轻量标签,不运行签名器或消息编辑器,不修改配置。 Windows 提交行高亮和紧凑引用组:在全部引用和其他分支视图核对当前检出分支全父祖先背景,当前分支/HEAD 视图关闭重复高亮;合并提交的说明、作者、日期未选中时弱化、选中后恢复,选中背景优先于分支并区分列表/文件树/窗口焦点。核对明暗主题固定基准色、真实 upstream 合并名称、游离 HEAD、每种最多两个叠加图标、仅标签图标和完整汇总悬停/无障碍提示。宽窄列及字号变化时按至少 22 字符缩略规则布局,只有一个视口尺寸观察器,列拖动不逐行读取宽度,卸载清理;分页不丢滚动/选择,成功后不重读 Commit Files;文件读取失败时 Commit Files 面板显示重试入口,重新选择同一提交或刷新历史也会重试一次,长边导航和新建标签原入口保持。组件与浏览器验证通过,目标 WebView2 实机验收 pending。 Windows Git Log 分支树和提交列表的普通滚轮使用 Community Windows 默认 200ms 和 (0.5,0.505,0.5,1) 曲线;连续同向累积、反向从当前位置重启。核对两处列表的中间帧、Shift 横向滚动、分页保持、顶底边界、键盘定位和滑块拖动取消惯性、关闭工具窗清理帧以及减少动态效果偏好。确定性动画与 DOM 回归通过,真实 WebView2 设备手感验收保持 pending。 Windows graph 标题不再固定预留六列:建议宽度取可见图边数的加权均值与标准差,最多以六列作统一基线,每行按节点与斜边中点扩展,密集行不把其他简单行扩成最大列宽。验证单线/少分支、罕见密集合并、超过六列、筛选、长边开关、引用标签可用宽度及字号/DPI,保持图谱颜色/连线/导航不变。 Windows Git Log 的 Commit Files 文件树沿用 IDEA Windows 默认 200ms 滚轮动画;在文件行、竖向/横向滚动条区域连续滚动、反向及 Shift 横向滚动,确认共用真实视口的动画目标,长文件名保持自然宽度;按下滚动条取消未完成惯性,减少动态效果时直接滚动,切换提交及卸载不残留帧。其它 ScrollArea 默认行为不变。真实 WebView2 交互验收 pending。 Windows Git Log 右键 New Tag 打开弹窗后焦点直接位于标签名输入框,无需点击即可输入,Enter 提交、Esc 关闭。 macOS Git Log 空状态:在非 Git 项目检查明暗主题、窄窗口和键盘操作:13pt 常规文字按 IDEA 左对齐,整组位于内容区上方三分之一处;显示 To track changes to code、GitHub/GitLab 官网链接、Initialize Git repository…、Open Git Settings 和带原始 ContextHelp 图标的 Version control integration(打开 Git 官方文档)。初始化仍先确认,不自动暂存或提交;设置打开既有 Git 设置。未提交仓库、无匹配提交、加载失败及重试保持原动作,所有空状态操作采用文字按钮。 非 Git 项目空状态隐藏 Log/Worktrees/Console 标签、添加按钮、分支树与动作条、筛选/搜索工具栏及提交详情,提示占满工具窗内容区;GitHub、GitLab、初始化、设置及帮助链接悬停仅给当前文字加主题强调色下划线并显示手形,离开后恢复;初始化或切换至真实仓库后恢复原有三栏布局,真实仓库无匹配提交仍保留筛选入口。 空状态字体与间距对照 Community c7f91397:按钮标签显式使用 Inter 13pt Regular;行首破折号按首行基线对齐,21pt 行高加 2pt 间隔,帮助图标间隔 2pt;灰字与链接分别沿 Component.infoForeground 和 Islands Link.activeForeground 核对明暗主题,悬停下划线仍使用当前主题强调色。 macOS 右侧提交详情的分支标签按可见区域懒加载,全部引用仍可滚动查看。重开面板初始化时恢复匹配的提交图和分支树,第一次布局即可读取全部已缓存数据,不依赖出现后的异步任务回填。重开面板复用未变化的分支树,单仓库不重复构建分组副本,多仓库活动根复用已有三类行;引用、仓库、工作树开关、折叠状态改变后拒绝旧树。原生绘制与无障碍日期文本复用缓存,语言改变后刷新。 macOS 大量引用首屏:同提交放置 1,500 个本地分支和 1,500 个远程引用,核对真实 upstream 优先、同名远程自然排序回退、完整提示及每类图标上限;反复切换 Terminal/Git Log,数据版本相同应复用已准备图,改变分支/筛选/图显示选项后不得复用旧图。运行 GitGraphInteractionTests 的 manyReferenceGroups 和 presentationCache;组件耗时仅诊断,整机卡顿以相同数据实测为准。 macOS Git Log 及终端按需创建后由工作台持有实际原生宿主;隐藏再重开及移动停靠位置复用控件。运行 GitLogReferenceResizeTests,验证同一工作台隐藏再重开时,固定原生表面上的提交文档和滚动容器对象身份不变,恢复可见性且尺寸正确,工作台释放后宿主释放;核对语言、主题、搜索、分支操作和终端会话。 Git Log 与终端同时停靠时,从外层横向和纵向分隔条中央及向面板两侧偏移 4pt 处,经窗口发送按下、拖动、松开,确认完整 10pt 命中区仍能提交尺寸、宿主身份保持,面板中央正常交互。;macOS 保留宿主圆角需在明暗主题、侧栏顶部与移动后、项目辉光改变、渐变开关及背景图切换时,与原工作台树四角像素一致(WorkbenchSurfaceBackgroundTests.retainedPaneCornersMatchWorkbenchGradient)。 Windows HEAD 按 Community HeadNodePainter 核对外圈、背景间隔和中心实点:26px 行高、100% 缩放时三层直径为 13/9/5px,125%/150%/200%/300% 按物理像素 FLOOR/ODD 对齐;深浅主题、悬停、当前分支及活动/非活动选择均透出真实行底色,穿过 HEAD 的连线不侵入间隔。普通节点及分叉、筛选、长边展开保持;同边双向终止元素键唯一。目标 WebView2 实机验收保持 pending。 macOS 在明暗主题的窄 Git Log 工具栏中选择长用户名、分支和路径,确认名称与选中值以同一行尾部截断,文字不重叠,清除按钮和重新选择仍可用。 macOS Git Log 接近底部时自动追加较早提交,正常浏览不出现必须点击的加载更多按钮;单一页面最多发起一次边缘请求,追加保留选择和原生视口偏移。无新提交或缺失后续游标时停止并释放游标;失败暂停自动读取,显式刷新重开历史而不重用失败游标。运行 GitGraphInteractionTests.automaticHistoryPaging 与 GitModuleTests.continuousHistoryPagingStopsOnDuplicatePagesAndRefreshesAfterFailure,真实大仓库连续滚动和 Windows WebView2 验收仍 pending。 macOS 深层历史后台刷新:文件状态变化不重开首批,元数据刷新保留已加载窗口和后续页占位,未变结果不重建提交图;外部新提交按可见 hash 与行内偏移保持原生视口,按新行位移补齐旧尾部,保留尾部选择。当前仓库引用只读取一次,多仓库仍独立加载。后台刷新打断自动分页后,即使历史相同也能继续读取新游标;失败仍暂停自动重试。运行 GitModuleTests.backgroundRefreshRetainsDeepHistoryAndSelectionWhileExternalCommitsStillAppear、引用聚合回归及 GitGraphInteractionTests.backgroundHistoryRefreshAnchorsVisibleCommitInsteadOfSelectedCommit/automaticHistoryPaging;真实大仓库长时间滚动仍待用户验收,原生进程 cleanup 超时未独立复现,不将减少重复查询等同于修复所有进程失败。 macOS #1542:显示保留的 Git Log/终端时,横纵分隔条中央及两侧偏移 4pt 仍经窗口事件完成拖动且只提交一次,宿主身份不变;根命中查询深度始终为 1,面板内部连续 100 次查询不产生额外根查询,鼠标移动不回查祖先 SwiftUI。验证禁用、收起(含嵌套分隔条)、恢复、卸载、跨窗口与登记表隔离、实时移动/裁剪、隐藏/透明和弱引用释放;保留宿主内部仍正常命中,外层边缘优先。Diff 两端收起后在普通与保留侧栏下均能经窗口拖回,不触发外层拖动。运行 GitLogReferenceResizeTests、SplitHandleHitTestTests 和 DiffScrollSynchronizationTests;旧实现先出现嵌套命中断言失败,新实现通过。较新 macOS 原生组件回归不替代 macOS 13 Intel 原报告崩溃验收,目标环境验证保持 pending。 历史菜单资格使用 Core 读取真实 HEAD 与第一父链;在筛选/分页、旁支首行、跳选、切换仓库、HEAD 变化和关闭菜单时验证动作状态及迟到结果隔离;两端原生界面验收 pending。 Git 控制台执行日志的记录状态(completed / unconfirmed)、单条与总量保留预算和脱敏由 Core 事件携带,两端不再各自归约或二次脱敏,单条输出预算统一为 32768 字符。 历史刷新的窗口大小、头部新增后保留旧尾部的延伸读取、翻页合并去重与上限、选中提交/焦点/范围锚点的保留统一由 Core `git.historyWindow` 决定;Windows 监听刷新不再把深层历史缩回第一页,选中与锚点在仍已加载时保留,像素级滚动锚点仍留在视图。滚动到深处后触发后台刷新,确认窗口深度、选中行与 Shift 范围起点不变;两端原生界面验收 pending。 Viva 改动文件折叠:运行 scripts/desktop/desktop-go.sh test ./internal/workbench -run 'TestLogChangedFiles|TestGroupLogFiles' -count=1;实机选择一个改动多个目录的提交,收起与展开文件夹、用方向键和双击操作,切换提交后文件夹重新展开。 Viva 提交详情改动文件横向滚动:运行 scripts/desktop/desktop-go.sh test ./internal/workbench -run TestLogChangedFiles -count=1 和 scripts/desktop/desktop-go.sh test ./internal/hscroll -count=1;实机选中路径很长的提交,确认改动文件列表可左右滚动、底部显示细滚动条,暗色主题下删除的文件显示为红色而不是灰色。 Viva 提交详情的哈希、作者、邮箱和日期不截断:运行 scripts/desktop/desktop-go.sh test ./internal/workbench -run TestLogCommitDetails -count=1;实机把详情面板拖到最窄,选中作者名和邮箱都很长的提交,确认放不下时换行显示,超长邮箱独占一行并在行内折行,没有省略号。 Viva 控制台:执行提交、推送或工作树清理等写操作后打开 Git 工具窗口的“控制台”页,核对命令、输出、退出码、搜索跳转、折叠、复制和清空;desktop/internal/workbench/gitconsole_test.go 覆盖列表、搜索和清空。 Viva 行标识回归 TestLogCommitKeysKeepFooterInRangeAndSeparate:加载页脚使用独立的合法标识 0,提交从 1 编号,重新排序保留提交标识;升级后的 List/Tree 范围检查不得因分页页脚崩溃。原生三平台长历史分页验收仍 pending。 Git 控制台 TestConsoleRowKeysReserveValidMissingRowIdentity 覆盖列表刷新期间缺失行的保留标识,不与真实行冲突。 Git 控制台开关:运行 scripts/desktop/desktop-go.sh test ./internal/core ./internal/workbench -run 'TestGitConsole|TestConsole' -count=1;实机打开设置 → 版本控制,逐个切换“省略的查询”里的九个开关,确认关闭的类别出现在控制台、打开的类别不再新增记录,执行的命令和失败请求始终显示;切换“显示”里的四个开关,确认查询折叠、无输出提示、临时 -c 配置和仓库名立即按开关重绘,复制全部内容仍带仓库名;重启后开关保持。", - "notes": "Viva 的 Git Log 已有提交列表、分支面板和提交详情,其余能力尚未逐项盘点。提交详情的改动文件按文件夹分组,文件夹先于文件,使用与项目树相同的 desktop/internal/treelist 折叠列表:单击箭头、双击文件夹或方向键展开收起,Enter 打开文件差异;切换提交后所有文件夹重新展开。2026-11-14 起分组由 Core git.changedFileGroups 计算(#1814):目录按段比较、文件按项目树的自然顺序排列(v0.1.4 在 v0.1.12 前),顶层目录为空字符串;Stash 和 Shelf 页同样适用。legacy 是迁移前基线,不代表当前实现。 Viva 提交详情的改动文件列表与项目树共用 desktop/internal/hscroll 横向滚动:列宽取最长一行,滚轮或触控板横向滚动,底部细滚动条显示位置;删除的文件在明暗主题下都用红色(Deleted),不再用暗色下发灰的次要文字色,Commit 工具窗口同样适用。 Git 工具窗口新增“控制台”页:按时间列出 Core 记录的 Git 写操作命令、输出和退出码,支持搜索与上下跳转命中、折叠长输出、复制命令或输出和清空;记录哪些查询和怎么显示由设置 → 版本控制的“Git 控制台:省略的查询”“Git 控制台:显示”两组共 13 个开关决定,初始状态与 IntelliJ IDEA 一致;省略的查询类别在 Core 记录时就丢弃,不占 200 条记录(类别由 gitExecution.consoleQueries 传给 Core,宿主用 queryCategory 标注后台分支读取、操作后重新加载、保存后差异刷新和日志路径筛选,其余由 Core 按命令归类);用户执行的命令、失败的 Git 请求、意外退出码和未确认的命令始终显示。显示开关由 git.consolePresentation 的 display 参数在 Core 里生效,复制全部内容仍保留完整命令和仓库。控制台工具栏原“隐藏读取命令”开关改为打开这两组设置的按钮。", + "notes": "Viva 的 Git Log 已有提交列表、分支面板和提交详情,其余能力尚未逐项盘点。提交详情的改动文件按文件夹分组,文件夹先于文件,使用与项目树相同的 desktop/internal/treelist 折叠列表:单击箭头、双击文件夹或方向键展开收起,Enter 打开文件差异;切换提交后所有文件夹重新展开。2026-11-14 起分组由 Core git.changedFileGroups 计算(#1814):目录按段比较、文件按项目树的自然顺序排列(v0.1.4 在 v0.1.12 前),顶层目录为空字符串;Stash 和 Shelf 页同样适用。legacy 是迁移前基线,不代表当前实现。 Viva 提交详情的改动文件列表与项目树共用 desktop/internal/hscroll 横向滚动:列宽取最长一行,滚轮或触控板横向滚动,底部细滚动条显示位置;删除的文件在明暗主题下都用红色(Deleted),不再用暗色下发灰的次要文字色,Commit 工具窗口同样适用。 Git 工具窗口新增“控制台”页:按时间列出 Core 记录的 Git 写操作命令、输出和退出码,支持搜索与上下跳转命中、折叠长输出、复制命令或输出和清空;记录哪些查询和怎么显示由设置 → 版本控制的“Git 控制台:省略的查询”“Git 控制台:显示”两组共 13 个开关决定,初始状态与 IntelliJ IDEA 一致;省略的查询类别成功时在 Core 记录时就丢弃,不占控制台保留的记录,省略一个类别时已记录的该类成功查询一并移除(类别由 gitExecution.consoleQueries 传给 Core,宿主用 queryCategory 标注后台分支读取、Git 操作后重新加载、保存后差异刷新和日志路径筛选,其余由 Core 按命令归类,类别名与 Core fixture 的 queryCategories 对照测试);用户执行的命令、失败的 Git 请求、用户发起的操作中失败的查询、意外退出码和未确认的命令始终显示。显示开关由 git.consolePresentation 的 display 参数在 Core 里生效:成功查询的输出超过 10 行才折叠,可设置为短输出也折叠;删除分支、标签、远程分支、贮藏、工作树等删除类命令的配置、进度和输出从不折叠;复制全部内容仍保留完整命令和仓库。控制台工具栏原“隐藏读取命令”开关改为打开这两组设置的按钮。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": {