Repository navigation
fix(desktop): 插件设置页的设置行随页面一起滚动,不再被自己的滚动区域截断 - #2335
Merged
Merged
Conversation
插件设置表单原来把 Core 声明的设置行放进自己的 ui.List。表单上方有效果预览这类 较高的插件区域时,列表只拿到 160 的最小高度,页面滚到底之后还要在列表内部再滚一次, 列表的第一行被上沿截掉,右侧还多出一条几乎看不见的内层滚动条。 Core 限制每个页面最多 32 个设置和 16 个动作,所以这些行是滚动规范允许不虚拟化的短表单。 改成直接声明在父级页面滚动里:整页只有一层滚动,首尾行都完整,右侧只剩一条滚动条。 行自己带上下内边距,所以单独放在一个无间距的列里,不占表单头部的 10 点间距。 settingsListMinHeight 只剩配置文件表单在用,移到 source_settings_view.go 并重写说明: 那里的行是工具自己的配置项,数量没有上限,仍然在模块树旁边自己滚动。 两个列表填充高度的测试改成验证表单没有自己的滚动区域、滚轮停在设置行上能把页面滚到底、 首行和末行都完整绘制,并且页面的结束位置不随窗口高度变化。
xiaoyumuxi
marked this pull request as ready for review
November 23, 2026 06:51
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
打开「设置 → 语言与框架 → Rust」这类带插件区域(效果预览)的插件设置页时,预览下面第一个小标题(例如
rust-analyzer)是半截的,看上去像被挡住了。实际不是遮挡:插件设置表单把 Core 声明的设置行放进了自己的
ui.List,于是页面里嵌了两层滚动。表单上方的插件区域很高时,这个列表只拿到settingsListMinHeight(160)的最小高度;页面滚到底之后,滚轮转的是列表自己,它的第一行被列表上沿裁掉。右侧还会多出一条属于列表的内层滚动条。改动 / Changes
desktop/internal/settingswindow/plugin_settings_view.goui.List,p.layout的行直接声明在父级页面滚动里。Core 限制每个页面最多MAX_SETTINGS(32) 个设置和MAX_SETTING_ACTIONS(16) 个动作,属于滚动规范里「固定且很短的表单」允许不虚拟化的情况。ui.Column,不吃表单头部那 10 点的Gap,行距与改动前逐像素一致。pluginSettingsListRow改名pluginSettingsFormRow,不再接收ui.ListRow,由调用方用c.KeyInt(index)给每行身份(和原来p.rows.Key = nil的按下标取身份一致)。desktop/internal/settingswindow/plugin_settings_model.go:删掉只给这个列表用的rows ui.ListState和p.rows.Key = nil。desktop/internal/settingswindow/source_settings_view.go:settingsListMinHeight只剩配置文件表单(sourceSettings)在用,常量移过来并重写说明——那里的行是工具自己配置文件的条目,数量没有上限,仍然要在模块树旁边自己滚动。desktop/internal/settingswindow/settings_surfaces_test.go、installed_view_test.go:fix(desktop): #1794 插件设置列表填满页面,最后一项不再被截断 #1848 的两个「列表填满页面」测试改成验证新的约束(见下)。shared/platform-feature-matrix/features/declarative-plugin-settings.json:verification里描述旧行为的那句(「设置列表填满表单标题下的高度、最少 160 像素……」)已改写成新行为并列出新测试名。docs/assets/plugin-settings-single-scroll/:改动前后截图与说明。不在本 PR 范围内 / Out of scope
theme.Border画滑块,设置窗口里是分隔线色#EDEDF0,而且只在悬停或滚动时出现)。这要改 Viva fork,并同步向上游提 PR,等授权后单独做。类型专属:fix
复现与根因
settingRegions视图的插件(例如 Rust Support),打开「设置 → 语言与框架 → Rust」,把右侧详情滚到底。ui.List+MinHeight(settingsListMinHeight),当时表单上方还没有插件区域;后来插件区域(Core fix(ci): use configured Swift compiler for plugins #104 / feat(desktop): 用 Viva 原生绘制插件视图:宿主控件、树、画布与设置区域 #2183)落地,区域一高,列表就只剩最小高度,形成嵌套滚动。检查项
已先写回归测试,确认它在修复前失败、修复后通过;测试路径与修复前的失败输出:
desktop/internal/settingswindow/settings_surfaces_test.go、installed_view_test.go。把三个源文件git checkout origin/main --回退后:测试内容:表单不声明自己的滚动区域(没有以表单标题命名的 list box);滚轮停在设置行上能把页面滚到底;末行完整绘制且在窗口按钮之上;再向上滚回首行也完整;页面的结束位置在最小窗口、800、1000 三个高度下一致。
[N/A] 无法自动化时的手动步骤:行为已自动化覆盖。
已搜索被修改函数、类型、契约字段的全部调用方:
pluginSettingsPanel的三个调用方(settings_surfaces.go动态页、build_kind_view.go构建类型页、installed_view.go插件详情设置标签页)都在ui.Scroll里;pluginSettingsListRow和pluginSettingsForm.rows没有其他使用者;settingsListMinHeight只剩source_settings_view.go两处。已检查另一平台是否有同类缺陷:macOS/Windows/Linux 共用这份 Viva 视图代码,一次改动三端同时修复,不存在只修一端的情况。
只改了修复所需的代码,没有夹带重构;修复过程中没有发现其他问题。
[N/A] 未新增
.agents/notes/implemented/bug-fix/记录:约束本身已写进函数注释和功能矩阵,没有新的长期决策。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/declarative-plugin-settings.json:verification中描述旧滚动行为的那句改写成新行为并列出两个新测试名。实现状态和验证状态都没有变(两端仍是partial/pending),因为原生窗口验收没有做。./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh(validated 221 platform capabilities)和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD(capability records changed)。.artifacts/下生成的矩阵视图matrix-exempt。插件归属 / Plugin ownership
plugins/settings-documents.json)生成的合成清单,插件 ID 是dev.example.settings;截图用契约的view-panel示例插件(dev.lithe.fixture.view-panel)。没有真实插件 ID、插件包或「缺少插件时跳过」。declarative-plugin-settings是宿主的通用扩展点。docs/ci-builds.md、Note、Skill 写插件内容UI 验证 / UI evidence
已运行受影响场景的 Viva 无头测试并检查截图。改动前后各跑一次,窗口 760 点、中文、浅色,打开「插件 → 已安装 → View Panel → 设置」后把滚轮停在详情里滚到底:
改动前:页面滚到底后最后一行「Watch files」还在内层滚动区里,被下边缘截断。改动后:预览和设置行一起滚,「Watch files」完整显示,右侧只有一条滚动条。截图与说明在
docs/assets/plugin-settings-single-scroll/。已在本 PR 嵌入截图(见上表)
布局与视觉变化有改动前后对照:另外用
TestVisualPluginRegion/zh/light(1180 高)做了逐像素比对,改动前后只差右边缘 3 列像素,就是消失的那条内层滚动条;行距、间距、控件位置完全相同。macOS、Windows 原生窗口验收未做。统一日志系统 / Structured logging
N/A:只改视图布局,没有新增或改动生命周期里程碑、终态、降级或失败路径。
界面文案 / i18n
.Label(...)用的是已有词条desktop.pluginSettings.title,该词条仍被表单标题使用。shared/i18n/node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,都通过,没有放宽脚本逻辑归属 / Logic placement
性能与内存 / Performance and memory
desktop/internal/editor*。设置 / Settings
插件契约 / Plugin contract
N/A:没有改契约、能力版本或插件函数协议,没有新增宿主方法或通知;
PINNED_CORE_REVISION未变。发行包与资源 / Bundle and resources
./scripts/desktop/verify/verify-runtime-bundle-immutability.sh,通过。无用代码与重构 / Dead code and refactoring
pluginSettingsForm.rows、p.rows.Key = nil)。验证 / Verification
cd desktop && gofmt -l ../scripts/desktop/desktop-go.sh vet ./..../scripts/desktop/desktop-go.sh test ./...internal/ai的TestProviderDiscoveryUsesRealCoreParser(providers = 1 codex, 1 claude; want one Codex provider),依赖本机安装的 AI CLI,与本 PR 无关、未改该包./scripts/desktop/desktop-go.sh test -tags dev ./internal/settingswindow ./internal/pluginviewLITHE_VISUAL_OUTPUT_DIR=… ./scripts/desktop/desktop-go.sh test -tags vivahead,lithevisual -run 'TestVisualPluginRegion/zh/light' ./internal/settingswindow/node scripts/i18n/generate-i18n.mjs --checknode scripts/i18n/verify-app-language-localization.mjs./scripts/desktop/verify/verify-runtime-bundle-immutability.sh./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD./.agents/skills/write-stable-tests/scripts/verify-test-stability.shrg -n -i 'io\.github\.lithe-idea\.|…'未能执行的检查和原因:
提交前确认 / Final checks
main创建(b629c0eca);目标分支main/fixture/preferences)