Skip to content

feat(plugin-model): sourceSettings 1 支持模块列表、标签页和类型化条目列表 - #79

Merged
1lck merged 2 commits into
mainfrom
feat/2086-source-settings-modules
Nov 17, 2026
Merged

1lck merged 2 commits into
mainfrom
feat/2086-source-settings-modules

Conversation

@1lck

@1lck 1lck commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

关联 Issue

类型

feat:插件契约 sourceSettings 新增版本 1

改动

原生来源设置(litheSettingsSources)只有 form、table 两种布局,字段只有文本、枚举、布尔和字符串/文件列表,表达不了“模块列表 + 源/路径/依赖标签页 + 带类型、有顺序、可导出的依赖”。本 PR 加入四个通用成员,宿主不需要认识任何具体工具:

成员 作用
分组 layout: "sidebar" 分组中的来源显示为左侧导航列表,选中后右侧显示它的字段
来源 parent 只用于 sidebar,指向同组中更早的来源,宿主据此嵌套;最多 8 层,父来源必须在前面,所以不会成环
字段 section sidebar 中每个不同的 section 是一个标签页(按首次出现排序),form 中是小标题;表格字段不能有
字段类型 entryList 有序的类型化条目列表:entryKinds 1–16 种(file 可带扩展名过滤、directory、choice 带 0–1024 个可选项),attributes 至多 4 列(布尔或枚举);条目 {kind,value,title?,detail?,attributes?} 至多 256 个,kind+value 不重复

Core 规则(rust/crates/plugin-model/src/settings/sources.rs):

  • 条目的 title/detail 只用于显示:判断是否修改时忽略,写回时也不交给插件;编辑函数收到的是 [{kind,value,attributes?}]。
  • 新增的 choice 条目必须在该类型当前的可选项中,或是字段原本就有的条目。宿主不能写入插件没有提供的容器或模块。
  • 空列表是显式值,不等于继承;只读来源的条目编辑被拒绝。
  • SourceInput 新增 entries 草稿;effectiveDisplays 对 entryList 给出 count。
  • 能力表 sourceSettings 支持 [0, 1]。使用这些成员的插件声明 sourceSettings: 1,只支持 0 的宿主不会安装。快照的 version 仍为 0,版本 0 快照的含义不变。

文档:契约 README(Entry lists 一节)、manifest schema 的 sourceSettings 枚举、能力版本对照(中英)、设置领域指南(Module structure pages)、rust/contracts/application-boundary.md、协议更新记录。

Fixture:新增 rust/fixtures/plugins/settings-sources-modules.json(虚构工具:嵌套模块、标签页、两种条目列表、属性列、只读模块)。原 settings-sources.json 不变,宿主现有测试不受影响。

宿主方法:没有新增或修改宿主方法和通知,不需要“原计划编号 | 方法 | 用途”表。

验证

命令 结果
cargo test -p lithe-plugin-model --lib settings 31 通过(新增 8 个:嵌套与标签页投影、带显示文字的未修改条目不产生写入、增删改排序后写回去掉显示文字、清空列表、拒绝未提供的条目/未知类型/未知或错误属性/重复/空值、只读模块、12 种非法快照、嵌套深度上限)
cargo test -p lithe-core --lib plugin_source_settings 3 通过(新增:经公开边界读取模块 fixture;要求 sourceSettings: 1 的清单被只支持 0 的宿主拒绝、被支持 [0,1] 的宿主接受)
cargo clippy -p lithe-plugin-model -p lithe-core --all-targets -- -D warnings、cargo fmt --all --check 通过
scripts/rust-core/verify-rust-core-comments.sh plugin-model 通过
node scripts/rust-core/verify-platform-tests.mjs 通过
node shared/plugins/scripts/verify-docs.mjs 通过

affected-crates.mjs 显示 Linux 需要测试整个工作区,由 Draft PR 的 Linux CI 覆盖。没有改 plugin-rpc,所以不需要跑 SDK 端到端测试。

后续

  • 宿主(1lck/Lithe-IDEA):实现 sidebar、标签页和 entryList 编辑器,并把 PINNED_CORE_REVISION 升到本 PR 的合并提交。
  • Java 插件:按模块投影 Eclipse .classpath 并写回。

🤖 Generated with Claude Code

1lck and others added 2 commits November 16, 2026 22:12
- 分组布局 sidebar:来源显示为左侧导航列表,可用 parent 嵌套(最多 8 层)
- 字段 section:sidebar 中为标签页,form 中为小标题,表格不接受
- 字段类型 entryList:entryKinds(file/directory/choice)、至多 4 个按条目属性列;
  条目的 title/detail 只用于显示,比较和写回时忽略;新增的 choice 条目必须来自
  当前可选项或原值
- SourceInput 新增 entries 草稿;effectiveDisplays 对 entryList 给出数量
- 能力表 sourceSettings 支持 [0, 1];新增 fixture settings-sources-modules.json
- 契约 README、schema、能力版本表、设置指南和应用边界文档同步

Refs 1lck/Lithe-IDEA#2086

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@1lck
1lck marked this pull request as ready for review November 17, 2026 06:29
@1lck
1lck merged commit 788e61e into main Nov 17, 2026
10 checks passed
@1lck
1lck deleted the feat/2086-source-settings-modules branch November 17, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant