Skip to content

[Feature] 插件设置区域的工具行可在原处选择工具链安装(类似 PyCharm 解释器下拉框),选中值进设置窗口草稿 #2311

Closed

Description

@xiaoyumuxi

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 (ui 0, no new capability version) lets a settings region's tool row carry choose: 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 choose that is not a boolean is rejected at choose. The host keeps declaring ui 0. 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 choose keeps opening the Toolchains page, now in the plugin page's scope.

  • 插件视图契约在 ui 0 内新增可选字段(不升能力版本):设置区域的工具行可以带 choose: true,这一行画成带边框和下拉箭头的选择框。

  • 点开后,在原处列出“工具链”页对这个工具的同一份选项:

    • 自动(括号里是解析到的版本);
    • 已发现和手动添加的安装,显示版本、路径、来源,并标出正在使用的那个;
    • “添加安装目录…”;
    • “在‘工具链’中管理…”。
  • 选项跟随插件页当前的全局/项目作用域。选中后只改设置窗口的工具链草稿,按“应用/确定”保存,按“取消”丢弃,和“工具链”页一致。

  • Core 校验这个字段:choose 不是布尔值时拒绝,错误位置指向 choose。宿主仍声明 ui 0。旧宿主的 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 select and 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 / 补充信息

Checklist / 提交前检查

  • I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。

Metadata

Metadata

Assignees

No one assigned

    Labels

    review: high

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions