diff --git a/.agents/notes/implemented/architecture/2026-10-21-plugin-settings-surfaces.md b/.agents/notes/implemented/architecture/2026-10-21-plugin-settings-surfaces.md index dc144f673..0d5e9075d 100644 --- a/.agents/notes/implemented/architecture/2026-10-21-plugin-settings-surfaces.md +++ b/.agents/notes/implemented/architecture/2026-10-21-plugin-settings-surfaces.md @@ -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`,团队可以通过版本控制共享。 diff --git a/.agents/notes/implemented/architecture/2026-11-09-viva-plugin-preference-native-storage.md b/.agents/notes/implemented/architecture/2026-11-09-viva-plugin-preference-native-storage.md index 39f6951e4..8d27aa92f 100644 --- a/.agents/notes/implemented/architecture/2026-11-09-viva-plugin-preference-native-storage.md +++ b/.agents/notes/implemented/architecture/2026-11-09-viva-plugin-preference-native-storage.md @@ -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 起只在“语言与框架”目录行显示)及原生全流程验收仍按功能矩阵记录,不能由目录与通知测试推定完成。 ## 考虑过的备选方案 diff --git a/.agents/notes/implemented/feature/2026-10-15-macos-settings-hierarchy.md b/.agents/notes/implemented/feature/2026-10-15-macos-settings-hierarchy.md index c36042904..e1f4e0bc1 100644 --- a/.agents/notes/implemented/feature/2026-10-15-macos-settings-hierarchy.md +++ b/.agents/notes/implemented/feature/2026-10-15-macos-settings-hierarchy.md @@ -20,7 +20,7 @@ | 插件 | 插件的安装、启用和插件自带的选项;一级页面,不属于任何分组 | | 版本控制 | Git、SVN 等版本控制系统的配置 | | 构建、执行、部署 | 分组本身是目录页;固定子页“工具链”(插件声明的全部工具,包括项目 JDK)、“调试器”(单步过滤等调试设置)和“控制台”(程序输出编码);插件声明的构建工具页、编译器页按种类排在后面,以及运行配置、服务运行和框架、构建工具注入的配置 | -| 语言与框架 | 语言服务(LSP)的开关,以及 Spring Boot 等框架的配置 | +| 语言与框架 | 没有固定子页;插件声明的语言页、框架页(语言服务开关、Spring Boot 等框架配置)排在下面,有子页时它成为分组,分组本身是目录页 | | 工具 | 终端、搜索(搜索和替换文件大小预算)等通用工具;插件带来的专用工具可以放进对应工具页。日志与诊断不属于设置,它是独立的日志窗口 | | AI | 与 AI 有关的全部配置:MCP、Skill、全局指令、AI 提交信息、Agents、AI 服务商 | | 关于 | 应用本身是什么、怎样拿到新版本:版本信息、更新卡片(自动检查更新、更新渠道、发布源、立即检查)、交流群和项目链接(开源仓库、问题反馈、Rust Core、Viva 上游);一级页面,固定在侧栏最后,除更新卡片外不放设置项 | @@ -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` 表;补充搜索词与文案。不需要再改侧栏、展开逻辑和面包屑。 @@ -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` 验证语言页不重复目录行。 - 实机打开设置窗口:确认侧栏分组、面包屑,以及从其它入口跳转到某个页面时展开所属分组。 ## 适用范围 diff --git a/desktop/internal/i18n/shared.generated.go b/desktop/internal/i18n/shared.generated.go index 6288bcaa1..b1c7fdba3 100644 --- a/desktop/internal/i18n/shared.generated.go +++ b/desktop/internal/i18n/shared.generated.go @@ -1115,13 +1115,18 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.keymapSchemes.renameTitle": "Rename keymap scheme", "desktop.keymapSchemes.saveAs": "Save as new scheme…", "desktop.keymapSchemes.scheme": "Keymap scheme", + "desktop.languageSettings.browse": "Browse Marketplace", + "desktop.languageSettings.empty": "No plugin provides language or framework settings yet. Install a language plugin and its settings appear here.", + "desktop.languageSettings.failed": "Could not read the settings pages plugins provide.", + "desktop.languageSettings.intro": "Settings that installed plugins provide for languages and frameworks. Choose one to open its settings.", + "desktop.languageSettings.loading": "Reading plugin settings…", + "desktop.languageSettings.serverState": "Language server: {state}", "desktop.languageStatus.degraded": "Degraded", "desktop.languageStatus.failed": "Failed", "desktop.languageStatus.none": "Not running", "desktop.languageStatus.ready": "Ready", "desktop.languageStatus.starting": "Starting", "desktop.languageStatus.stopped": "Stopped", - "desktop.languageStatus.title": "Language server", "desktop.legacyImport.confirm": "Import", "desktop.legacyImport.description": "Read from {source}. The earlier Lithe keeps its data unchanged. Chosen settings replace the current ones; recent projects are added to the current list.", "desktop.legacyImport.done": "Imported the earlier Lithe settings. Recent projects added: {recent}.", @@ -4413,13 +4418,18 @@ var sharedCatalogs = map[string]map[string]string{ "desktop.keymapSchemes.renameTitle": "重命名快捷键方案", "desktop.keymapSchemes.saveAs": "保存为新方案…", "desktop.keymapSchemes.scheme": "快捷键方案", + "desktop.languageSettings.browse": "浏览插件市场", + "desktop.languageSettings.empty": "还没有插件提供语言或框架设置。安装语言插件后,它的设置会出现在这里。", + "desktop.languageSettings.failed": "无法读取插件提供的设置页。", + "desktop.languageSettings.intro": "已安装插件为语言和框架提供的设置。选择一项打开它的设置。", + "desktop.languageSettings.loading": "正在读取插件设置…", + "desktop.languageSettings.serverState": "语言服务:{state}", "desktop.languageStatus.degraded": "功能受限", "desktop.languageStatus.failed": "失败", "desktop.languageStatus.none": "未运行", "desktop.languageStatus.ready": "就绪", "desktop.languageStatus.starting": "正在启动", "desktop.languageStatus.stopped": "已停止", - "desktop.languageStatus.title": "语言服务", "desktop.legacyImport.confirm": "导入", "desktop.legacyImport.description": "读取自 {source}。旧版 Lithe 的数据保持不变。所选设置会替换当前设置;最近项目会加入当前列表。", "desktop.legacyImport.done": "已导入旧版 Lithe 的设置。新增最近项目:{recent} 个。", diff --git a/desktop/internal/settingswindow/build_kind_view.go b/desktop/internal/settingswindow/build_kind_view.go index c8bf22561..830b28410 100644 --- a/desktop/internal/settingswindow/build_kind_view.go +++ b/desktop/internal/settingswindow/build_kind_view.go @@ -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 diff --git a/desktop/internal/settingswindow/installed_view.go b/desktop/internal/settingswindow/installed_view.go index 978c40dc1..29fe8157d 100644 --- a/desktop/internal/settingswindow/installed_view.go +++ b/desktop/internal/settingswindow/installed_view.go @@ -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) diff --git a/desktop/internal/settingswindow/language_status_view.go b/desktop/internal/settingswindow/language_status_view.go index 00e596e87..3260eb615 100644 --- a/desktop/internal/settingswindow/language_status_view.go +++ b/desktop/internal/settingswindow/language_status_view.go @@ -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" } diff --git a/desktop/internal/settingswindow/languages_view.go b/desktop/internal/settingswindow/languages_view.go new file mode 100644 index 000000000..a33f5d087 --- /dev/null +++ b/desktop/internal/settingswindow/languages_view.go @@ -0,0 +1,142 @@ +package settingswindow + +import ( + "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" + "github.com/1lck/Lithe-IDEA/desktop/internal/icons" + "github.com/vivaui/viva/gfx" + "github.com/vivaui/viva/ui" +) + +// The Languages & Frameworks page is the group's own page, which its sidebar row and the +// breadcrumb above one of its pages open. It is a directory of the pages plugins put under +// the group: each page's title, the plugins that contribute to it and, for a language, the +// state of the language server its first contributor runs. A click or Enter opens a page; +// the arrow keys only move between rows. The host writes no page for a language or a +// framework: every row comes from a plugin's declaration, and the list shows only the rows +// on the screen, so it costs the same with many language plugins as with a few. + +// languageRowHeight is the height of one row of the directory. +const languageRowHeight = 52 + +// languagesPage is the title, a line on what the page lists and the directory, or what stands +// in for it while the catalog loads, after it failed or while no plugin contributes a page. +func (w *window) languagesPage(c ui.C) { + b := &w.bp + language := w.marketLanguage() + pages := w.languagePages() + ui.Column(c).FillWidth().Grow(1).Shrink(1).MinHeight(0).Background(b.surface). + PadSides(buildPagePadTop, buildPagePadX, buildPagePadEnd, buildPagePadX).Children(func() { + ui.Text(c, titleOf(&w.text.Settings, pageLanguages)).FontSize(buildHeading).Weight(gfx.WeightBold).Color(b.text).Ellipsis() + ui.Row(c).Height(4).Shrink(0) + // The line asks to choose a page, so it shows only while there is one to choose. + if len(pages) > 0 { + ui.Wrap(c, i18n.Shared(language, "desktop.languageSettings.intro")).FontSize(buildSmall).Color(b.sub) + } + ui.Row(c).Height(12).Shrink(0) + if w.dynamic.failed != nil { + ui.Wrap(c, i18n.Shared(language, "desktop.languageSettings.failed")).FontSize(buildSmall).Color(b.err) + ui.Row(c).Height(8).Shrink(0) + } + switch { + case len(pages) > 0: + w.languageDirectory(c.Part("directory"), language, pages) + case !w.dynamic.loaded: + ui.Text(c, i18n.Shared(language, "desktop.languageSettings.loading")).FontSize(buildSmall).Color(b.faint) + case w.dynamic.failed == nil: + w.languagesEmpty(c.Part("empty"), language) + } + }) +} + +// languagePages are the plugin pages under Languages & Frameworks, in the catalog's order, +// which is the sidebar's. +func (w *window) languagePages() []*core.SettingsPage { + var pages []*core.SettingsPage + for index := range w.dynamic.pages { + page := &w.dynamic.pages[index] + if contributedParent(page.Kind) == pageLanguages { + pages = append(pages, page) + } + } + return pages +} + +// languageDirectory is the outlined list of pages. It is as tall as its rows until the page +// is shorter, and scrolls then. +func (w *window) languageDirectory(c ui.C, language i18n.Language, pages []*core.SettingsPage) { + b := &w.bp + state := &w.languages + state.Key = func(row int) int { + if row < 0 || row >= len(pages) { + return 0 + } + return kindRowKey(pages[row].Key) + } + state.Header = nil + state.Label = func(row int) string { + if row < 0 || row >= len(pages) { + return "" + } + return pages[row].Title + } + separator := i18n.Shared(language, "desktop.buildSettings.listSeparator") + focused := state.HasFocus() + open := "" + height := float32(len(pages))*languageRowHeight + 10 + ui.Column(c).FillWidth().MinWidth(0).Basis(height).Shrink(1).MinHeight(0).Pad(4).Radius(10). + Border(1, b.line).Background(b.surface).Children(func() { + ui.List(c, state, len(pages), func(r ui.ListRow) { + page := pages[r.Index] + k := r.C + r.Element.Height(languageRowHeight).PadX(12).Gap(directoryRowGap).Radius(8).Items(ui.Center). + Hover(ui.Look{}.Background(b.hover)) + // The row the keys are on is marked only while the list has the focus: the + // page is a directory, which keeps no choice of its own. + if focused && r.Current() { + r.Element.Background(b.sel) + } + r.Element.Children(func() { + w.pluginTile(k, page.Title, 28) + ui.Column(k).Grow(1).Shrink(1).MinWidth(0).Children(func() { + ui.Text(k, page.Title).FontSize(buildFont).Weight(gfx.WeightSemibold).Color(b.text).Ellipsis() + ui.Row(k).Height(2).Shrink(0) + ui.Text(k, i18n.SharedFormat(language, "desktop.buildSettings.providedBy", map[string]string{"plugin": kindPlugins(page, separator)})). + FontSize(buildSmall).Color(b.sub).Ellipsis() + }) + if page.Kind == "language" && len(page.Contributors) > 0 && w.ctrl.opts.LanguageServerState != nil { + words, tone := languageStateWords(language, w.languageServerState(page.Contributors[0].PluginID)) + ui.Row(k.Part("server")).Shrink(0).Gap(6).Items(ui.Center).Children(func() { + dot(k, 8, b.statusColor(tone)) + ui.Text(k, i18n.SharedFormat(language, "desktop.languageSettings.serverState", map[string]string{"state": words})). + FontSize(buildSmall).Color(b.sub) + }) + } + ui.Text(k, "›").FontSize(buildFont).Color(b.faint).Shrink(0) + }) + if r.Element.Clicked() { + open = page.Key + } + }).Scrollbars().FillWidth().Grow(1).Shrink(1).MinHeight(0).Label(titleOf(&w.text.Settings, pageLanguages)) + }) + if row, ok := state.Submitted(); ok && row >= 0 && row < len(pages) { + open = pages[row].Key + } + if open != "" { + w.selectSettingsPage(pageLanguages, open) + } +} + +// languagesEmpty stands in for the directory while no enabled plugin contributes a page: +// where pages come from, and the marketplace where language plugins are found. +func (w *window) languagesEmpty(c ui.C, language i18n.Language) { + p := &w.pal + ui.Column(c).FillWidth().Grow(1).Shrink(1).MinHeight(0).Center().Gap(10).Children(func() { + ui.Icon(c, icons.FileCode).Size(28, 28).Color(p.subtle) + ui.Wrap(c, i18n.Shared(language, "desktop.languageSettings.empty")).FontSize(13).Color(p.muted).TextCenter().Width(emptyWidth) + if w.ctrl.opts.Marketplace != nil && w.button(c.Part("marketplace"), buttonPlain, i18n.Shared(language, "desktop.languageSettings.browse"), false) { + w.pluginTab = pluginTabMarketplace + w.selectSettingsPage(pagePlugins, "") + } + }) +} diff --git a/desktop/internal/settingswindow/languages_view_test.go b/desktop/internal/settingswindow/languages_view_test.go new file mode 100644 index 000000000..40efa0de1 --- /dev/null +++ b/desktop/internal/settingswindow/languages_view_test.go @@ -0,0 +1,221 @@ +package settingswindow + +import ( + "context" + "encoding/json" + "os" + "strings" + "testing" + + "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" + "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" + "github.com/1lck/Lithe-IDEA/desktop/internal/marketplace" + "github.com/vivaui/viva/app" + "github.com/vivaui/viva/gfx" +) + +// languagePageContributions are enabled synthetic plugins, dev.example. for each +// of languages, each with one setting on the page of its language, so the real Core projects +// one page for each under Languages & Frameworks. +func languagePageContributions(t *testing.T, languages ...string) []core.SettingsContribution { + t.Helper() + contributions := make([]core.SettingsContribution, 0, len(languages)) + for _, language := range languages { + contributions = append(contributions, languagePageContribution(t, "dev.example."+language, language)) + } + return contributions +} + +// languagePageContribution is the enabled synthetic plugin id, titled "Test +// plugin", with one setting, "Run checks", on the page of language. +func languagePageContribution(t *testing.T, id, language string) core.SettingsContribution { + t.Helper() + data, err := os.ReadFile(contractfixture.CoreFixture("plugins/settings-documents.json")) + if err != nil { + t.Fatal(err) + } + var fixture struct{ Manifest map[string]any } + if err := json.Unmarshal(data, &fixture); err != nil { + t.Fatal(err) + } + fixture.Manifest["id"] = id + fixture.Manifest["displayName"] = "Test " + strings.TrimPrefix(id, "dev.example.") + " plugin" + fixture.Manifest["settings"] = []any{ + map[string]any{"id": "checks", "type": "boolean", "title": "Run checks", "default": true, "page": map[string]string{"languageID": language}, "section": "Options"}, + } + delete(fixture.Manifest, "settingActions") + manifest, err := json.Marshal(fixture.Manifest) + if err != nil { + t.Fatal(err) + } + return core.SettingsContribution{Manifest: manifest, Owner: core.PluginSettingsOwner{PluginID: id, Version: "1.0.0"}, Enabled: true} +} + +// languagesWindow is an English settings window on the General page whose synthetic plugins +// contribute a page for each of languages, with the catalog loaded. adjust changes its options. +func languagesWindow(t *testing.T, adjust func(*Options), languages ...string) (*window, *windowDriver) { + t.Helper() + return contributedWindow(t, adjust, languagePageContributions(t, languages...), len(languages)) +} + +// contributedWindow is an English settings window on the General page with the plugin +// settings contributions, once the catalog lists its pages. adjust changes its options. +func contributedWindow(t *testing.T, adjust func(*Options), contributions []core.SettingsContribution, pages int) (*window, *windowDriver) { + t.Helper() + client := core.NewClient() + opts := Options{ + Text: func() *i18n.Messages { return i18n.For(i18n.English) }, Language: func() i18n.Language { return i18n.English }, + PluginSettings: newBuildFormSource(t, client, contributions), + SettingsNavigation: client.SettingsNavigation, + SettingsPages: func(ctx context.Context, _ i18n.Language) ([]core.SettingsPage, error) { + return client.SettingsPages(ctx, contributions, "") + }, + } + if adjust != nil { + adjust(&opts) + } + w := newWindow(NewController(opts), Values{Theme: "dark"}) + d := openWindow(t, w, func(config *app.Config) { config.Height = 900 }) + d.until("the plugin pages", func() bool { return w.dynamic.loaded && len(w.dynamic.pages) == pages }) + return w, d +} + +// sidebarRowHit is the sidebar's row labeled label itself, the widest of its controls, rather +// than the chevron before a group's title, which is labeled the same and only folds it. +func (d *windowDriver) sidebarRowHit(label string) gfx.Hit { + d.t.Helper() + var found gfx.Hit + for _, hit := range d.driver.Snapshot().Hits { + if hit.Label == label && !hit.IsLabel && !hit.Backdrop && !hit.ID.IsZero() && hit.Bounds.X < sidebarWidth && hit.Bounds.Width > found.Bounds.Width { + found = hit + } + } + if found.Bounds.Width == 0 { + d.t.Fatalf("no sidebar row labeled %q", label) + } + return found +} + +// TestLanguagesPageListsItsPagesAndOpensThem keeps Languages & Frameworks from showing the page +// the new client does not offer: its row opens its own page, which lists every plugin page +// under it with the plugins that provide it and the state of a language's server, opens the +// one clicked, and is opened again from the breadcrumb above that page. +func TestLanguagesPageListsItsPagesAndOpensThem(t *testing.T) { + languages := []string{"alpha", "beta", "gamma"} + states := map[string]string{"dev.example.alpha": "ready", "dev.example.beta": "failed"} + w, d := languagesWindow(t, func(opts *Options) { + opts.LanguageServerState = func(id string) string { return states[id] } + }, languages...) + title := titleOf(&w.text.Settings, pageLanguages) + d.until("the Languages & Frameworks row", func() bool { return d.has(title) }) + d.clickHit(d.sidebarRowHit(title)) + d.until("the Languages & Frameworks page", func() bool { + return w.sess.page == pageLanguages && w.dynamicPage == "" && d.wrapped(i18n.Shared(i18n.English, "desktop.languageSettings.intro")) + }) + if d.wrapped(w.text.Settings.PageLater) { + t.Fatal("Languages & Frameworks still shows the page the new client does not offer") + } + if !w.sess.open[pageLanguages] { + t.Fatal("choosing the Languages & Frameworks row did not expand it") + } + pages := w.languagePages() + if len(pages) != len(languages) { + t.Fatalf("the page lists %d pages, want %d", len(pages), len(languages)) + } + for _, page := range pages { + if !d.text(page.Title) { + t.Fatalf("the page does not list %q", page.Title) + } + provided := i18n.SharedFormat(i18n.English, "desktop.buildSettings.providedBy", map[string]string{"plugin": page.Contributors[0].Title}) + if !d.text(provided) { + t.Fatalf("the row of %q does not say %q", page.Title, provided) + } + } + for _, state := range []string{"ready", "failed", ""} { + words, _ := languageStateWords(i18n.English, state) + if server := i18n.SharedFormat(i18n.English, "desktop.languageSettings.serverState", map[string]string{"state": words}); !d.text(server) { + t.Fatalf("no row says %q", server) + } + } + + d.clickHit(d.contentHit(pages[1].Title)) + d.until("the clicked page", func() bool { + return w.sess.page == pageLanguages && w.dynamicPage == pages[1].Key && w.pluginSettings.loaded && d.wrapped("Run checks") + }) + crumbs := w.appendCrumbs(nil) + if len(crumbs) != 2 || crumbs[0].page != pageLanguages || !crumbs[0].link { + t.Fatalf("breadcrumb above a plugin page = %+v, want Languages & Frameworks as a link", crumbs) + } + d.clickHit(d.contentHit(title)) + d.until("the Languages & Frameworks page again", func() bool { + return w.sess.page == pageLanguages && w.dynamicPage == "" && d.text(pages[0].Title) + }) +} + +// TestLanguagesPageWithoutPluginPages shows where the pages come from while no plugin +// contributes one, and its button opens the marketplace. +func TestLanguagesPageWithoutPluginPages(t *testing.T) { + w, d := languagesWindow(t, func(opts *Options) { + opts.Marketplace = func(context.Context) (marketplace.Snapshot, error) { return marketplace.Snapshot{}, nil } + }) + w.selectSettingsPage(pageLanguages, "") + empty := i18n.Shared(i18n.English, "desktop.languageSettings.empty") + d.until("the empty Languages & Frameworks page", func() bool { return d.wrapped(empty) }) + if d.wrapped(w.text.Settings.PageLater) { + t.Fatal("Languages & Frameworks still shows the page the new client does not offer") + } + if d.wrapped(i18n.Shared(i18n.English, "desktop.languageSettings.intro")) { + t.Fatal("the empty page asks to choose a page it does not list") + } + d.click(i18n.Shared(i18n.English, "desktop.languageSettings.browse")) + d.until("the marketplace", func() bool { return w.sess.page == pagePlugins && w.pluginTab == pluginTabMarketplace }) +} + +// TestLanguagePageDoesNotRepeatItsDirectoryRow keeps a language page from repeating what its +// row in the directory says: the page one plugin provides opens on that plugin's settings, +// without a chooser of the one plugin or a card of its language server's state. The chooser +// is there while two plugins contribute to the page, the one way to switch between them. +func TestLanguagePageDoesNotRepeatItsDirectoryRow(t *testing.T) { + contributions := append(languagePageContributions(t, "alpha", "beta"), languagePageContribution(t, "dev.example.beta-extra", "beta")) + w, d := contributedWindow(t, func(opts *Options) { + opts.LanguageServerState = func(string) string { return "ready" } + }, contributions, 2) + open := func(language string) { + t.Helper() + key := "" + for _, page := range w.languagePages() { + for _, contribution := range page.Contributors { + if contribution.PluginID == "dev.example."+language { + key = page.Key + } + } + } + if key == "" { + t.Fatalf("no page of %s", language) + } + w.selectSettingsPage(pageLanguages, key) + d.until("the page of "+language, func() bool { + return w.dynamicPage == key && w.contributorID != "" && w.pluginSettings.id == w.contributorID && + w.pluginSettings.loaded && d.wrapped("Run checks") + }) + } + chooser := i18n.Shared(i18n.English, "desktop.pluginSettings.contributor") + ready, _ := languageStateWords(i18n.English, "ready") + + open("alpha") + if d.has(chooser) { + t.Fatal("the page one plugin provides chooses between plugins") + } + if d.text(ready) { + t.Fatalf("the page repeats its directory row's language server state %q", ready) + } + + open("beta") + if !d.has(chooser) { + t.Fatal("the page two plugins contribute to has no chooser between them") + } + if d.text(ready) { + t.Fatalf("the page repeats its directory row's language server state %q", ready) + } +} diff --git a/desktop/internal/settingswindow/languages_visual_test.go b/desktop/internal/settingswindow/languages_visual_test.go new file mode 100644 index 000000000..207c50531 --- /dev/null +++ b/desktop/internal/settingswindow/languages_visual_test.go @@ -0,0 +1,81 @@ +//go:build vivahead && lithevisual + +package settingswindow + +import ( + "context" + "os" + "path/filepath" + "testing" + + "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/1lck/Lithe-IDEA/desktop/internal/i18n" + "github.com/1lck/Lithe-IDEA/desktop/internal/marketplace" + "github.com/vivaui/viva/headless" +) + +// TestVisualLanguagesPage renders the Languages & Frameworks page of synthetic plugins that +// contribute four language pages, whose language servers are in different states, the page +// while no plugin contributes one, and the page of one language opened from it. The real Core projects the pages. Opt in with +// -tags 'vivahead lithevisual' and LITHE_VISUAL_OUTPUT_DIR. +func TestVisualLanguagesPage(t *testing.T) { + out := os.Getenv("LITHE_VISUAL_OUTPUT_DIR") + if out == "" { + t.Skip("set LITHE_VISUAL_OUTPUT_DIR to capture the Languages & Frameworks page") + } + if err := os.MkdirAll(out, 0755); err != nil { + t.Fatal(err) + } + states := map[string]string{"dev.example.go": "ready", "dev.example.python": "starting", "dev.example.rust": "failed"} + for _, look := range []struct { + name string + theme string + language i18n.Language + languages []string + open string + }{ + {"languages-settings-dark", "dark", i18n.Chinese, []string{"go", "python", "rust", "typescript"}, ""}, + {"languages-settings-light", "light", i18n.English, []string{"go", "python", "rust", "typescript"}, ""}, + {"languages-settings-empty", "dark", i18n.Chinese, nil, ""}, + {"languages-settings-go-page-dark", "dark", i18n.Chinese, []string{"go", "python", "rust", "typescript"}, "dev.example.go"}, + } { + t.Run(look.name, func(t *testing.T) { + contributions := languagePageContributions(t, look.languages...) + client := core.NewClient() + w := newWindow(NewController(Options{ + Text: func() *i18n.Messages { return i18n.For(look.language) }, Language: func() i18n.Language { return look.language }, + SystemLanguage: look.language, SystemDark: func() bool { return look.theme == "dark" }, + PluginSettings: newBuildFormSource(t, client, contributions), + SettingsNavigation: client.SettingsNavigation, + SettingsPages: func(ctx context.Context, _ i18n.Language) ([]core.SettingsPage, error) { + return client.SettingsPages(ctx, contributions, "") + }, + LanguageServerState: func(id string) string { return states[id] }, + Marketplace: func(context.Context) (marketplace.Snapshot, error) { return marketplace.Snapshot{}, nil }, + }), Values{Theme: look.theme, Language: look.language.Code()}) + w.sess.page = pageLanguages + w.sess.open[pageLanguages] = true + config := w.config() + config.Height = 700 + session, err := headless.Open(config, nil, headless.Options{}) + if err != nil { + t.Fatal(err) + } + t.Cleanup(session.Close) + d := &windowDriver{t: t, w: w, driver: session.Driver()} + d.until("the plugin pages", func() bool { return w.dynamic.loaded && len(w.dynamic.pages) == len(look.languages) }) + if look.open != "" { + for _, page := range w.languagePages() { + if page.Contributors[0].PluginID == look.open { + w.selectSettingsPage(pageLanguages, page.Key) + } + } + d.until("the opened page", func() bool { return w.dynamicPage != "" && w.pluginSettings.loaded && d.wrapped("Run checks") }) + } + d.pump() + if err := session.Screenshot(filepath.Join(out, look.name+".png")); err != nil { + t.Fatal(err) + } + }) + } +} diff --git a/desktop/internal/settingswindow/model.go b/desktop/internal/settingswindow/model.go index d6fb08ed3..e09c7d012 100644 --- a/desktop/internal/settingswindow/model.go +++ b/desktop/internal/settingswindow/model.go @@ -39,6 +39,9 @@ const ( pageToolchains pageDebuggers pageConsole + // pageLanguages is "Languages & Frameworks", a top-level page with no static pages + // under it: the pages plugins contribute to it make it a group, and its own page is the + // directory of them. pageLanguages // pageTools is the group "Tools"; the page after it belongs to it. pageTools @@ -105,8 +108,10 @@ func isGroup(id pageID) bool { } // ownsPage says whether the group id also opens a page of its own when its row is -// chosen, instead of only expanding and collapsing. -func ownsPage(id pageID) bool { return id == pageBuild } +// chosen, instead of only expanding and collapsing: Build, Execution, Deployment and +// Languages & Frameworks open the directory of their pages (languages_view.go), which the +// breadcrumb above one of those pages links to as well. +func ownsPage(id pageID) bool { return id == pageBuild || id == pageLanguages } // titleOf is the name of an entry in the language of messages. func titleOf(messages *i18n.SettingsMessages, id pageID) string { diff --git a/desktop/internal/settingswindow/plugin_settings_view.go b/desktop/internal/settingswindow/plugin_settings_view.go index 90ba3597b..b8fe544f1 100644 --- a/desktop/internal/settingswindow/plugin_settings_view.go +++ b/desktop/internal/settingswindow/plugin_settings_view.go @@ -32,14 +32,16 @@ func (w *window) scopeLabel(scope int) string { // pluginSettingsPanel is the form of the plugin id: the toolbar that reloads or saves it, // what the last request said, the scope and then Core's rows in Core's order. The drafts -// live in the form, so the panel can come and go without losing them. +// live in the form, so the panel can come and go without losing them. ruled draws a line +// above the toolbar, which parts the form from what its parent shows above it; a page that +// opens on the form leaves it out. // // The panel grows into the height its parent leaves under what sits above it, and the rows' // list fills what the panel's header leaves, so the last row ends at the bottom of the page // and not at a fixed height above blank space. The list keeps settingsListMinHeight, so the // parent must be a scroll that grows its content to the viewport: a short window scrolls // the page rather than cutting the list's last rows off under the window's buttons. -func (w *window) pluginSettingsPanel(c ui.C, id string) { +func (w *window) pluginSettingsPanel(c ui.C, id string, ruled bool) { if !w.selectPluginForm(id) { ui.Wrap(c, i18n.Shared(w.marketLanguage(), "desktop.pluginSettings.draftLimit")).Color(w.pal.danger) return @@ -66,7 +68,9 @@ func (w *window) pluginSettingsPanel(c ui.C, id string) { compiler := page != nil && page.Kind == "compiler" ui.Column(c).FillWidth().Grow(1).Gap(10).Children(func() { if !compiler { - ui.Row(c).FillWidth().Height(1).Background(w.pal.line) + if ruled { + ui.Row(c).FillWidth().Height(1).Background(w.pal.line) + } ui.Row(c).FillWidth().Gap(8).Items(ui.Center).Children(func() { ui.Text(c, i18n.Shared(language, "desktop.pluginSettings.title")).FontSize(14).Weight(gfx.WeightSemibold).Color(w.pal.text) ui.Spacer(c) diff --git a/desktop/internal/settingswindow/settings_surfaces.go b/desktop/internal/settingswindow/settings_surfaces.go index 2de5b49c0..6a57ecccc 100644 --- a/desktop/internal/settingswindow/settings_surfaces.go +++ b/desktop/internal/settingswindow/settings_surfaces.go @@ -347,9 +347,11 @@ func (w *window) selectPluginForm(id string) bool { } // dynamicSettingsPage is the settings page a plugin contributes to a language or a build -// system: the contributors' chooser above the selected contributor's form. It scrolls, named -// by the page so it starts at its top each time the page is opened, and the form grows to -// the scroll's height. +// system: the chosen contributor's form, under the chooser of the contributor while more than +// one contributes. The page does not repeat what its row in the group's directory says, the +// plugins that provide it and the state of a language's server. It scrolls, named by the page +// so it starts at its top each time the page is opened, and the form grows to the scroll's +// height. func (w *window) dynamicSettingsPage(c ui.C) { page := w.dynamic.selected(w.dynamicPage) ui.Scroll(c.Key(w.dynamicPage)).Scrollbars().FillWidth().Grow(1).Shrink(1).MinHeight(0).Pad(contentPad).Gap(10).Children(func() { @@ -364,12 +366,12 @@ func (w *window) dynamicSettingsPage(c ui.C) { if w.contributionOf(page) < 0 { w.contributorID = page.Contributors[0].PluginID } - ids := w.dynamic.contributorIDs[page.Key] - ui.Select(c, &w.contributorID, ids, w.contributorLabel).FillWidth().Label(i18n.Shared(w.marketLanguage(), "desktop.pluginSettings.contributor")) - if page.Kind == "language" { - w.languageStatusCard(c, w.contributorID) + chooser := len(page.Contributors) > 1 + if chooser { + ids := w.dynamic.contributorIDs[page.Key] + ui.Select(c, &w.contributorID, ids, w.contributorLabel).FillWidth().Label(i18n.Shared(w.marketLanguage(), "desktop.pluginSettings.contributor")) } - w.pluginSettingsPanel(c, w.contributorID) + w.pluginSettingsPanel(c, w.contributorID, chooser) }) } diff --git a/desktop/internal/settingswindow/window.go b/desktop/internal/settingswindow/window.go index 966e385cf..d94536215 100644 --- a/desktop/internal/settingswindow/window.go +++ b/desktop/internal/settingswindow/window.go @@ -137,7 +137,9 @@ type window struct { apply buildApply // kinds is the list of each kind of plugin pages under Build, by the kind's place in // buildKinds: its filter, its rows and the page it last showed. - kinds [len(buildKinds)]kindState + kinds [len(buildKinds)]kindState + // languages is the directory of the Languages & Frameworks page (languages_view.go). + languages ui.ListState pluginSettings *pluginSettingsForm pluginForms map[string]*pluginSettingsForm // region is the plugin view of the settings region on screen (plugin_region_view.go). diff --git a/desktop/internal/settingswindow/window_view.go b/desktop/internal/settingswindow/window_view.go index 19d2f2216..ac856485b 100644 --- a/desktop/internal/settingswindow/window_view.go +++ b/desktop/internal/settingswindow/window_view.go @@ -128,8 +128,8 @@ func (w *window) sidebar(c ui.C) { } // chooseRow opens what row r stands for. A group without a page of its own folds; one with a -// page, which Build is and plugins' pages make any entry they are under, opens it, and Build -// lists its pages as it opens. A kind's row opens the kind's page. A search ends once its row +// page, which Build and Languages & Frameworks are and plugins' pages make any entry they are +// under, opens it, and a group that owns its page lists its pages as it opens. A kind's row opens the kind's page. A search ends once its row // is chosen, with the rows above the page opened so the page's row is on the screen. func (w *window) chooseRow(r row) { if w.chooseSearchRow(r) { @@ -143,8 +143,8 @@ func (w *window) chooseRow(r row) { w.toggleRow(r) return default: - if r.page == pageBuild { - w.sess.open[pageBuild] = true + if ownsPage(r.page) { + w.sess.open[r.page] = true } w.selectSettingsPage(r.page, r.dynamic) } @@ -368,6 +368,8 @@ func (w *window) content(c ui.C) { w.fontsPage(c) case w.sess.page == pageBuild: w.buildPage(c.Part("build")) + case w.sess.page == pageLanguages: + w.languagesPage(c.Part("languages")) case w.sess.page == pageToolchains: w.toolchainsPage(c) case w.sess.page == pageDebuggers: @@ -400,7 +402,7 @@ func (w *window) content(c ui.C) { // breadcrumb is the prototype's .crumb: where the open page is, its group first and the page // last in the weight of the text. A title before the last that has a page of its own opens it: -// Build, Execution, Deployment its directory. +// Build, Execution, Deployment and Languages & Frameworks their directories. func (w *window) breadcrumb(c ui.C) { b := &w.bp w.crumbs = w.appendCrumbs(w.crumbs[:0]) @@ -460,8 +462,8 @@ func (w *window) appendCrumbs(dst []crumb) []crumb { // chooseCrumb opens the page a title of the breadcrumb stands for. func (w *window) chooseCrumb(crumb crumb) { - if crumb.page == pageBuild { - w.sess.open[pageBuild] = true + if ownsPage(crumb.page) { + w.sess.open[crumb.page] = true } w.selectSettingsPage(crumb.page, "") } diff --git a/docs/assets/languages-settings/languages-settings-before-dark.png b/docs/assets/languages-settings/languages-settings-before-dark.png new file mode 100644 index 000000000..95739252e Binary files /dev/null and b/docs/assets/languages-settings/languages-settings-before-dark.png differ diff --git a/docs/assets/languages-settings/languages-settings-dark.png b/docs/assets/languages-settings/languages-settings-dark.png new file mode 100644 index 000000000..f9dde6751 Binary files /dev/null and b/docs/assets/languages-settings/languages-settings-dark.png differ diff --git a/docs/assets/languages-settings/languages-settings-empty.png b/docs/assets/languages-settings/languages-settings-empty.png new file mode 100644 index 000000000..47ddd7256 Binary files /dev/null and b/docs/assets/languages-settings/languages-settings-empty.png differ diff --git a/docs/assets/languages-settings/languages-settings-go-page-before-dark.png b/docs/assets/languages-settings/languages-settings-go-page-before-dark.png new file mode 100644 index 000000000..bd38574ce Binary files /dev/null and b/docs/assets/languages-settings/languages-settings-go-page-before-dark.png differ diff --git a/docs/assets/languages-settings/languages-settings-go-page-dark.png b/docs/assets/languages-settings/languages-settings-go-page-dark.png new file mode 100644 index 000000000..ac7c4048f Binary files /dev/null and b/docs/assets/languages-settings/languages-settings-go-page-dark.png differ diff --git a/docs/assets/languages-settings/languages-settings-light.png b/docs/assets/languages-settings/languages-settings-light.png new file mode 100644 index 000000000..d0f66b239 Binary files /dev/null and b/docs/assets/languages-settings/languages-settings-light.png differ diff --git a/shared/i18n/features/languages-settings.json b/shared/i18n/features/languages-settings.json new file mode 100644 index 000000000..cb9d80862 --- /dev/null +++ b/shared/i18n/features/languages-settings.json @@ -0,0 +1,68 @@ +{ + "schemaVersion": 1, + "messages": [ + { + "id": "desktop.languageSettings.intro", + "description": "Languages & Frameworks settings page: the line under its heading on what the page lists", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.languageSettings.loading", + "description": "Languages & Frameworks settings page: shown while the settings pages plugins contribute are still being read", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.languageSettings.failed", + "description": "Languages & Frameworks settings page: shown when the settings pages plugins contribute could not be read", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.languageSettings.empty", + "description": "Languages & Frameworks settings page: shown while no enabled plugin contributes a page under it", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.languageSettings.browse", + "description": "Languages & Frameworks settings page: button of the empty page that opens the plugin marketplace", + "platforms": [ + "desktop" + ] + }, + { + "id": "desktop.languageSettings.serverState", + "description": "Languages & Frameworks settings page: the state of the language server a language row's plugin runs, at the end of the row", + "platforms": [ + "desktop" + ], + "parameters": { + "state": "string" + } + } + ], + "locales": { + "en-US": { + "desktop.languageSettings.intro": "Settings that installed plugins provide for languages and frameworks. Choose one to open its settings.", + "desktop.languageSettings.loading": "Reading plugin settings…", + "desktop.languageSettings.failed": "Could not read the settings pages plugins provide.", + "desktop.languageSettings.empty": "No plugin provides language or framework settings yet. Install a language plugin and its settings appear here.", + "desktop.languageSettings.browse": "Browse Marketplace", + "desktop.languageSettings.serverState": "Language server: {state}" + }, + "zh-CN": { + "desktop.languageSettings.intro": "已安装插件为语言和框架提供的设置。选择一项打开它的设置。", + "desktop.languageSettings.loading": "正在读取插件设置…", + "desktop.languageSettings.failed": "无法读取插件提供的设置页。", + "desktop.languageSettings.empty": "还没有插件提供语言或框架设置。安装语言插件后,它的设置会出现在这里。", + "desktop.languageSettings.browse": "浏览插件市场", + "desktop.languageSettings.serverState": "语言服务:{state}" + } + } +} diff --git a/shared/i18n/locales/en-US.json b/shared/i18n/locales/en-US.json index 69e47845b..4a43c63ca 100644 --- a/shared/i18n/locales/en-US.json +++ b/shared/i18n/locales/en-US.json @@ -10881,7 +10881,6 @@ "desktop.debug.breakpoint.functionRow": "ƒ {name}", "desktop.debug.breakpoint.removeFunction": "Remove method breakpoint", "desktop.marketplace.tab.settings": "Settings", - "desktop.languageStatus.title": "Language server", "desktop.languageStatus.none": "Not running", "desktop.languageStatus.starting": "Starting", "desktop.languageStatus.ready": "Ready", diff --git a/shared/i18n/locales/zh-CN.json b/shared/i18n/locales/zh-CN.json index f99c2bba7..45341cdfa 100644 --- a/shared/i18n/locales/zh-CN.json +++ b/shared/i18n/locales/zh-CN.json @@ -10881,7 +10881,6 @@ "desktop.debug.breakpoint.functionRow": "ƒ {name}", "desktop.debug.breakpoint.removeFunction": "移除方法断点", "desktop.marketplace.tab.settings": "设置", - "desktop.languageStatus.title": "语言服务", "desktop.languageStatus.none": "未运行", "desktop.languageStatus.starting": "正在启动", "desktop.languageStatus.ready": "就绪", diff --git a/shared/i18n/messages.json b/shared/i18n/messages.json index 432b7b69f..116f066fd 100644 --- a/shared/i18n/messages.json +++ b/shared/i18n/messages.json @@ -12381,49 +12381,42 @@ }, { "id": "desktop.languageStatus.degraded", - "description": "Language server state card value when it runs with reduced features", + "description": "Language server state on a language row of the Languages & Frameworks directory when it runs with reduced features", "platforms": [ "desktop" ] }, { "id": "desktop.languageStatus.failed", - "description": "Language server state card value when it failed", + "description": "Language server state on a language row of the Languages & Frameworks directory when it failed", "platforms": [ "desktop" ] }, { "id": "desktop.languageStatus.none", - "description": "Language server state card value when no server runs", + "description": "Language server state on a language row of the Languages & Frameworks directory when no server runs", "platforms": [ "desktop" ] }, { "id": "desktop.languageStatus.ready", - "description": "Language server state card value when it is ready", + "description": "Language server state on a language row of the Languages & Frameworks directory when it is ready", "platforms": [ "desktop" ] }, { "id": "desktop.languageStatus.starting", - "description": "Language server state card value while it starts", + "description": "Language server state on a language row of the Languages & Frameworks directory while it starts", "platforms": [ "desktop" ] }, { "id": "desktop.languageStatus.stopped", - "description": "Language server state card value when it stopped", - "platforms": [ - "desktop" - ] - }, - { - "id": "desktop.languageStatus.title", - "description": "Label of the language server state card on a language settings page", + "description": "Language server state on a language row of the Languages & Frameworks directory when it stopped", "platforms": [ "desktop" ] diff --git a/shared/platform-feature-matrix/features/application-settings.json b/shared/platform-feature-matrix/features/application-settings.json index 7abc0fa2b..7d68afa03 100644 --- a/shared/platform-feature-matrix/features/application-settings.json +++ b/shared/platform-feature-matrix/features/application-settings.json @@ -31,7 +31,10 @@ "desktop/internal/settingswindow/controller.go", "desktop/internal/settingswindow/window_size_test.go", "desktop/internal/workbench/app.go", - "desktop/internal/workbench/window_sessions_test.go" + "desktop/internal/workbench/window_sessions_test.go", + "desktop/internal/settingswindow/languages_view.go", + "desktop/internal/settingswindow/languages_view_test.go", + "desktop/internal/settingswindow/languages_visual_test.go" ] }, "windows": { @@ -58,12 +61,15 @@ "desktop/internal/settingswindow/controller.go", "desktop/internal/settingswindow/window_size_test.go", "desktop/internal/workbench/app.go", - "desktop/internal/workbench/window_sessions_test.go" + "desktop/internal/workbench/window_sessions_test.go", + "desktop/internal/settingswindow/languages_view.go", + "desktop/internal/settingswindow/languages_view_test.go", + "desktop/internal/settingswindow/languages_visual_test.go" ] }, "owner": "Settings", - "notes": "Viva 设置窗口的每个侧栏页都已接入:外观、常规、网络、编辑器、字体、快捷键、进程终止、插件、版本控制、构建与工具链、语言(插件贡献的动态页)、终端、AI 生成与 IDE API;外观与语言选择后立即应用。尚未完成原版界面像素级对照或跨平台实机验收。 本次按 main-macos-live-baseline(源提交 a824bd5c)校准初始窗口(当时 900×700,2026-11-21 起默认 1270×700)、234pt 侧栏、24pt 导航行、深浅色页面/卡片/下拉层级和页边距;已检查 macOS 原生通用页及语言下拉,仍不代表所有设置页逐像素验收。 本轮全页对照将自动保存入口移回通用页,终端 Shell 改为共享下拉并保留检测/缺失/自动生效值,退出策略按原版合并同行,更新页拆开版本与操作。 编辑器标签的滚动、压缩和多行布局统一为共享下拉,选择多行时保留先前单行溢出偏好。TestVisualSettings 以离线事实采集深浅色页面和菜单;工具真实来源与未实现设置项仍按既有状态记录,不能把截图覆盖当原生验收。 正式版与 AutoBuild 共用同一份设置:读到当前版本不认识的键,或字段在、但存的形状读不了的值时,照常用默认行为运行,保存时把这些值原样写回,不删除;不认识的键每组只通知一次,形状读不了的值记 app.settings.decode_failed(编辑器会话记 editor_session_load)。当前版本改过或清空的字段以当前版本为准。 Viva 2026-11-16:侧栏“构建、执行、部署”“语言与框架”在有插件贡献子页时与“工具”一样可折叠,选中子页时自动展开所属分组。自动化:TestContributedPagesGoUnderBuildOrLanguages。原生验收仍 pending。 2026-11-16 #1943:偏好文件读取或 JSON 解码失败后,下一次 Save 先把原文件改名为 <名称>.unreadable- 另存,再写入新值,原内容不被默认值覆盖;启动时提示另存位置仍待补齐。macOS/Windows 共用 Go 实现,实机验收保持 pending。 2026-11-18:设置窗口的 ⓘ 和工作台、日志窗口一致,只用悬停提示;点击不再弹出会固定的白色说明卡片,因此 Escape 关闭卡片、键盘 Space/Return 打开说明也一并取消。键盘聚焦不显示提示(Viva ui 层未开放 ShowOnFocus),辅助技术仍能读出说明。 2026-11-18:删除外观与行为下的“更新”页,自动检查、更新渠道、发布源和立即检查整体迁入“关于”的更新卡片,侧栏少一行;自动化:TestDefaultSidebarListsTheTopLevelWithAppearanceExpanded、TestAboutPageNamesTheRunningVersionAsItIsReleased。 Viva 2026-11-18(构建设置重构):“构建、执行、部署”改为分组,选中时显示目录页,固定子页为“工具链”“调试器”,插件声明的页面按种类(构建工具、编译器)额外聚合到这里,插件详情的「设置」标签仍保留同一份设置和草稿;每个种类在侧栏只占一行并显示页面数,点开与“工具链”“调试器”一样分栏:左侧列出这一类的页面和提供插件,可按名称或插件筛选,右侧是选中页面的设置,再次打开回到上次看的页面;插件页只在搜索命中时单独出现在侧栏;目录页每个种类列出前 3 个名称并计数其余。只有 Build 页面或有草稿时页脚才显示“应用”,没有草稿时“好”直接关闭。自动化:TestBuildKindIsOneRowThatOpensItsPage、TestBuildKindFilterKeepsThePagesItMatchesAndTheKindRemembersOne、TestBuildPageNamesAKindAndOpensItsPage、TestSearchListsOnlyTheKindPagesItMatches,TestVisualSettings 的 32/33/34 场景生成截图。原生与 Windows 验收仍 pending。 2026-11-21:Viva 设置窗口默认尺寸改为 1270×700(最小仍为 900×668);用户调整后的尺寸会被记住,下次打开按该尺寸显示:窗口关闭时尺寸与打开时不同才写入应用设置(settingsWindowWidth/settingsWindowHeight),拖动过程中不写盘;工作台退出或关闭标签页连带关闭设置窗口时,先同步取走尺寸再关闭;同一窗口的各项目标签页共用这个尺寸,从哪个标签页打开都按它显示,其他标签页保存设置时也不会写回旧尺寸。全屏、最大化和最小化时的尺寸不记住(Viva 在这些状态不上报窗口帧),窗口位置不记住;记住的尺寸小于最小尺寸时按最小尺寸打开。自动化:TestWindowOpensAtTheSizeTheUserLastGaveIt、TestClosingKeepsTheSizeTheUserGaveTheWindow、TestResizedWindowGivesTheSizeBeforeTheWindowCloses、TestSettingsWindowSizePersistsWithOtherSettings、TestSettingsWindowSizeIsEveryProjectTabs,TestVisualSettings 生成 1270×700 截图。macOS 原生与 Windows 实机验收仍 pending。", - "verification": "无头窗口覆盖 ⓘ 说明只在指针停留时以客户端共享提示气泡显示在图标右侧(右侧放不下时换到左侧)、点击图标只收起提示而不再固定白色说明卡片、辅助技术把说明读作图标描述,窄窗口实际值,外观和语言即时应用、恢复默认、关闭不回滚,以及日志窗口重绘和跟随系统外观;分别生成常规设置截图、与原版 macOS 布局对照。完整设置页、真实窗口与真实配置读写仍待验收,Windows 尚未运行本次测试。运行 scripts/desktop/desktop-go.sh test -race ./internal/logwindow ./internal/settingswindow ./internal/workbench -run 'TestOpenWindowRepaintsWhenLanguageAndAppearanceChange|TestGeneral|TestSettingsChangesUpdateSharedStateAndPersist|TestSystemAppearanceChangesSharedStateWhenFollowingSystem' -count=3。 store 的 keep_test.go 覆盖保存保留新版本写的键、不复活当前版本清空的键、保留读不了形状的值并由 Unread 报出、键名按 encoding/json 规则匹配;workbench 的 settings_kept_test.go 覆盖新版本写的设置只通知一次并保留,标题栏布局和编辑器会话中读不了的值会记日志。运行 scripts/desktop/desktop-go.sh test -race ./internal/store ./internal/workbench -run 'TestSave|TestLoad|TestUnread|TestSettingsANewerVersion|TestALayoutPart|TestAnEditorSession'。 #1943:TestSaveAfterAFailedLoadSetsTheUnreadableFileAside、TestSaveSetsNothingAsideOnceTheUnreadableFileIsGone 与 TestSaveAfterAFailedLoadWritesWhenTheFileIsAlreadyGone 覆盖读不出的文件在保存前另存且内容不变、同一次失败只另存一次、其他文件不受影响、文件已删除或被 Remove 后不另存;运行 scripts/desktop/desktop-go.sh test ./internal/store -run 'TestSave|TestLoad|TestUnread' -count=1。 2026-11-21 设置窗口尺寸:首次打开(无已存尺寸)确认为 1270×700;拖动调整到其他尺寸后点“好”、“取消”或标题栏关闭,再打开确认按上次尺寸显示,重启应用后仍保持;调整尺寸后直接退出应用或关闭项目标签页,重开设置确认尺寸已保存;打开两个项目标签页,在一个标签页调整尺寸后关闭,从另一个标签页打开确认按新尺寸显示;只移动窗口不改尺寸、或改回打开时的尺寸,不写设置文件;全屏或最大化后关闭,确认下次按全屏前的尺寸打开。运行 scripts/desktop/desktop-go.sh test -race ./internal/settingswindow ./internal/workbench -run 'TestWindowOpensAtTheSizeTheUserLastGaveIt|TestClosingKeepsTheSizeTheUserGaveTheWindow|TestResizedWindowGivesTheSizeBeforeTheWindowCloses|TestBaselineSettingsControlsFitReferenceWindow|TestSettingsWindowSizePersistsWithOtherSettings|TestSettingsWindowSizeIsEveryProjectTabs' -count=1。", + "notes": "Viva 设置窗口的每个侧栏页都已接入:外观、常规、网络、编辑器、字体、快捷键、进程终止、插件、版本控制、构建与工具链、语言(插件贡献的动态页)、终端、AI 生成与 IDE API;外观与语言选择后立即应用。尚未完成原版界面像素级对照或跨平台实机验收。 本次按 main-macos-live-baseline(源提交 a824bd5c)校准初始窗口(当时 900×700,2026-11-21 起默认 1270×700)、234pt 侧栏、24pt 导航行、深浅色页面/卡片/下拉层级和页边距;已检查 macOS 原生通用页及语言下拉,仍不代表所有设置页逐像素验收。 本轮全页对照将自动保存入口移回通用页,终端 Shell 改为共享下拉并保留检测/缺失/自动生效值,退出策略按原版合并同行,更新页拆开版本与操作。 编辑器标签的滚动、压缩和多行布局统一为共享下拉,选择多行时保留先前单行溢出偏好。TestVisualSettings 以离线事实采集深浅色页面和菜单;工具真实来源与未实现设置项仍按既有状态记录,不能把截图覆盖当原生验收。 正式版与 AutoBuild 共用同一份设置:读到当前版本不认识的键,或字段在、但存的形状读不了的值时,照常用默认行为运行,保存时把这些值原样写回,不删除;不认识的键每组只通知一次,形状读不了的值记 app.settings.decode_failed(编辑器会话记 editor_session_load)。当前版本改过或清空的字段以当前版本为准。 Viva 2026-11-16:侧栏“构建、执行、部署”“语言与框架”在有插件贡献子页时与“工具”一样可折叠,选中子页时自动展开所属分组。自动化:TestContributedPagesGoUnderBuildOrLanguages。原生验收仍 pending。 2026-11-16 #1943:偏好文件读取或 JSON 解码失败后,下一次 Save 先把原文件改名为 <名称>.unreadable- 另存,再写入新值,原内容不被默认值覆盖;启动时提示另存位置仍待补齐。macOS/Windows 共用 Go 实现,实机验收保持 pending。 2026-11-18:设置窗口的 ⓘ 和工作台、日志窗口一致,只用悬停提示;点击不再弹出会固定的白色说明卡片,因此 Escape 关闭卡片、键盘 Space/Return 打开说明也一并取消。键盘聚焦不显示提示(Viva ui 层未开放 ShowOnFocus),辅助技术仍能读出说明。 2026-11-18:删除外观与行为下的“更新”页,自动检查、更新渠道、发布源和立即检查整体迁入“关于”的更新卡片,侧栏少一行;自动化:TestDefaultSidebarListsTheTopLevelWithAppearanceExpanded、TestAboutPageNamesTheRunningVersionAsItIsReleased。 Viva 2026-11-18(构建设置重构):“构建、执行、部署”改为分组,选中时显示目录页,固定子页为“工具链”“调试器”,插件声明的页面按种类(构建工具、编译器)额外聚合到这里,插件详情的「设置」标签仍保留同一份设置和草稿;每个种类在侧栏只占一行并显示页面数,点开与“工具链”“调试器”一样分栏:左侧列出这一类的页面和提供插件,可按名称或插件筛选,右侧是选中页面的设置,再次打开回到上次看的页面;插件页只在搜索命中时单独出现在侧栏;目录页每个种类列出前 3 个名称并计数其余。只有 Build 页面或有草稿时页脚才显示“应用”,没有草稿时“好”直接关闭。自动化:TestBuildKindIsOneRowThatOpensItsPage、TestBuildKindFilterKeepsThePagesItMatchesAndTheKindRemembersOne、TestBuildPageNamesAKindAndOpensItsPage、TestSearchListsOnlyTheKindPagesItMatches,TestVisualSettings 的 32/33/34 场景生成截图。原生与 Windows 验收仍 pending。 2026-11-21:Viva 设置窗口默认尺寸改为 1270×700(最小仍为 900×668);用户调整后的尺寸会被记住,下次打开按该尺寸显示:窗口关闭时尺寸与打开时不同才写入应用设置(settingsWindowWidth/settingsWindowHeight),拖动过程中不写盘;工作台退出或关闭标签页连带关闭设置窗口时,先同步取走尺寸再关闭;同一窗口的各项目标签页共用这个尺寸,从哪个标签页打开都按它显示,其他标签页保存设置时也不会写回旧尺寸。全屏、最大化和最小化时的尺寸不记住(Viva 在这些状态不上报窗口帧),窗口位置不记住;记住的尺寸小于最小尺寸时按最小尺寸打开。自动化:TestWindowOpensAtTheSizeTheUserLastGaveIt、TestClosingKeepsTheSizeTheUserGaveTheWindow、TestResizedWindowGivesTheSizeBeforeTheWindowCloses、TestSettingsWindowSizePersistsWithOtherSettings、TestSettingsWindowSizeIsEveryProjectTabs,TestVisualSettings 生成 1270×700 截图。macOS 原生与 Windows 实机验收仍 pending。 2026-11-21:“语言与框架”在有插件贡献子页时成为分组,此前点它只显示“新桌面端暂未提供此页面”;现在与“构建、执行、部署”一样有自己的目录页:列出插件声明在它下面的每个页面(名称、提供插件,语言页另显示第一个提供插件的语言服务状态),单击或回车打开该页,方向键只移动;列表虚拟化,插件多时同样只绘制可见行;插件页上方的面包屑“语言与框架”可点回目录;点侧栏这一行同时展开分组;没有插件贡献页面时说明页面来源并提供“浏览插件市场”。宿主不为任何语言写专门页面,每一行都来自插件声明。打开的语言页不重复目录行:只有一个插件贡献时不显示插件选择器和语言服务状态卡,直接是插件设置;两个以上插件贡献时保留选择器。自动化:TestLanguagesPageListsItsPagesAndOpensThem、TestLanguagesPageWithoutPluginPages、TestLanguagePageDoesNotRepeatItsDirectoryRow,TestVisualLanguagesPage 生成深浅色、空页面和 Go 语言页截图。macOS 原生与 Windows 实机验收仍 pending。", + "verification": "无头窗口覆盖 ⓘ 说明只在指针停留时以客户端共享提示气泡显示在图标右侧(右侧放不下时换到左侧)、点击图标只收起提示而不再固定白色说明卡片、辅助技术把说明读作图标描述,窄窗口实际值,外观和语言即时应用、恢复默认、关闭不回滚,以及日志窗口重绘和跟随系统外观;分别生成常规设置截图、与原版 macOS 布局对照。完整设置页、真实窗口与真实配置读写仍待验收,Windows 尚未运行本次测试。运行 scripts/desktop/desktop-go.sh test -race ./internal/logwindow ./internal/settingswindow ./internal/workbench -run 'TestOpenWindowRepaintsWhenLanguageAndAppearanceChange|TestGeneral|TestSettingsChangesUpdateSharedStateAndPersist|TestSystemAppearanceChangesSharedStateWhenFollowingSystem' -count=3。 store 的 keep_test.go 覆盖保存保留新版本写的键、不复活当前版本清空的键、保留读不了形状的值并由 Unread 报出、键名按 encoding/json 规则匹配;workbench 的 settings_kept_test.go 覆盖新版本写的设置只通知一次并保留,标题栏布局和编辑器会话中读不了的值会记日志。运行 scripts/desktop/desktop-go.sh test -race ./internal/store ./internal/workbench -run 'TestSave|TestLoad|TestUnread|TestSettingsANewerVersion|TestALayoutPart|TestAnEditorSession'。 #1943:TestSaveAfterAFailedLoadSetsTheUnreadableFileAside、TestSaveSetsNothingAsideOnceTheUnreadableFileIsGone 与 TestSaveAfterAFailedLoadWritesWhenTheFileIsAlreadyGone 覆盖读不出的文件在保存前另存且内容不变、同一次失败只另存一次、其他文件不受影响、文件已删除或被 Remove 后不另存;运行 scripts/desktop/desktop-go.sh test ./internal/store -run 'TestSave|TestLoad|TestUnread' -count=1。 2026-11-21 设置窗口尺寸:首次打开(无已存尺寸)确认为 1270×700;拖动调整到其他尺寸后点“好”、“取消”或标题栏关闭,再打开确认按上次尺寸显示,重启应用后仍保持;调整尺寸后直接退出应用或关闭项目标签页,重开设置确认尺寸已保存;打开两个项目标签页,在一个标签页调整尺寸后关闭,从另一个标签页打开确认按新尺寸显示;只移动窗口不改尺寸、或改回打开时的尺寸,不写设置文件;全屏或最大化后关闭,确认下次按全屏前的尺寸打开。运行 scripts/desktop/desktop-go.sh test -race ./internal/settingswindow ./internal/workbench -run 'TestWindowOpensAtTheSizeTheUserLastGaveIt|TestClosingKeepsTheSizeTheUserGaveTheWindow|TestResizedWindowGivesTheSizeBeforeTheWindowCloses|TestBaselineSettingsControlsFitReferenceWindow|TestSettingsWindowSizePersistsWithOtherSettings|TestSettingsWindowSizeIsEveryProjectTabs' -count=1。 2026-11-21 语言与框架目录页:安装两个以上语言插件,点侧栏“语言与框架”确认显示目录页而不是“暂未提供此页面”,分组同时展开;每行显示页面名称、提供插件和语言服务状态;单击一行打开该语言页,点面包屑“语言与框架”回到目录;在目录列表上用方向键移动、回车打开;禁用所有语言插件后确认显示空页面,点“浏览插件市场”跳到插件市场标签;只有一个插件贡献的语言页顶部没有插件选择器和语言服务状态卡。运行 scripts/desktop/desktop-go.sh test ./internal/settingswindow -run 'TestLanguagesPage|TestLanguagePage' -count=1。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": { diff --git a/shared/platform-feature-matrix/features/lsp-control-center-performance.json b/shared/platform-feature-matrix/features/lsp-control-center-performance.json index cc34dc777..36c6177f7 100644 --- a/shared/platform-feature-matrix/features/lsp-control-center-performance.json +++ b/shared/platform-feature-matrix/features/lsp-control-center-performance.json @@ -56,5 +56,5 @@ ] } }, - "notes": "Viva:语言设置页的服务器状态卡只读窗口线程记录的状态、不等待服务器(language_status_view.go);大型工作区的后台识别、快照缓存与可取消的页面等待没有实现。" + "notes": "Viva:“语言与框架”目录的语言行显示服务器状态,只读窗口线程记录的状态、不等待服务器(language_status_view.go);2026-11-21 起语言页本身不再显示重复的状态卡;大型工作区的后台识别、快照缓存与可取消的页面等待没有实现。" } diff --git a/shared/platform-feature-matrix/features/plugin-registered-settings-pages.json b/shared/platform-feature-matrix/features/plugin-registered-settings-pages.json index 6b401c955..3c147344c 100644 --- a/shared/platform-feature-matrix/features/plugin-registered-settings-pages.json +++ b/shared/platform-feature-matrix/features/plugin-registered-settings-pages.json @@ -2,7 +2,7 @@ "id": "plugin-registered-settings-pages", "area": "插件", "group": "插件管理", - "capability": "插件通过 settings(当前契约版本 0)在 plugin.json 里把设置项和按钮注册到“语言与框架 › <语言>”或“构建、执行、部署 › <构建系统>”页,按 section 分组;设置可声明项目级覆盖(写入项目 .lithe/plugin-settings.json)和生效方式(重启、立即、重新加载、下次运行),“立即生效”的值经 workspace/configuration 推给正在运行的语言服务器;按钮调用插件自己的插件函数。宿主只提供通用页面、控件和语言服务状态卡,不内置任何语言或构建工具的页面;路径选择按钮保持完整可见,窄面板由输入框和标题列缩短以容纳状态标签;settingRegions 让插件在设置页或插件详情的“设置”页签声明区域:区域带搜索关键词,内容由插件视图绘制,控件可绑定已声明的设置(宿主读写真实来源)、嵌入宿主自己的设置行(setting)和工具链工具行(tool),值变化后去抖发送 settings 事件让插件重画", + "capability": "插件通过 settings(当前契约版本 0)在 plugin.json 里把设置项和按钮注册到“语言与框架 › <语言>”或“构建、执行、部署 › <构建系统>”页,按 section 分组;设置可声明项目级覆盖(写入项目 .lithe/plugin-settings.json)和生效方式(重启、立即、重新加载、下次运行),“立即生效”的值经 workspace/configuration 推给正在运行的语言服务器;按钮调用插件自己的插件函数。宿主只提供通用页面和控件,不内置任何语言或构建工具的页面;语言服务状态写在“语言与框架”目录的语言行上,语言页本身不重复,只有一个插件贡献的页面也不显示插件选择器;路径选择按钮保持完整可见,窄面板由输入框和标题列缩短以容纳状态标签;settingRegions 让插件在设置页或插件详情的“设置”页签声明区域:区域带搜索关键词,内容由插件视图绘制,控件可绑定已声明的设置(宿主读写真实来源)、嵌入宿主自己的设置行(setting)和工具链工具行(tool),值变化后去抖发送 settings 事件让插件重画", "macos": { "implementationStatus": "partial", "verificationStatus": "pending", @@ -18,7 +18,8 @@ "desktop/internal/core/plugin_settings.go", "desktop/internal/settingswindow/settings_surfaces_test.go", "desktop/internal/pluginsettings/store_test.go", - "desktop/internal/pluginservice/settings_editor_test.go" + "desktop/internal/pluginservice/settings_editor_test.go", + "desktop/internal/settingswindow/languages_view_test.go" ] }, "windows": { @@ -36,11 +37,12 @@ "desktop/internal/core/plugin_settings.go", "desktop/internal/settingswindow/settings_surfaces_test.go", "desktop/internal/pluginsettings/store_test.go", - "desktop/internal/pluginservice/settings_editor_test.go" + "desktop/internal/pluginservice/settings_editor_test.go", + "desktop/internal/settingswindow/languages_view_test.go" ] }, "owner": "Plugin Platform", - "verification": "自动化:scripts/desktop/desktop-go.sh test ./internal/settingswindow/ ./internal/pluginsettings/ ./internal/pluginservice/,覆盖 Core 投影的动态插件页(Core 契约 fixture 与 rust/fixtures 的设置清单)共享草稿、按页过滤按钮、刷新干净表单、项目层存储和编辑器投影。设置区域:scripts/desktop/desktop-go.sh test -run 'Region' ./internal/settingswindow/,覆盖绑定设置的草稿类型、可编辑与只读、settings 事件携带的生效值与草稿、随页面打开关闭及切换语言重开,以及按 Core 契约 fixture view-panel 的区域关键词搜索定位页面;无头截图 LITHE_VISUAL_OUTPUT_DIR=<目录> scripts/desktop/desktop-go.sh test -tags 'vivahead lithevisual' -run TestVisualPluginRegion ./internal/settingswindow/(Core 契约 fixture view-panel,深浅主题),检查区域控件、setting 行与 tool 行。原生整机验收 pending:安装一个声明了设置页面(page/section/scope/effect/settingActions/settingRegions)的测试插件并启用,确认设置侧栏的对应分组下出现该语言或构建系统页,页内按插件和 section 分组显示设置、按钮与区域;搜索设置标题或区域关键词能定位到该页。打开项目后把 scope 为 project 的设置切到“此项目”并修改,确认项目下生成 .lithe/plugin-settings.json 且显示“已在此项目覆盖”,恢复默认后文件被删除。修改 effect 为 immediate 的设置,确认语言服务器不重启而配置生效;修改 restart 设置时出现重启提示。点击带 confirm 的按钮先弹确认,再调用插件函数并给出结果通知。在区域里修改绑定值,确认写回来源、插件重画。停用插件后页面与区域消失。Windows 使用同一 Go Viva 桌面端,需在 Windows 虚拟机上重复原生验收。", + "verification": "自动化:scripts/desktop/desktop-go.sh test ./internal/settingswindow/ ./internal/pluginsettings/ ./internal/pluginservice/,覆盖 Core 投影的动态插件页(Core 契约 fixture 与 rust/fixtures 的设置清单)共享草稿、按页过滤按钮、刷新干净表单、项目层存储和编辑器投影。设置区域:scripts/desktop/desktop-go.sh test -run 'Region' ./internal/settingswindow/,覆盖绑定设置的草稿类型、可编辑与只读、settings 事件携带的生效值与草稿、随页面打开关闭及切换语言重开,以及按 Core 契约 fixture view-panel 的区域关键词搜索定位页面;无头截图 LITHE_VISUAL_OUTPUT_DIR=<目录> scripts/desktop/desktop-go.sh test -tags 'vivahead lithevisual' -run TestVisualPluginRegion ./internal/settingswindow/(Core 契约 fixture view-panel,深浅主题),检查区域控件、setting 行与 tool 行。原生整机验收 pending:安装一个声明了设置页面(page/section/scope/effect/settingActions/settingRegions)的测试插件并启用,确认设置侧栏的对应分组下出现该语言或构建系统页,页内按插件和 section 分组显示设置、按钮与区域;搜索设置标题或区域关键词能定位到该页。打开项目后把 scope 为 project 的设置切到“此项目”并修改,确认项目下生成 .lithe/plugin-settings.json 且显示“已在此项目覆盖”,恢复默认后文件被删除。修改 effect 为 immediate 的设置,确认语言服务器不重启而配置生效;修改 restart 设置时出现重启提示。点击带 confirm 的按钮先弹确认,再调用插件函数并给出结果通知。在区域里修改绑定值,确认写回来源、插件重画。停用插件后页面与区域消失。只装一个 Go 插件时打开“语言与框架 › Go”,确认页面直接是插件设置,没有插件选择器和语言服务状态卡;再装一个也贡献 Go 页的插件,确认出现选择器并可切换。Windows 使用同一 Go Viva 桌面端,需在 Windows 虚拟机上重复原生验收。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": { @@ -70,5 +72,5 @@ "verificationStatus": "not-applicable" } }, - "notes": "Viva:settings_surfaces.go 按 core.SettingsPage(Key、Kind、Contributors、Sections)动态生成插件设置页,带确认的页面按钮在 plugin_settings_actions_view.go;pluginsettings/store.go 提供项目层存储,pluginservice/settings.go 的 ApplyLanguageSettings 把配置推给运行中的语言服务器;pluginhost 声明 settings 0(契约 2026-11-11 版本归 0)。 设置区域:settingswindow/plugin_region_view.go 用 pluginview 渲染器绘制插件区域,绑定设置走与声明设置行相同的编辑器(可编辑条件:已加载、作用域可写且设置有真实来源)。" + "notes": "Viva:settings_surfaces.go 按 core.SettingsPage(Key、Kind、Contributors、Sections)动态生成插件设置页,带确认的页面按钮在 plugin_settings_actions_view.go;pluginsettings/store.go 提供项目层存储,pluginservice/settings.go 的 ApplyLanguageSettings 把配置推给运行中的语言服务器;pluginhost 声明 settings 0(契约 2026-11-11 版本归 0)。 设置区域:settingswindow/plugin_region_view.go 用 pluginview 渲染器绘制插件区域,绑定设置走与声明设置行相同的编辑器(可编辑条件:已加载、作用域可写且设置有真实来源)。 2026-11-21:语言页不再重复“语言与框架”目录行里已有的内容:只有一个插件贡献时直接显示它的设置,不再显示插件选择器和语言服务状态卡;两个以上插件贡献同一页时仍显示选择器(与构建、执行、部署的分栏页一致)。TestLanguagePageDoesNotRepeatItsDirectoryRow 覆盖一个插件和两个插件两种情况。" }