Repository navigation
Description
Problem to solve / 要解决的问题
Plugins can put a toolchain tool row ({"type":"tool","tool":"…"}) into a settings region. The row only shows which installation the current scope resolved to. Clicking it leaves the plugin's page and opens Settings › Toolchains. A language plugin that picks a per-project interpreter or SDK (for example the Python plugin designed in #2122) cannot offer the in-place dropdown that users know from PyCharm's interpreter selector or IDEA's SDK combo box. To switch interpreters, users go to another page, find the tool, change it, and come back. They also lose sight of the plugin settings that depend on that choice.
插件可以在设置区域里放一个工具链工具行({"type":"tool","tool":"…"})。这一行只显示当前作用域解析到的安装,点击后会离开插件页,跳到“设置 › 工具链”。按项目选择解释器或 SDK 的语言插件(例如 #2122 设计的 Python 插件)没法提供 PyCharm 解释器下拉框、IDEA SDK 下拉框那样就地选择的体验。用户换一次解释器,要先跳到另一页、找到这个工具、改完再回来,期间看不到依赖这个选择的插件设置。
Proposed solution / 建议方案
-
A new optional field within the existing plugin view contract (
ui0, no new capability version) lets a settings region's tool row carrychoose: true. Such a row is drawn as a picker: a bordered row with a chevron. -
Clicking the row opens the same choices the Toolchains page lists for that tool, in place:
- Automatic, with the version it resolves to;
- discovered and added installations, with version, path, source and the one in use;
- "Add Installation Directory…";
- "Manage in Toolchains…".
-
The choices follow the plugin page's global/project scope. A choice only edits the settings window's toolchain draft. Apply/OK saves it; Cancel discards it, the same as on the Toolchains page.
-
Core validates the field: a
choosethat is not a boolean is rejected atchoose. The host keeps declaringui0. A host whose Core predates the field refuses a view that writes it, so plugins write it once a desktop release that includes it is out. -
A tool row without
choosekeeps opening the Toolchains page, now in the plugin page's scope. -
插件视图契约在
ui0 内新增可选字段(不升能力版本):设置区域的工具行可以带choose: true,这一行画成带边框和下拉箭头的选择框。 -
点开后,在原处列出“工具链”页对这个工具的同一份选项:
- 自动(括号里是解析到的版本);
- 已发现和手动添加的安装,显示版本、路径、来源,并标出正在使用的那个;
- “添加安装目录…”;
- “在‘工具链’中管理…”。
-
选项跟随插件页当前的全局/项目作用域。选中后只改设置窗口的工具链草稿,按“应用/确定”保存,按“取消”丢弃,和“工具链”页一致。
-
Core 校验这个字段:
choose不是布尔值时拒绝,错误位置指向choose。宿主仍声明ui0。旧宿主的 Core 不认识这个字段,会拒绝带它的视图,所以插件要等包含它的桌面端发布后再写。 -
不带
choose的工具行仍然跳到“工具链”页,改为沿用插件页的作用域。
Target platform / 目标平台
Cross-platform / 跨平台
Area / 模块
Extensions / 扩展
Priority / 优先级
P1 / 尽快处理:使用体验大幅下降,但通常仍可继续使用
Alternatives considered / 已考虑的替代方案
-
Keep only the jump to Toolchains. It works, but switching interpreters takes a trip to another page and back. That is the gap described above.
-
Let each plugin draw its own dropdown with
selectand keep a copy of the installations. The plugin would duplicate Core's toolchain resolution, discovery and pinned versions in a shadow setting. The choice would not reach the Toolchains page, and starts and runs would not use it. -
只保留跳转到“工具链”页。 能用,但每次换解释器都要去另一页再回来,就是上面说的问题。
-
插件自己用
select画下拉框并保存一份安装列表。 插件要复制一份 Core 的工具链解析、发现和固定版本,存成影子设置;这个选择不会出现在“工具链”页,启动和运行也不会用它。
Additional context / 补充信息
-
Core contract: feat(plugin-ui): 设置区域工具行新增可选字段 choose 作工具选择器(ui 0 内补充),视图调用带工作区上下文写进契约 Lithe-IDEA/Lithe-core-rust#174 (the
choosefield withinui0 and its validation; it also documents that view calls carry the window's workspace context, so a view's click handler can start a run, for example to create a virtual environment). -
fix(mac): reduce editor file-open lag #174 merged with
chooseunder a newui1. fix(plugin-ui): 撤回 ui 1,设置区域工具行的 choose 改为 ui 0 内的可选字段 Lithe-IDEA/Lithe-core-rust#175 withdrewui1 and madechoosean optional field withinui0 again; the desktop pin moves to that Core main commit in fix(desktop): Core 固定版本从 #174 分支提交 a50cea1 换到 main dcb3d77 #2315. -
First consumer: the Python plugin ([Feature] Python 插件 lithe-plugin-python 设计:pyrefly 代码智能、uv/conda 解释器、运行、pytest 与 debugpy 调试,三端统一打包 #2122). It will put the interpreter picker at the top of its settings region.
-
Core 契约:feat(plugin-ui): 设置区域工具行新增可选字段 choose 作工具选择器(ui 0 内补充),视图调用带工作区上下文写进契约 Lithe-IDEA/Lithe-core-rust#174(
ui0 内的choose字段和校验;同一个 PR 在契约里写明视图调用带窗口的工作区上下文,视图的点击事件可以据此启动运行,例如新建虚拟环境)。 -
fix(mac): reduce editor file-open lag #174 合入时把
choose放在新增的ui1 下。fix(plugin-ui): 撤回 ui 1,设置区域工具行的 choose 改为 ui 0 内的可选字段 Lithe-IDEA/Lithe-core-rust#175 撤回了ui1,choose改回ui0 内的可选字段;桌面端在 fix(desktop): Core 固定版本从 #174 分支提交 a50cea1 换到 main dcb3d77 #2315 把固定版本换到这个 Core main 提交。 -
第一个使用方:Python 插件([Feature] Python 插件 lithe-plugin-python 设计:pyrefly 代码智能、uv/conda 解释器、运行、pytest 与 debugpy 调试,三端统一打包 #2122),会把解释器选择器放在设置区域最上方。
Checklist / 提交前检查
- I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
Activity
docs(plugin-api): API-13 状态写上 ui 1 的工具选择器 (#2311)
feat(desktop): 插件设置区域的工具行可作工具选择器,在原处选择工具链安装 (#2311)
docs(plugin-api): API-13 状态写上设置区域的工具选择器 (#2311)
feat(desktop): 插件设置区域的工具行可作工具选择器,在原处选择工具链安装 (#2312)