Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## 先说结论

设置窗口现在可以由插件“注册”页面:插件在 `plugin.json` 里声明设置项放在哪个语言页或构建系统页(`page`)、属于哪个分组(`section`)、能否按项目覆盖(`scope`)、改完何时生效(`effect`),以及页面上的按钮(`settingActions`)。宿主只提供通用的页面、分组、控件、项目/全局切换、状态卡片和按钮,**不写任何针对某个语言、构建工具或插件的设置页和按钮**。
设置窗口现在可以由插件“注册”页面:插件在 `plugin.json` 里声明设置项放在哪个语言页或构建系统页(`page`)、属于哪个分组(`section`)、能否按项目覆盖(`scope`)、改完何时生效(`effect`),以及页面上的按钮(`settingActions`)。宿主只提供通用的页面、分组、控件、项目/全局切换、语言服务状态和按钮,**不写任何针对某个语言、构建工具或插件的设置页和按钮**。语言服务状态和提供插件写在“语言与框架”目录的行上,语言页本身不再重复;只有一个插件贡献的页面直接显示它的设置,不放插件选择器(见[设置页分类归属规则](../feature/2026-10-15-macos-settings-hierarchy.md))。

“立即生效”的设置通过 LSP 的 `workspace/configuration` 推给正在运行的语言服务器,不需要重启。项目级的值写进项目里的 `.lithe/plugin-settings.json`,团队可以通过版本控制共享。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ Windows 全量回归发现,原 Go 适配器去掉 `file://` 后把 `/elsewhere

### 动态页面与同一应用内的跨窗口发布

动态设置页继续复用原 settings v2 的 `page` 声明,不新增插件 RPC。Core 校验安装身份后,从已启用插件生成语言/构建系统页面,按插件和 section 返回原表单的行、按钮引用;没有设置、只有按钮也能形成页面。名字由已启用插件的语言或构建系统声明提供,没有声明时显示不透明 ID。多个贡献者使用同一个页面里的插件选择器,各自保留来源、作用域和保存入口。侧栏搜索、父节点保留与顺序由 Core 投影,平台只绘制可见行。
动态设置页继续复用原 settings v2 的 `page` 声明,不新增插件 RPC。Core 校验安装身份后,从已启用插件生成语言/构建系统页面,按插件和 section 返回原表单的行、按钮引用;没有设置、只有按钮也能形成页面。名字由已启用插件的语言或构建系统声明提供,没有声明时显示不透明 ID。多个贡献者使用同一个页面里的插件选择器,各自保留来源、作用域和保存入口;只有一个贡献者时不显示选择器。侧栏搜索、父节点保留与顺序由 Core 投影,平台只绘制可见行。

输入框、输入法状态和草稿按插件身份保存在当前设置窗口中,最多保留 64 个已访问表单;仅清理没有草稿、没有在途操作的表单。切页不保存也不丢弃草稿,按钮按所属 section 出现,说明使用共享 ⓘ。收到保存通知时,干净表单从实际来源刷新;脏表单保留原文、显示来源变化并禁用再次保存,用户明确放弃草稿并重新加载后才建立新基线。插件停用导致动态页消失时,插件详情页仍能找到该草稿。

每个实际工作台窗口在创建配置时注册,在关闭时注销。保存已提交后,使用独立 10 秒预算完成同一应用进程内的通知;接收队列最多 8 项,窗口关闭会解除等待。后台适配器比较实际偏好目录和工作区目录身份,Core 决定作用域、版本及启用状态是否匹配。通知只携带私有安装身份和效果,不携带设置值。接收窗口再按自己的工作区读取实际配置;全局保存不会把源窗口的项目覆盖值复制出去。UI 消费时还核对工作区发布对象,同路径关闭再打开也不会接受旧窗口生命周期的通知。

这一机制覆盖同一应用内存活的工作台窗口,不是跨进程消息服务,也不新增“打开另一个工作台窗口”的产品入口。外部编辑器修改仍依靠保存时的来源冲突检查;独立应用进程间的实时刷新不在此通知机制内。完整 settings 2 准入、语言服务状态卡及原生全流程验收仍按功能矩阵记录,不能由目录与通知测试推定完成。
这一机制覆盖同一应用内存活的工作台窗口,不是跨进程消息服务,也不新增“打开另一个工作台窗口”的产品入口。外部编辑器修改仍依靠保存时的来源冲突检查;独立应用进程间的实时刷新不在此通知机制内。完整 settings 2 准入、语言服务状态(2026-11-21 起只在“语言与框架”目录行显示)及原生全流程验收仍按功能矩阵记录,不能由目录与通知测试推定完成。

## 考虑过的备选方案

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
| 插件 | 插件的安装、启用和插件自带的选项;一级页面,不属于任何分组 |
| 版本控制 | Git、SVN 等版本控制系统的配置 |
| 构建、执行、部署 | 分组本身是目录页;固定子页“工具链”(插件声明的全部工具,包括项目 JDK)、“调试器”(单步过滤等调试设置)和“控制台”(程序输出编码);插件声明的构建工具页、编译器页按种类排在后面,以及运行配置、服务运行和框架、构建工具注入的配置 |
| 语言与框架 | 语言服务(LSP)的开关,以及 Spring Boot 等框架的配置 |
| 语言与框架 | 没有固定子页;插件声明的语言页、框架页(语言服务开关、Spring Boot 等框架配置)排在下面,有子页时它成为分组,分组本身是目录页 |
| 工具 | 终端、搜索(搜索和替换文件大小预算)等通用工具;插件带来的专用工具可以放进对应工具页。日志与诊断不属于设置,它是独立的日志窗口 |
| AI | 与 AI 有关的全部配置:MCP、Skill、全局指令、AI 提交信息、Agents、AI 服务商 |
| 关于 | 应用本身是什么、怎样拿到新版本:版本信息、更新卡片(自动检查更新、更新渠道、发布源、立即检查)、交流群和项目链接(开源仓库、问题反馈、Rust Core、Viva 上游);一级页面,固定在侧栏最后,除更新卡片外不放设置项 |
Expand All @@ -33,6 +33,8 @@ AI 分组内,Agent 可加载的资源(指令、技能、Hooks、MCP 配置

“构建、执行、部署”下插件声明的页面按种类(构建工具、编译器)归类:每个有页面的种类在侧栏只占一行,行尾是页面数,不展开;点开是和「工具链」「调试器」一样的分栏页,左侧列出这一类的全部页面和提供插件,可以按名称或插件筛选,右侧是选中页面的设置。再次打开时回到这一类上次看的页面。插件页只在侧栏搜索命中时才单独出现在侧栏,点结果在分栏页里打开。“构建、执行、部署”目录页每个种类只写前 3 个名称并计数其余,条数只写在设置窗口的 `kindNames` 常量里,不要为某个插件或种类单独改。这些插件页是额外的聚合入口:同样的设置仍然留在插件详情的「设置」标签,不从那里移走。详细结构见[构建、执行、部署设置页在大量插件注入时的结构](2026-11-18-build-execution-settings-at-scale.md)。

“语言与框架”下插件声明的页面直接作为子页列在侧栏。凡是自己有页面的分组(设置模型里 `ownsPage` 为真:“构建、执行、部署”和“语言与框架”),点侧栏这一行会打开自己的页面并展开分组,插件页上方面包屑里的分组名可以点回这个页面。“语言与框架”的页面是目录:每个插件页一行,写页面名称和提供插件,语言页另写第一个提供插件的语言服务状态;单击或回车打开该页,方向键只移动;列表虚拟化,只绘制可见行。没有插件贡献页面时说明页面从哪里来,并给“浏览插件市场”入口。打开的语言页不重复目录行已经写的内容:只有一个插件贡献时直接是它的设置,没有插件选择器,也没有语言服务状态卡;两个以上插件贡献同一页时才显示选择器,和“构建、执行、部署”的分栏页一致。2026-11-21 之前 `content()` 没有处理这个分组自己的页面,点它只显示“新桌面端暂未提供此页面”;给 `ownsPage` 加分组时,要同时在 `content()` 里给出它的页面。

### 开发者怎么做

- 新设置页:在设置分类中增加页面,并把它加入所属分组的 `parents` 表;补充搜索词与文案。不需要再改侧栏、展开逻辑和面包屑。
Expand Down Expand Up @@ -64,7 +66,7 @@ AI 分组内,Agent 可加载的资源(指令、技能、Hooks、MCP 配置

## 验证

- `scripts/desktop/desktop-go.sh test ./internal/settingswindow -count=1`:验证侧栏、面包屑、搜索展开与“关于”排在 AI 之后;`TestBuildKindIsOneRowThatOpensItsPage` 等验证插件页的种类行与分栏页。
- `scripts/desktop/desktop-go.sh test ./internal/settingswindow -count=1`:验证侧栏、面包屑、搜索展开与“关于”排在 AI 之后;`TestBuildKindIsOneRowThatOpensItsPage` 等验证插件页的种类行与分栏页;`TestLanguagesPageListsItsPagesAndOpensThem`、`TestLanguagesPageWithoutPluginPages` 验证“语言与框架”目录页、它的面包屑链接和空页面;`TestLanguagePageDoesNotRepeatItsDirectoryRow` 验证语言页不重复目录行。
- 实机打开设置窗口:确认侧栏分组、面包屑,以及从其它入口跳转到某个页面时展开所属分组。

## 适用范围
Expand Down
14 changes: 12 additions & 2 deletions desktop/internal/i18n/shared.generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion desktop/internal/settingswindow/build_kind_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (w *window) kindDetail(c ui.C, language i18n.Language, page *core.SettingsP
ui.Select(c, &w.contributorID, w.dynamic.contributorIDs[page.Key], w.contributorLabel).FillWidth().
Label(i18n.Shared(language, "desktop.pluginSettings.contributor"))
}
w.pluginSettingsPanel(c, w.contributorID)
w.pluginSettingsPanel(c, w.contributorID, true)
}

// kindRowKey is a row's identity in a kind's list, its page's key hashed to the list's
Expand Down
2 changes: 1 addition & 1 deletion desktop/internal/settingswindow/installed_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ func (w *window) installedDetail(c ui.C, language i18n.Language, fact PluginFact
if fact.Settings == 0 {
ui.Wrap(c, i18n.Shared(language, "desktop.pluginSettings.empty")).FontSize(12).Color(w.pal.muted)
} else {
w.pluginSettingsPanel(c, fact.ID)
w.pluginSettingsPanel(c, fact.ID, true)
}
case installedPermissions:
w.installedPermissions(c, language, fact)
Expand Down
47 changes: 23 additions & 24 deletions desktop/internal/settingswindow/language_status_view.go
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
package settingswindow

import (
"github.com/1lck/Lithe-IDEA/desktop/internal/i18n"
"github.com/vivaui/viva/gfx"
"github.com/vivaui/viva/ui"
)
import "github.com/1lck/Lithe-IDEA/desktop/internal/i18n"

// languageStatusCard declares the state of the language server a language page's contributor runs.
// It reads the state the window thread last recorded, so the card never waits for the server.
func (w *window) languageStatusCard(c ui.C, pluginID string) {
language := w.marketLanguage()
state := ""
if w.ctrl.opts.LanguageServerState != nil {
state = w.ctrl.opts.LanguageServerState(pluginID)
// A language's row in the Languages & Frameworks directory says the state of the language
// server its first contributor runs. The row reads the state the window thread last recorded,
// so drawing it never waits for the server. The language's own page does not repeat it.

// languageServerState is the state of the language server pluginID runs as the window thread
// last recorded it, empty when none runs or the host reports none.
func (w *window) languageServerState(pluginID string) string {
if w.ctrl.opts.LanguageServerState == nil || pluginID == "" {
return ""
}
value, color := i18n.Shared(language, "desktop.languageStatus.none"), w.pal.muted
return w.ctrl.opts.LanguageServerState(pluginID)
}

// languageStateWords are the words of a language server's state and its tone, as
// buildPalette.statusColor reads it: "ok" while it is ready, "error" once it failed, "warning"
// while it starts or works with less, and "idle" when it stopped or none runs.
func languageStateWords(language i18n.Language, state string) (string, string) {
switch state {
case "":
case "starting", "preparing":
value = i18n.Shared(language, "desktop.languageStatus.starting")
return i18n.Shared(language, "desktop.languageStatus.starting"), "warning"
case "ready":
value, color = i18n.Shared(language, "desktop.languageStatus.ready"), w.pal.text
return i18n.Shared(language, "desktop.languageStatus.ready"), "ok"
case "degraded":
value = i18n.Shared(language, "desktop.languageStatus.degraded")
return i18n.Shared(language, "desktop.languageStatus.degraded"), "warning"
case "stopped":
value = i18n.Shared(language, "desktop.languageStatus.stopped")
return i18n.Shared(language, "desktop.languageStatus.stopped"), "idle"
case "failed", "error":
value, color = i18n.Shared(language, "desktop.languageStatus.failed"), w.pal.danger
return i18n.Shared(language, "desktop.languageStatus.failed"), "error"
}
ui.Row(c).FillWidth().Height(40).Shrink(0).PadX(12).Gap(12).Items(ui.Center).Radius(6).Background(w.pal.card).Children(func() {
ui.Text(c, i18n.Shared(language, "desktop.languageStatus.title")).FontSize(12).Color(w.pal.muted).Shrink(0)
ui.Spacer(c)
ui.Text(c, value).FontSize(13).Weight(gfx.WeightSemibold).Color(color).Ellipsis()
})
return i18n.Shared(language, "desktop.languageStatus.none"), "idle"
}
Loading
Loading