Repository navigation
feat(plugin-ui): 设置区域工具行新增可选字段 choose 作工具选择器(ui 0 内补充),视图调用带工作区上下文写进契约 - #174
Merged
Merged
Conversation
xiaoyumuxi
marked this pull request as ready for review
November 22, 2026 15:40
1 task done
This was referenced Nov 22, 2026
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.
背景
插件设置区域里的工具行(
{"type":"tool","tool":"…"})只能显示工具在当前范围的解析结果,点一下跳到工具链页。像 Python 这种按项目选解释器的插件,需要 PyCharm 那样就地展开的下拉框:列出自动选择、已发现和已添加的解释器,直接选一个。另外,“新建虚拟环境”这类动作要在click里调用run/start,它需要工作区上下文;宿主其实已经在视图调用里带上了窗口的工作区上下文,但契约没写。改动
工具选择器(
ui0 内的可选字段,不升能力版本)plugin-ui.schema.json的toolRow新增可选布尔字段choose。带上后这一行同时是该工具的选择器:自动选择、已发现和已添加的安装(带版本和来源)、添加目录、打开工具链页。choose不是布尔值时,Core 以plugin.ui.invalidView拒绝整个结果,位置指向choose。capabilities.rs仍是(UI, &[0]),plugin-manifest.schema.json的requires.ui仍是enum [0]。旧宿主的 Core 不认识choose,会拒绝带它的视图,所以插件要等包含本改动的桌面端发布后再写(和 feat(core-rules): 工具目录改由插件声明(layout.hiddenDirectoryNames、workspace.configureVisibility),Core 只隐藏自己的目录 #72、refactor(lsp-engine): 索引排除改由语言服务器声明 indexingExclusions,Core 不再识别 rust-analyzer 和 gopls #68 新增可选字段的处理方式一致),契约 README 和 settings 领域页都写明了这一点。plugin-ui/src/tree.rs:tool行允许choose字段并校验为布尔值。视图调用的工作区上下文(只补文档,行为不变)
params.context,后端可以在click里用它调用run/start等宿主方法;没有工作区时不带。workspace_context()、Go SDKWorkspaceContext()的说明随之修正(Java 原本就对)。宿主方法
choose是 API-13 插件视图里 API-23 工具解析的就地选择契约、SDK 与文档
ui/view-results.json新增两个用例:设置区域的工具行带choose: true被接受;choose不是布尔值时拒绝在result.view[0].choose。index.d.ts的工具节点加上choose?: boolean,类型测试覆盖。reference/domains/ui.md、reference/domains/settings.md(中英);插件协议更新记录的待合入条目(ui0 内的补充)。能力版本表和“按协议查首次出现”表不变。验证
cargo test -p lithe-plugin-ui -p lithe-plugin-manifest -p lithe-plugin-model:全部通过,新增a_tool_row_can_be_a_picker_in_a_settings_region、a_settings_region_accepts_a_tool_picker。cargo test -p lithe-core --lib -- plugin_views declarative_plugins capabilit:76 个通过(含读取view-results.json的 fixture 测试)。cargo clippy -p lithe-plugin-ui -p lithe-plugin-manifest -p lithe-plugin-model --all-targets -- -D warnings、cargo fmt --all -- --check。node scripts/rust-core/verify-platform-tests.mjs、scripts/rust-core/verify-rust-core-comments.sh、node shared/plugins/scripts/verify-docs.mjs。shared/plugins/sdk/node:npm run test:types。桌面端选择器接入在 1lck/Lithe-IDEA 的后续 Draft PR;Python Support 插件仍声明
ui0,等包含本改动的桌面端发布后再写choose。