Repository navigation
fix(desktop): 新建项目表单的字段说明改用 ⓘ 提示,修复选中带说明的生成器后卡死 - #1952
Merged
Merged
Conversation
生成器字段声明了 description 时,generatorField 把提示挂在纯文本标题上。 Viva 要求提示所在的元素有身份(控件或带 Hit 的容器),纯文本没有身份, 于是在绘制时 panic;Viva 在 AppKit 回调里接住 panic 后关闭视图, 应用表现为转圈卡死。Maven、Maven Archetype 等生成器的字段都带说明, 一选中就触发;测试 fixture 的字段没有说明,所以一直没有被测到。 问题由 #1799 迁移到 Viva 时引入(0faecba49)。 - 字段说明改为标题旁(复选框字段为复选框旁)的 ⓘ 按钮提示,沿用 构建选项等处的 ⓘ 写法和已有词条 native.moreInformation。 - 字段列改用 c.Key(decl.ID) 命名:c.Part("field") 让各字段的 ⓘ 共用同一身份,悬停一个会显示错误的提示;Core 已拒绝重复的字段 ID。 - 标题过长时省略号截断,ⓘ 始终可见。 - 新增回归测试:每个带说明的字段各有一个身份不同的 ⓘ,悬停各自只显示 自己的说明;修复前该测试因 panic 失败。 - 新增无头截图场景 TestVisualNewProjectFieldDescriptions(只需 LITHE_VISUAL_OUTPUT_DIR),并抽出 offerGenerators 供其复用。 - 修正 editor_essentials_visual_test.go 中 openEditorFind 的调用: #1945 增加 surface 参数时漏改,导致 vivahead lithevisual 标签下 整个包无法编译,截图场景无法运行。
xiaoyumuxi
marked this pull request as ready for review
November 15, 2026 04:14
23 of 26 tasks
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
在“新建项目”窗口里点 Maven、Maven Archetype 等生成器,应用会转圈卡死,只能强制退出。
原因是生成器字段声明了
description时,generatorField把悬停提示挂在纯文本标题(ui.Text)上。Viva 要求挂提示的元素有身份(控件,或带 Hit 的容器),纯文本没有,所以绘制时 panic。Viva 在 AppKit 回调里接住 panic 后关闭视图,用户看到的就是卡死。宿主测试 fixture 的字段都没有说明,所以这条路径一直没被测到。
改动 / Changes
desktop/internal/workbench/new_project_view.goIcon(icons.Info).IconOnly().Ghost(),提示朝右,无障碍名称用已有词条native.moreInformation。没有新增文案。c.Part("field")改为c.Key(decl.ID)。用Part时,各字段的 ⓘ 共用同一个身份,悬停一个字段会显示另一个字段的说明(测试报ⓘ 0 and ⓘ 1 are one control)。Core 已经拒绝重复声明的字段 ID,所以字段 ID 在兄弟元素中唯一。desktop/internal/workbench/new_project_test.goTestNewProjectFieldDescriptionsAreInformationTips,使用测试内联的合成生成器describedGeneratorPlugin:枚举、文本、复选框三种字段带说明,另有一个文本字段不带说明。offerGenerators,供截图场景复用;newGeneratorHarness改为调用它,行为不变。desktop/internal/workbench/visual_capture_test.goTestVisualNewProjectFieldDescriptions,只需要LITHE_VISUAL_OUTPUT_DIR。desktop/internal/workbench/editor_essentials_visual_test.goopenEditorFind(true)改成openEditorFind(true, surfaceButton)。vivahead lithevisual标签下整个 workbench 包无法编译,上面的截图场景跑不起来。这里只补参数,没有改其他内容。shared/platform-feature-matrix/features/plugin-project-generators.jsonvisual_capture_test.go。不在本 PR 范围内 / Out of scope
app.SetFaultHandler,界面回调里的 panic 不会进日志。视图关闭后应用为什么挂住而不退出,还要在真实应用卡住时取主线程栈确认。Ellipsis(),标签会在单词边界被截断且没有省略号,需要先定方向。类型专属:fix
复现与根因
generatorField把Tooltip挂在ui.Text上)。检查项
desktop/internal/workbench/new_project_test.go的TestNewProjectFieldDescriptionsAreInformationTips。修复前的失败输出:c.Part("field")时的失败输出:new_project_test.go:778: ⓘ 0 and ⓘ 1 are one control。generatorField只在new_project_view.go的两处(分组与未分组字段)调用。desktop/中Text/Paragraph链式调用.Tooltip(的写法,没有其他命中。唯一一处相邻命中是workbench_background.go,提示挂在关闭按钮上,不受影响。editor_essentials_visual_test.go是让截图场景能编译的最小修正。修复过程中发现的其他问题已提交 [Bug] 界面回调里的 panic 被 Viva 接住后没有任何日志,应用转圈卡死而不是报错或退出 #1949、[Bug] 英文界面下新建项目窗口左栏底部的插件链接超出侧栏宽度,压到右栏 #1950。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/plugin-project-generators.json(capability、verification、notes、两端 evidence)。两端的实现状态和验证状态没有改动。./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh(191 项通过)和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/preview HEAD(通过)。.artifacts/下生成的矩阵视图。插件归属 / Plugin ownership
rg -n -i 'io\.github\.lithe-idea\.|lithe-idea/lithe-plugin-|PLUGIN_(ARCHIVE|MANIFEST|PACKAGE)\b|"plugin-provided"' desktop scripts shared .github docs/ci-builds.md -g '!desktop/internal/core/testdata/marketplace/**'),结果为空。describedGeneratorPlugin,没有真实插件 ID,没有读取插件包,也没有“缺少插件时跳过”的写法。description是契约已有字段,宿主只改了呈现方式。UI 验证 / UI evidence
desktop/下运行LITHE_VISUAL_OUTPUT_DIR=<目录> ../scripts/desktop/desktop-go.sh test -tags 'vivahead lithevisual' -run '^TestVisualNewProjectFieldDescriptions$' -count=1 ./internal/workbench.artifacts/visual-evidence/new-project-field-info/,用上面的命令可以重新生成。合入前需要人工上传。统一日志系统 / Structured logging
N/A:没有新增或改动生命周期、操作终态或失败路径的日志。fault 不进日志的问题见 #1949。
界面文案 / i18n
native.moreInformation;字段标题与说明来自生成器声明,原样显示。shared/i18n/。node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,都通过,没有放宽脚本或豁免名单。逻辑归属 / Logic placement
N/A:只改呈现方式。字段声明、校验与重复 ID 检查仍在 Core。
性能与内存 / Performance and memory
N/A:没有新增后台功能、子进程、缓存或定时器,也不涉及启动、输入、滚动或搜索。每个带说明的字段只多画一个图标按钮。
设置 / Settings
插件契约 / Plugin contract
N/A:没有改契约、能力版本或宿主方法;只使用契约已有的字段
description。发行包与资源 / Bundle and resources
N/A:没有新增运行时资源、缓存、下载物或构建资源。
无用代码与重构 / Dead code and refactoring
验证 / Verification
./scripts/desktop/desktop-go.sh test ./...(在desktop/下)./scripts/desktop/desktop-go.sh test -race -run 'TestNewProject|TestWelcome' ./internal/workbenchTestNewProjectFieldDescriptionsAreInformationTips修复前 / 修复后TestVisualNewProjectFieldDescriptions(vivahead lithevisual)gofmt -l;go vet(默认标签与vivahead lithevisual)./.agents/skills/write-stable-tests/scripts/verify-test-stability.sh --base origin/previewnode scripts/i18n/verify-app-language-localization.mjs;node scripts/i18n/generate-i18n.mjs --check./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh;verify-platform-feature-matrix-change.sh origin/preview HEAD未能执行的检查和原因:
提交前确认 / Final checks
preview(81d4ecaff)创建,目标分支为preview.build/、target/、dist/、.artifacts/等产物,没有凭据、个人路径和未脱敏的日志或截图