From 8f11e6bf0714665522dd54b19c68394e073596f6 Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Tue, 24 Nov 2026 16:18:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(plugin-web):=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E5=8E=9F=E7=94=9F=E7=BD=91=E9=A1=B5=E6=B5=AE=E5=B1=82=E4=B8=8E?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E9=94=99=E8=AF=AF=E4=BC=A0=E9=80=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0-18-plugin-web-content-in-host-windows.md | 3 + ...-content-overlays-and-function-failures.md | 46 +++++++++++++ desktop/internal/pluginservice/backendhost.go | 6 ++ desktop/internal/pluginweb/page.go | 7 +- desktop/internal/pluginweb/page_test.go | 15 ++++ .../workbench/pluginsemantics_hover_test.go | 26 +++++++ .../pluginsemantics_hover_visual_test.go | 68 +++++++++++++++++++ desktop/internal/workbench/root.go | 7 +- .../features/lsp-completion-hover.json | 10 ++- .../features/plugin-web-tool-windows.json | 16 +++-- 10 files changed, 195 insertions(+), 9 deletions(-) create mode 100644 .agents/notes/implemented/bug-fix/2026-11-24-web-content-overlays-and-function-failures.md create mode 100644 desktop/internal/workbench/pluginsemantics_hover_visual_test.go diff --git a/.agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md b/.agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md index 522c723581..250d65da02 100644 --- a/.agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md +++ b/.agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md @@ -59,6 +59,7 @@ - **Core(`rust/crates/plugin-web-content/src/lib.rs`)**:`plugins.web.open` 为一个已声明的 web 窗口登记页面,返回私有源 URL 和限额;`resource` 判断一个请求路径能不能读、读包里的哪几段路径(拒绝 `..`、空段、编码分隔符和保留的 `.lithe-host/`);`document` 在 HTML 文档最前面注入 CSP meta 和桥接脚本;`request` 校验页面发来的每条消息,要么直接给出拒绝回复,要么交回一个已规范化的动作;`reply` 和 `event` 把结果、进度和主题变化封装成发给页面的消息。调用 ID 不可复用、同时最多 16 个调用、一次只开一个对话框,这些计数也都在 Core 里。 - **`desktop/internal/pluginweb`**:一个 `Page` 对应一个页面。它按 Core 给出的路径段逐级 `Lstat` 读取包文件,不跟随任何符号链接,并且限制大小;把 Core 交回的动作交给 `Host` 执行(状态读写、后端调用和进度、文件对话框、在编辑器里打开文件),再把 Core 封装好的回复投递给页面。等待、读写文件和弹对话框都在窗口线程之外进行。页面关闭时取消它的全部调用,之后的结果不再投递。 - **`desktop/internal/workbench`**:插件工具窗口加进每个窗口自己的 chrome 目录,由 Core 统一排列。停用插件期间,保存的布局仍保留它的位置,重新启用后回到原处。网页窗口用 `app.WebHost` 打开 Web 视图,并用 `NativeView` 填满窗口正文。一帧没有声明某个页面,这个页面就在 `endPaint` 里关闭。所以隐藏或移动窗口、关闭项目、停用或更新插件,都走同一条关闭路径。 +- **覆盖层与错误传递(2026-11-24)**:原生网页属于窗口的正文层。工作台自己的补全、悬停说明和导航弹层通过 `ui.Overlay` 明确放进 `LayerPaneChrome`(Viva 的面板覆盖层),由框架同时计算原生视图遮罩和点击区域;框架菜单、对话框仍使用更高层。后端函数失败经过 `pluginservice` 与 `pluginweb` 时保留原有 `code`、`message`、`pluginErrorCode`,桌面适配器只转换数据,不重新分配业务错误码。 - **状态(`pluginservice.SetPageState`)**:写到每用户插件根目录下的 `.state//pages/workspaces/<工作区键>/<窗口摘要>.json`,与插件后端的工作区状态放在一起,按窗口和工作区隔离,写入时先写临时文件再改名。它不在插件包或应用 bundle 里,所以不改变签名或增量更新的基线;`plugin-web-state` 仍然禁止跨工作树复用。 Viva 的 Web 视图目前有四处达不到契约,已记录为上游缺口,补齐前按下面的方式处理: @@ -109,6 +110,8 @@ Viva 的 Web 视图目前有四处达不到契约,已记录为上游缺口, - `./scripts/desktop/verify/verify-runtime-bundle-immutability.sh`:确认没有新增写入 bundle 的路径。 - `./scripts/agent-notes/verify-agent-notes.sh`:Note 格式与路径。 +2026-11-24 的层级修复在用户停止验证前已运行定向回归:修复前悬停弹层与正文同为 0 层,修复后层级断言通过;`TestVisualPointerHover` 生成浅色、深色和中英文的悬停与导航截图。网页错误回归 `TestPagePreservesBackendFunctionFailure` 在修复前丢失 `pluginErrorCode`,修复后保留三个结构化字段。组件结果不代替原生 WebView 遮挡验收。用户随后要求自行验收,此后的矩阵、Note 和提交收尾没有再运行验证,原生 macOS 与 Windows 状态仍为 pending。 + ## 适用范围 - `https://github.com/Lithe-IDEA/Lithe-core-rust/blob/main/shared/plugins/contract/v1/` diff --git a/.agents/notes/implemented/bug-fix/2026-11-24-web-content-overlays-and-function-failures.md b/.agents/notes/implemented/bug-fix/2026-11-24-web-content-overlays-and-function-failures.md new file mode 100644 index 0000000000..00cb8ee6f7 --- /dev/null +++ b/.agents/notes/implemented/bug-fix/2026-11-24-web-content-overlays-and-function-failures.md @@ -0,0 +1,46 @@ +# Agent 笔记:原生网页上方的浮层与后端失败传递 + +状态:已实现 + +## 先说结论 + +工作台的悬停说明、补全和导航必须显式声明在 Viva 的面板覆盖层,单靠把绘制调用放到正文之后无法盖住原生网页。后端函数失败经过网页适配器时,要保留 Core 已给出的错误码和插件业务错误码。两项修复都在宿主的通用呈现与数据转换边界,不依赖具体插件,也不新增协议。 + +## 问题 + +迁移到 Viva 的提交 `0faecba49`(#1799)在正文之后直接声明工作台浮层,但它们仍然属于正文的 0 层。原生 WebView 是系统视图,画布上同层的悬停面板可能被它遮住;菜单和对话框的声明顺序不能代替明确层级。 + +同一迁移中的网页回复只识别 `pluginweb.Failure`。后端函数返回的 `pluginservice.FunctionError` 及嵌入它的事件失败会进入兜底路径,被改写成 `plugin.web.invalidRequest`;页面失去 `pluginErrorCode`,只能显示笼统提示。 + +## 决策 + +- 在 `workbench.root` 把工作台浮层放入 `ui.Overlay` 的 `LayerPaneChrome`,即 Viva 用于正文上方控件的覆盖层。框架据此同时处理原生视图遮罩、命中区域和绘制;框架菜单、对话框仍使用自己的更高层。 +- `FunctionError` 提供结构化转换,`Page.answer` 通过接口获取原有 `code`、`message`、`pluginErrorCode`,再交给 Core 包装回复。桌面端不解释插件业务错误,不分配新码,也不另记一条相同失败日志。 +- 正确做法:新增悬停或导航内容继续使用工作台统一浮层入口;插件根据自己收到的业务错误选择本地提示。 +- 不要这样做:给某个网页单独加窗口置底代码、用 CSS 层级操作窗口外的原生视图,或根据插件 ID 在宿主转换错误。 + +## 考虑过的备选方案 + +仅调整正文与浮层声明顺序不能改变原生视图的层级。修改 Viva 原生窗口排序会重复框架已有遮罩能力,也会影响其他原生视图,因此本次只修正调用方的覆盖层声明。 + +把后端错误文本拼进通用错误消息虽然能看到一部分原因,却仍然丢失机器可读的分类;让网页或宿主按文本匹配又会依赖翻译。保留契约现有字段即可,不需要新 API。 + +## 后果 + +宿主中的网页内容遵守与其他正文相同的浮层关系,插件无需配合;页面也能继续使用后端提供的受控业务提示。代价是无头画布只能证明层级声明与错误回复,不能证明系统 WebView 的真实遮挡、指针与焦点行为,仍需要目标平台验收。 + +## 验证 + +用户要求停止验证之前,定向回归已执行:`TestPointerHoverPaintsAboveTheNativeContentLayer` 在修复前报告悬停层 0 不高于正文层 0,修复后通过;`TestPagePreservesBackendFunctionFailure` 修复前丢失插件业务码,修复后通过。`TestVisualPointerHover` 采集了浅色、深色、中英文的悬停和导航画面,但无头环境没有原生网页引擎。 + +用户随后明确要求自行验收,此后的文档、矩阵和提交收尾没有重新运行测试或检查。macOS 原生 WebView 叠层与 Windows 验收均保持 pending。后续入口为 `scripts/desktop/desktop-go.sh test -race -count=1 ./internal/pluginweb -run TestPagePreservesBackendFunctionFailure` 以及工作台同名层级回归;原生验收步骤见功能矩阵。 + +## 适用范围 + +- `desktop/internal/workbench/root.go` +- `desktop/internal/workbench/pluginsemantics_hover_test.go` +- `desktop/internal/workbench/pluginsemantics_hover_visual_test.go` +- `desktop/internal/pluginservice/backendhost.go` +- `desktop/internal/pluginweb/page.go` +- `desktop/internal/pluginweb/page_test.go` +- [插件网页界面的边界](../architecture/2026-10-18-plugin-web-content-in-host-windows.md) diff --git a/desktop/internal/pluginservice/backendhost.go b/desktop/internal/pluginservice/backendhost.go index 9056daf601..ece7d94219 100644 --- a/desktop/internal/pluginservice/backendhost.go +++ b/desktop/internal/pluginservice/backendhost.go @@ -53,6 +53,12 @@ type FunctionError struct { func (e *FunctionError) Error() string { return e.Code + ": " + e.Message } +// PluginWebError preserves the structured failure when a backend call crosses +// the desktop page adapter. Embedded event failures inherit this conversion. +func (e *FunctionError) PluginWebError() core.PluginWebError { + return core.PluginWebError{Code: e.Code, Message: e.Message, PluginErrorCode: e.PluginCode} +} + // BackendHost keeps at most one backend process per plugin and starts it on // demand: when a workspace opens for a plugin that asks for it, when its // language server needs a launch answer, or when another plugin calls it. diff --git a/desktop/internal/pluginweb/page.go b/desktop/internal/pluginweb/page.go index d896458e32..af8e959920 100644 --- a/desktop/internal/pluginweb/page.go +++ b/desktop/internal/pluginweb/page.go @@ -220,7 +220,12 @@ func (p *Page) answer(action core.PluginWebAction, call string, result any, fail reply := core.PluginWebReply{Page: p.info.Page, ID: action.ID, Method: action.Method, Call: call} if failure != nil { var coded *Failure - if !errors.As(failure, &coded) { + var backend interface{ PluginWebError() core.PluginWebError } + switch { + case errors.As(failure, &coded): + case errors.As(failure, &backend): + coded = &Failure{backend.PluginWebError()} + default: coded = Fail("plugin.web.invalidRequest", failure.Error()) } reply.Error = &coded.PluginWebError diff --git a/desktop/internal/pluginweb/page_test.go b/desktop/internal/pluginweb/page_test.go index f4eb632811..d48d04f4da 100644 --- a/desktop/internal/pluginweb/page_test.go +++ b/desktop/internal/pluginweb/page_test.go @@ -12,6 +12,7 @@ import ( "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/1lck/Lithe-IDEA/desktop/internal/pluginservice" ) // waitLimit bounds every wait for an answer the page is posted. @@ -72,10 +73,24 @@ func (h *fakeHost) CallBackend(ctx context.Context, _, function string, params j close(h.started) <-ctx.Done() return nil, ctx.Err() + case "failure": + return nil, &pluginservice.FunctionError{Code: "plugin.function.failed", Message: "Choose a resource first.", PluginCode: "fixture.resourceRequired"} } return nil, Fail("plugin.function.unknown", "no such function") } +func TestPagePreservesBackendFunctionFailure(t *testing.T) { + f := openFixture(t) + reply := f.request(t, 1, "functions.invoke", map[string]any{"function": "failure"}) + var failure core.PluginWebError + if err := json.Unmarshal(reply["error"], &failure); err != nil { + t.Fatal(err) + } + if failure.Code != "plugin.function.failed" || failure.Message != "Choose a resource first." || failure.PluginErrorCode != "fixture.resourceRequired" { + t.Fatalf("backend failure lost its structured fields: %+v", failure) + } +} + func (h *fakeHost) ChooseFile(string, FileRequest) (string, error) { h.mu.Lock() defer h.mu.Unlock() diff --git a/desktop/internal/workbench/pluginsemantics_hover_test.go b/desktop/internal/workbench/pluginsemantics_hover_test.go index b93c0113e3..afb87aacde 100644 --- a/desktop/internal/workbench/pluginsemantics_hover_test.go +++ b/desktop/internal/workbench/pluginsemantics_hover_test.go @@ -100,6 +100,32 @@ func TestPointerHoverRendersMarkdownRightUnderTheRow(t *testing.T) { } } +// Native views cover the page's own layer. Editor popups must therefore use +// an overlay band as well as being declared after the workbench. +func TestPointerHoverPaintsAboveTheNativeContentLayer(t *testing.T) { + f := newSemanticFixture(t) + f.h.app.semantics.hoverDelay = -1 + f.openPointerHover(t, hoverResult(t, "Hover over native content")) + var editorLayer uint16 + foundEditor, foundHover := false, false + for _, hit := range f.h.driver.Snapshot().Hits { + if hit.ID == f.d.hit { + editorLayer, foundEditor = hit.Layer, true + } + } + for _, hit := range f.h.driver.Snapshot().Hits { + if hit.Role == gfx.RoleMenu && hit.Bounds == f.h.app.semantics.hover.rect { + foundHover = true + if hit.Layer <= editorLayer { + t.Fatalf("hover layer %d does not stand above native content on editor layer %d", hit.Layer, editorLayer) + } + } + } + if !foundEditor || !foundHover { + t.Fatalf("editor present: %v, hover present: %v", foundEditor, foundHover) + } +} + func TestPointerHoverStaysOnItsSymbolAndPopup(t *testing.T) { f := newSemanticFixture(t) f.h.app.semantics.hoverDelay = -1 diff --git a/desktop/internal/workbench/pluginsemantics_hover_visual_test.go b/desktop/internal/workbench/pluginsemantics_hover_visual_test.go new file mode 100644 index 0000000000..6fd56f2163 --- /dev/null +++ b/desktop/internal/workbench/pluginsemantics_hover_visual_test.go @@ -0,0 +1,68 @@ +//go:build vivahead && lithevisual + +package workbench + +import ( + "os" + "path/filepath" + "testing" + + "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/1lck/Lithe-IDEA/desktop/internal/store" + "github.com/vivaui/viva/app" + "github.com/vivaui/viva/gfx" + "github.com/vivaui/viva/headless" +) + +// TestVisualPointerHover captures the workbench's real hover and navigation +// surfaces. Headless rendering has no native web engine; native occlusion needs +// platform acceptance, while the behavioral test checks the hover's layer. +func TestVisualPointerHover(t *testing.T) { + out := os.Getenv("LITHE_VISUAL_OUTPUT_DIR") + if out == "" { + t.Skip("set LITHE_VISUAL_OUTPUT_DIR") + } + if err := os.MkdirAll(out, 0o755); err != nil { + t.Fatal(err) + } + for _, theme := range []string{"light", "dark"} { + for _, language := range []string{"zh-Hans", "en-US"} { + t.Run(theme+"-"+language, func(t *testing.T) { + prefs := store.At(t.TempDir()) + if err := prefs.Save(settingsFile, map[string]string{"theme": theme}); err != nil { + t.Fatal(err) + } + kernel := &semanticTestKernel{testKernel: &testKernel{Client: core.NewClient()}} + var session *headless.Session + h := newHarnessWithDriver(t, Options{Kernel: kernel, Store: prefs, Languages: []string{language}}, func(config app.Config) (*app.Driver, func(), error) { + config.Width, config.Height = 1000, 640 + var err error + session, err = headless.Open(config, nil, headless.Options{}) + if err != nil { + return nil, nil, err + } + return session.Driver(), session.Close, nil + }) + f := openSemanticFixture(t, h, kernel) + h.app.semantics.hoverDelay = -1 + f.openPointerHover(t, markdownHoverResult(t, "```java\nint one()\n```\n\n---\n\nReturns **one**.\n\n[Documentation](https://example.invalid/one)", nil)) + capture := func(scene string) { + t.Helper() + if err := session.Screenshot(filepath.Join(out, scene+"-"+theme+"-"+language+".png")); err != nil { + t.Fatal(err) + } + } + capture("pointer-hover") + h.key(gfx.KeyEscape) + h.app.navigation.delay = -1 + h.click(center(h.button(itemCaret))) + awaitDocumentState(t, h, func() bool { return h.app.navigation.target != nil && h.driver.Snapshot().Focused == navigationField }) + capture("navigation-overlay") + h.key(gfx.KeyEscape) + if h.app.navigation.open { + t.Fatal("Escape did not dismiss navigation") + } + }) + } + } +} diff --git a/desktop/internal/workbench/root.go b/desktop/internal/workbench/root.go index f0203733e7..1fadb368ab 100644 --- a/desktop/internal/workbench/root.go +++ b/desktop/internal/workbench/root.go @@ -151,7 +151,12 @@ func (a *App) page(c ui.C) { } a.windowShortcuts(c) a.noteEditorFocus(c.Canvas().Focused()) - a.overlays(c) + // Declaration order alone cannot put app popups over native web views, + // which own the content layer. Viva also uses this band for native masks + // and pointer routing; its menus and dialogs stay above it. + ui.Overlay(c.Part("workbench-overlays"), ui.OverlaySpec{Band: ui.LayerPaneChrome, Bounds: c.Bounds()}).Children(func() { + a.overlays(c) + }) a.overlay.trappedFocus = !c.Canvas().TrappedFocusScope().IsZero() ui.Toasts(c, &a.overlay.toaster) a.notificationActed(c) diff --git a/shared/platform-feature-matrix/features/lsp-completion-hover.json b/shared/platform-feature-matrix/features/lsp-completion-hover.json index d0a6548577..50ab0e7fd2 100644 --- a/shared/platform-feature-matrix/features/lsp-completion-hover.json +++ b/shared/platform-feature-matrix/features/lsp-completion-hover.json @@ -16,7 +16,9 @@ "desktop/internal/settingswindow/editor_essentials_test.go", "desktop/internal/workbench/pluginsemantics_e2e_test.go", "desktop/internal/editorview/semantics.go", - "desktop/internal/core/plugin_semantics.go" + "desktop/internal/core/plugin_semantics.go", + "desktop/internal/workbench/root.go", + "desktop/internal/workbench/pluginsemantics_hover_visual_test.go" ] }, "windows": { @@ -32,11 +34,13 @@ "desktop/internal/settingswindow/editor_essentials_test.go", "desktop/internal/workbench/pluginsemantics_e2e_test.go", "desktop/internal/editorview/semantics.go", - "desktop/internal/core/plugin_semantics.go" + "desktop/internal/core/plugin_semantics.go", + "desktop/internal/workbench/root.go", + "desktop/internal/workbench/pluginsemantics_hover_visual_test.go" ] }, "owner": "Language Tooling", - "verification": "Viva(2026-11-22):在外观与行为 → 编辑器关闭自动补全,输入标识符或触发字符时不弹出语言服务器或插件补全,Ctrl+Space 仍可手动触发。验证关闭后旧的自动结果不会弹出、重新开启可自动弹出、重启保留设置,以及恢复默认值重新开启。 使用合成语言服务返回名称相近、签名较长的候选。在常规及窄窗口检查完整名称,窄窗口中用方向键切换并阅读换行的完整签名,按回车确认插入所选候选。验证候选恰好填满行宽时仍可读到完整签名,滚动超长详情可读到末尾,候选和详情较高时弹窗避开输入行。 Viva(2026-11-16,#1995):指针停留触发 Hover 的等待从 500 ms 缩短到 300 ms,与 Zed、VS Code 的默认值一致;F1、离开即取消和同一字符内不重复请求的行为不变。在 macOS 打包应用里接真实语言服务器实测,指针落到字符上到弹窗出现的中位数为 360 ms(改动前 562 ms,各 5 次,扣除等待后都约 60 ms)。Windows 共用同一份 Viva 代码,原生窗口验收待做。 Core 6a14126(2026-11-16,Lithe-core-rust #61,#1995):LSP 引擎为每个语言服务器会话保留悬浮答案;同一文档版本的同一位置,或答案 range 在同一行内覆盖的位置,再次悬浮时直接返回保留的答案,不再发给服务器。每个会话最多 32 个答案(最久没用的先丢),单个答案超过 64 KiB 不保留,空答案、错误和缓存清空之后才到达的答案不保留;文档打开、修改、保存、关闭,工作区文件变化,配置或索引排除项变化,executeCommand,插件后端的 languageServer/request 与 languageServer/notify,宿主通知写给插件后端,服务器发来的任何请求或 $/progress end,以及会话停止、崩溃或重启时清空。Core 的单元测试和脚本化服务器会话测试覆盖命中、范围、淘汰和清空,两端共用同一个 Core;原生窗口验收待做。 Viva(2026-11-16,#1995):指针离开文本后忘掉停留过的字符:按 Esc、移出窗口、移到标签栏等其他控件、滚动编辑器后回到同一字符,会重新请求并显示 Hover;离开时还在 500 ms 等待中的 Hover 不再发出请求;没有 Hover 的字符内移动仍不重复请求。无头测试覆盖四种离开方式,原生窗口验收待做。 Viva(2026-11-14):Hover 弹窗按 Markdown 渲染(签名代码块、分隔线、正文、示例、链接),代码块用编辑器同一套语法着色,http/https/mailto 链接点击后用系统浏览器打开;宽度在 280–620 之间按内容收窄,超过 420 高度时可滚动。弹窗贴在指针所在行的下沿、左缘对齐指针;指针停在同一符号范围内不重新请求,移入弹窗时保持打开,离开符号和弹窗 400 ms 后才关闭,期间回到符号或弹窗会取消关闭。无头测试覆盖渲染、位置、保持、延迟关闭和代码着色,原生窗口验收待做。 Viva(2026-11-10):输入单个标识符字符或 . : > 后防抖(120 ms)自动请求补全,继续输入、移动光标或编辑会取消并丢弃过期结果;服务器声明的 triggerCharacters 尚未由 Core 暴露,暂用固定成员访问字符集。 Viva(2026-11-09):Hover 支持 F1 与 500 ms 指针停留,补全由 Control+Space 显式触发,上下键选择、回车/Tab 通过 Core 的 lsp.applyTextEdits 与 lsp.plainSnippet 接受;无头 Viva 窗口使用真实 clangd 隔离插件验证了 Hover 内容、补全列表和接受后的文本与光标位置。连续输入自动重新请求、isIncomplete 刷新、触发字符和多来源合并尚未接入,因此保持部分实现。 用测试内联的合成语言服务器插件验证补全、Hover、排序、超时和空结果。验证 initialize、didChangeConfiguration 与 workspace/configuration 三个配置入口一致,父级和叶级 section 均保留插件声明的其他配置。 连续输入时保留 isIncomplete 并通过 LSP triggerKind=3 重新请求候选;验证空未完整列表、完整/空响应、触发字符、快速修改及文档关闭/会话替换后的过期结果。 #1662 LSP-09:多个补全来源的合并由 Core 的 lsp.mergeCompletions 决定:同一来源的候选全部保留(同名不同签名的重载不再被丢弃),低优先级来源中与高优先级来源同 label 的候选被遮蔽。Windows 只有一个补全来源,原样显示服务器列表,不调用该命令。macOS 删除私有的 Go/Swift/Rust/Python/JS/TS 关键词表,关键词改由语言服务器或插件提供,与 Windows 一致。在 macOS 打开有重载方法的文件,确认同名重载全部出现;未运行语言服务器的 Go 文件不再出现内置关键词候选,当前文件标识符仍会出现。", + "verification": "Viva(2026-11-22):在外观与行为 → 编辑器关闭自动补全,输入标识符或触发字符时不弹出语言服务器或插件补全,Ctrl+Space 仍可手动触发。验证关闭后旧的自动结果不会弹出、重新开启可自动弹出、重启保留设置,以及恢复默认值重新开启。 使用合成语言服务返回名称相近、签名较长的候选。在常规及窄窗口检查完整名称,窄窗口中用方向键切换并阅读换行的完整签名,按回车确认插入所选候选。验证候选恰好填满行宽时仍可读到完整签名,滚动超长详情可读到末尾,候选和详情较高时弹窗避开输入行。 Viva(2026-11-16,#1995):指针停留触发 Hover 的等待从 500 ms 缩短到 300 ms,与 Zed、VS Code 的默认值一致;F1、离开即取消和同一字符内不重复请求的行为不变。在 macOS 打包应用里接真实语言服务器实测,指针落到字符上到弹窗出现的中位数为 360 ms(改动前 562 ms,各 5 次,扣除等待后都约 60 ms)。Windows 共用同一份 Viva 代码,原生窗口验收待做。 Core 6a14126(2026-11-16,Lithe-core-rust #61,#1995):LSP 引擎为每个语言服务器会话保留悬浮答案;同一文档版本的同一位置,或答案 range 在同一行内覆盖的位置,再次悬浮时直接返回保留的答案,不再发给服务器。每个会话最多 32 个答案(最久没用的先丢),单个答案超过 64 KiB 不保留,空答案、错误和缓存清空之后才到达的答案不保留;文档打开、修改、保存、关闭,工作区文件变化,配置或索引排除项变化,executeCommand,插件后端的 languageServer/request 与 languageServer/notify,宿主通知写给插件后端,服务器发来的任何请求或 $/progress end,以及会话停止、崩溃或重启时清空。Core 的单元测试和脚本化服务器会话测试覆盖命中、范围、淘汰和清空,两端共用同一个 Core;原生窗口验收待做。 Viva(2026-11-16,#1995):指针离开文本后忘掉停留过的字符:按 Esc、移出窗口、移到标签栏等其他控件、滚动编辑器后回到同一字符,会重新请求并显示 Hover;离开时还在 500 ms 等待中的 Hover 不再发出请求;没有 Hover 的字符内移动仍不重复请求。无头测试覆盖四种离开方式,原生窗口验收待做。 Viva(2026-11-14):Hover 弹窗按 Markdown 渲染(签名代码块、分隔线、正文、示例、链接),代码块用编辑器同一套语法着色,http/https/mailto 链接点击后用系统浏览器打开;宽度在 280–620 之间按内容收窄,超过 420 高度时可滚动。弹窗贴在指针所在行的下沿、左缘对齐指针;指针停在同一符号范围内不重新请求,移入弹窗时保持打开,离开符号和弹窗 400 ms 后才关闭,期间回到符号或弹窗会取消关闭。无头测试覆盖渲染、位置、保持、延迟关闭和代码着色,原生窗口验收待做。 Viva(2026-11-10):输入单个标识符字符或 . : > 后防抖(120 ms)自动请求补全,继续输入、移动光标或编辑会取消并丢弃过期结果;服务器声明的 triggerCharacters 尚未由 Core 暴露,暂用固定成员访问字符集。 Viva(2026-11-09):Hover 支持 F1 与 500 ms 指针停留,补全由 Control+Space 显式触发,上下键选择、回车/Tab 通过 Core 的 lsp.applyTextEdits 与 lsp.plainSnippet 接受;无头 Viva 窗口使用真实 clangd 隔离插件验证了 Hover 内容、补全列表和接受后的文本与光标位置。连续输入自动重新请求、isIncomplete 刷新、触发字符和多来源合并尚未接入,因此保持部分实现。 用测试内联的合成语言服务器插件验证补全、Hover、排序、超时和空结果。验证 initialize、didChangeConfiguration 与 workspace/configuration 三个配置入口一致,父级和叶级 section 均保留插件声明的其他配置。 连续输入时保留 isIncomplete 并通过 LSP triggerKind=3 重新请求候选;验证空未完整列表、完整/空响应、触发字符、快速修改及文档关闭/会话替换后的过期结果。 #1662 LSP-09:多个补全来源的合并由 Core 的 lsp.mergeCompletions 决定:同一来源的候选全部保留(同名不同签名的重载不再被丢弃),低优先级来源中与高优先级来源同 label 的候选被遮蔽。Windows 只有一个补全来源,原样显示服务器列表,不调用该命令。macOS 删除私有的 Go/Swift/Rust/Python/JS/TS 关键词表,关键词改由语言服务器或插件提供,与 Windows 一致。在 macOS 打开有重载方法的文件,确认同名重载全部出现;未运行语言服务器的 Go 文件不再出现内置关键词候选,当前文件标识符仍会出现。 Viva(2026-11-24):工作台自绘浮层置于 Viva LayerPaneChrome,避免正文原生视图遮住悬停、补全和导航。层级回归在修复前为 0 层等于正文、修复后通过;无头截图覆盖中英文、深浅色的悬停与导航。原生网页区域上的遮挡、点击及关闭恢复仍待用户验收;用户免验证后的收尾未重跑测试。", "notes": "Viva 已接入显式补全与接受(含 Core 的 snippet 转换)以及 Hover(F1 与指针停留);isIncomplete 连续请求、触发字符和多来源合并尚未接入。无头 clangd 测试不是原生窗口验收,平台验证保持 pending。 自动触发已接入,触发字符集暂为固定值,待 Core 暴露服务器声明。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", diff --git a/shared/platform-feature-matrix/features/plugin-web-tool-windows.json b/shared/platform-feature-matrix/features/plugin-web-tool-windows.json index 3acf79fff0..3171c293e8 100644 --- a/shared/platform-feature-matrix/features/plugin-web-tool-windows.json +++ b/shared/platform-feature-matrix/features/plugin-web-tool-windows.json @@ -17,7 +17,11 @@ "desktop/internal/workbench/plugintools.go", "desktop/internal/workbench/plugintools_test.go", "desktop/internal/pluginhost/pluginhost.go", - ".agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md" + ".agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md", + "desktop/internal/pluginservice/backendhost.go", + "desktop/internal/workbench/root.go", + "desktop/internal/workbench/pluginsemantics_hover_test.go", + "desktop/internal/workbench/pluginsemantics_hover_visual_test.go" ] }, "windows": { @@ -34,11 +38,15 @@ "desktop/internal/workbench/plugintools.go", "desktop/internal/workbench/plugintools_test.go", "desktop/internal/pluginhost/pluginhost.go", - ".agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md" + ".agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md", + "desktop/internal/pluginservice/backendhost.go", + "desktop/internal/workbench/root.go", + "desktop/internal/workbench/pluginsemantics_hover_test.go", + "desktop/internal/workbench/pluginsemantics_hover_visual_test.go" ] }, "owner": "Plugin Platform", - "verification": "自动回归(Viva):scripts/desktop/desktop-go.sh test -race -count=1 ./internal/pluginweb ./internal/pluginservice -run 'TestPage',以及 ./internal/workbench -run TestPluginToolWindows:用共享 web-panel 夹具和真实 Core 验证入口文档注入 CSP 与桥接脚本、包内符号链接/目录链接/../ 与保留的 .lithe-host/ 路径被拒绝、文件大小上限、ui.getState/setState 按窗口与工作区隔离存储在插件状态目录、functions.list/invoke 的结果与只属于本调用的进度、页面取消与关闭页面都取消调用且不再投递、调用 ID 不可复用、对话框一次一个且取消返回 null、workspace.openFile 拒绝工作区外路径、build.* 在未提供构建系统时为 plugin.web.unknownMethod、离开插件源的导航被送回入口、主题变化发送 ui.themeChanged;工作台里文本窗口显示原文,网页窗口在 Web 引擎就绪前显示“正在打开…”、打不开时说明原因,隐藏窗口即关闭页面;停用插件后窗口离开工具栏,期间保存的布局仍保留其位置,重新启用回到原处。产品界面验收仍 pending:macOS 与 Windows 开发版(make -C desktop run)用“从磁盘安装插件”安装 web-panel 夹具(plugin.json 旁放 ui/index.html),打开右侧 Web Panel,确认页面显示、根元素带 data-theme 与 --lithe-* 变量、切换浅色/深色后收到 ui.themeChanged;页面内联脚本与 fetch 外网被 CSP 拦截;lithe.request('ui.setState', {state:{a:1}}) 后隐藏再显示窗口,ui.getState 仍返回该值;dialog.openFile 的标题写明插件名;之后运行 scripts/desktop/verify/verify-runtime-bundle-immutability.sh 确认包与应用 bundle 不变。", + "verification": "自动回归(Viva):scripts/desktop/desktop-go.sh test -race -count=1 ./internal/pluginweb ./internal/pluginservice -run 'TestPage',以及 ./internal/workbench -run TestPluginToolWindows:用共享 web-panel 夹具和真实 Core 验证入口文档注入 CSP 与桥接脚本、包内符号链接/目录链接/../ 与保留的 .lithe-host/ 路径被拒绝、文件大小上限、ui.getState/setState 按窗口与工作区隔离存储在插件状态目录、functions.list/invoke 的结果与只属于本调用的进度、页面取消与关闭页面都取消调用且不再投递、调用 ID 不可复用、对话框一次一个且取消返回 null、workspace.openFile 拒绝工作区外路径、build.* 在未提供构建系统时为 plugin.web.unknownMethod、离开插件源的导航被送回入口、主题变化发送 ui.themeChanged;工作台里文本窗口显示原文,网页窗口在 Web 引擎就绪前显示“正在打开…”、打不开时说明原因,隐藏窗口即关闭页面;停用插件后窗口离开工具栏,期间保存的布局仍保留其位置,重新启用回到原处。产品界面验收仍 pending:macOS 与 Windows 开发版(make -C desktop run)用“从磁盘安装插件”安装 web-panel 夹具(plugin.json 旁放 ui/index.html),打开右侧 Web Panel,确认页面显示、根元素带 data-theme 与 --lithe-* 变量、切换浅色/深色后收到 ui.themeChanged;页面内联脚本与 fetch 外网被 CSP 拦截;lithe.request('ui.setState', {state:{a:1}}) 后隐藏再显示窗口,ui.getState 仍返回该值;dialog.openFile 的标题写明插件名;之后运行 scripts/desktop/verify/verify-runtime-bundle-immutability.sh 确认包与应用 bundle 不变。 2026-11-24 修复补充:TestPagePreservesBackendFunctionFailure 覆盖后端函数的 code、message、pluginErrorCode 原样进入网页回复;TestPointerHoverPaintsAboveTheNativeContentLayer 覆盖工作台浮层高于正文,TestVisualPointerHover 记录深浅色、中英文的悬停和导航表面。原生验收仍 pending:用契约 web-panel 夹具打开网页,在跨越网页区域的位置显示悬停、补全、导航、菜单和对话框,确认遮挡、点击与关闭恢复正确。用户要求自行验收,最终收尾未重新运行检查。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": { @@ -92,5 +100,5 @@ "verificationStatus": "pending" } }, - "notes": "Viva 客户端 2026-11-11 接入:页面规则(资源、文档注入、桥接请求校验、回复与事件封装)在 Rust Core plugins.web.*,桌面端只做 Web 视图、包文件读取、状态存储、对话框与调用。尚缺:build.* 方法(本宿主不向页面提供构建系统)、摄像头/麦克风授权、插件声明的窗口图标(暂用通用工具窗口图标);Viva 的 Web 视图无法设置响应头(CSP 以 meta 注入)、无法在导航前拦截(提交后送回入口)、数据存储是持久的,均待上游补齐。" + "notes": "Viva 客户端 2026-11-11 接入:页面规则(资源、文档注入、桥接请求校验、回复与事件封装)在 Rust Core plugins.web.*,桌面端只做 Web 视图、包文件读取、状态存储、对话框与调用。尚缺:build.* 方法(本宿主不向页面提供构建系统)、摄像头/麦克风授权、插件声明的窗口图标(暂用通用工具窗口图标);Viva 的 Web 视图无法设置响应头(CSP 以 meta 注入)、无法在导航前拦截(提交后送回入口)、数据存储是持久的,均待上游补齐。 2026-11-24:工作台弹层明确使用 Viva LayerPaneChrome,由框架处理原生网页遮罩与点击;桥接保留后端结构化失败,不把业务错误改为 plugin.web.invalidRequest。两端共用代码,原生验证状态保持 pending。" } From 240eed4a0274e9821a044bd17c7cc18081a0f570 Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Tue, 24 Nov 2026 16:39:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(plugin-ui):=20=E6=8E=A5=E5=85=A5?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=AA=97=E5=8F=A3=E5=A3=B0=E6=98=8E=E7=9A=84?= =?UTF-8?q?=E5=8C=85=E5=86=85=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0-18-plugin-web-content-in-host-windows.md | 4 +- ...-content-overlays-and-function-failures.md | 18 +++++++-- .../pluginservice/installed_snapshot_test.go | 16 ++++++++ desktop/internal/pluginservice/toolwindows.go | 13 ++++-- desktop/internal/workbench/chrome_view.go | 8 ++-- desktop/internal/workbench/drag.go | 6 +-- desktop/internal/workbench/plugins.go | 11 +++++ desktop/internal/workbench/plugintools.go | 16 +++++++- .../internal/workbench/plugintools_test.go | 40 +++++++++++++++++++ .../features/plugin-web-tool-windows.json | 16 ++++++-- .../features/workbench-tool-stripe-icons.json | 18 +++++++-- 11 files changed, 142 insertions(+), 24 deletions(-) diff --git a/.agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md b/.agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md index 250d65da02..ad96ecd8f4 100644 --- a/.agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md +++ b/.agents/notes/implemented/architecture/2026-10-18-plugin-web-content-in-host-windows.md @@ -69,7 +69,7 @@ Viva 的 Web 视图目前有四处达不到契约,已记录为上游缺口, - 数据存储是持久的,与契约“网页存储不持久”不符;状态仍然只走桥接。 - 包资源回调在窗口线程上同步执行,所以读包文件要有大小上限,Core 判断要设本地期限。 -另外,本宿主不向页面提供构建系统(`build.*` 返回 `plugin.web.unknownMethod`),也还不支持摄像头、麦克风和插件声明的窗口图标(暂用通用工具窗口图标)。 +另外,本宿主不向页面提供构建系统(`build.*` 返回 `plugin.web.unknownMethod`),也还不支持摄像头和麦克风。2026-11-24 起工具窗口读取声明的包内 SVG 图标:后台重载时复用 `pluginicons` 的只读加载和内存缓存,工具栏、隐藏入口列表和拖动预览在绘制时选择主题变体。缺失、被拒绝或当前绘制器不支持的资源记录一次降级,继续显示通用图标;PNG 仍不在当前矢量图标绘制器的支持范围内。 ### 启动进程前的确认 @@ -110,7 +110,7 @@ Viva 的 Web 视图目前有四处达不到契约,已记录为上游缺口, - `./scripts/desktop/verify/verify-runtime-bundle-immutability.sh`:确认没有新增写入 bundle 的路径。 - `./scripts/agent-notes/verify-agent-notes.sh`:Note 格式与路径。 -2026-11-24 的层级修复在用户停止验证前已运行定向回归:修复前悬停弹层与正文同为 0 层,修复后层级断言通过;`TestVisualPointerHover` 生成浅色、深色和中英文的悬停与导航截图。网页错误回归 `TestPagePreservesBackendFunctionFailure` 在修复前丢失 `pluginErrorCode`,修复后保留三个结构化字段。组件结果不代替原生 WebView 遮挡验收。用户随后要求自行验收,此后的矩阵、Note 和提交收尾没有再运行验证,原生 macOS 与 Windows 状态仍为 pending。 +2026-11-24 的层级修复在用户停止验证前已运行定向回归:修复前悬停弹层与正文同为 0 层,修复后层级断言通过;`TestVisualPointerHover` 生成浅色、深色和中英文的悬停与导航截图。网页错误回归 `TestPagePreservesBackendFunctionFailure` 在修复前丢失 `pluginErrorCode`,修复后保留三个结构化字段。组件结果不代替原生 WebView 遮挡验收。用户随后要求自行验收,此后的图标接线、矩阵、Note 和提交收尾没有再运行验证,原生 macOS 与 Windows 状态仍为 pending。图标用例 `TestInstalledToolWindowKeepsPackageIconDeclaration` 与 `TestPluginToolWindowUsesPackageIconAcrossThemes` 已编写,尚未执行。 ## 适用范围 diff --git a/.agents/notes/implemented/bug-fix/2026-11-24-web-content-overlays-and-function-failures.md b/.agents/notes/implemented/bug-fix/2026-11-24-web-content-overlays-and-function-failures.md index 00cb8ee6f7..b631a47306 100644 --- a/.agents/notes/implemented/bug-fix/2026-11-24-web-content-overlays-and-function-failures.md +++ b/.agents/notes/implemented/bug-fix/2026-11-24-web-content-overlays-and-function-failures.md @@ -1,10 +1,10 @@ -# Agent 笔记:原生网页上方的浮层与后端失败传递 +# Agent 笔记:插件网页浮层、失败传递与窗口图标 状态:已实现 ## 先说结论 -工作台的悬停说明、补全和导航必须显式声明在 Viva 的面板覆盖层,单靠把绘制调用放到正文之后无法盖住原生网页。后端函数失败经过网页适配器时,要保留 Core 已给出的错误码和插件业务错误码。两项修复都在宿主的通用呈现与数据转换边界,不依赖具体插件,也不新增协议。 +工作台的悬停说明、补全和导航必须显式声明在 Viva 的面板覆盖层,单靠把绘制调用放到正文之后无法盖住原生网页。后端函数失败经过网页适配器时,要保留 Core 已给出的错误码和插件业务错误码。工具窗口还必须读取已声明的包内图标,不能只识别内置图标名。这些修复都在宿主的通用呈现与数据转换边界,不依赖具体插件,也不新增协议。 ## 问题 @@ -12,10 +12,13 @@ 同一迁移中的网页回复只识别 `pluginweb.Failure`。后端函数返回的 `pluginservice.FunctionError` 及嵌入它的事件失败会进入兜底路径,被改写成 `plugin.web.invalidRequest`;页面失去 `pluginErrorCode`,只能显示笼统提示。 +同一提交的工具窗口声明只解码 `icon.host`,包内图标路径被丢弃,因此合法的自定义图标仍显示通用工具窗口图标。宿主已有 `pluginicons` 负责包内 SVG 的只读加载,无需再做一份解码器。 + ## 决策 - 在 `workbench.root` 把工作台浮层放入 `ui.Overlay` 的 `LayerPaneChrome`,即 Viva 用于正文上方控件的覆盖层。框架据此同时处理原生视图遮罩、命中区域和绘制;框架菜单、对话框仍使用自己的更高层。 - `FunctionError` 提供结构化转换,`Page.answer` 通过接口获取原有 `code`、`message`、`pluginErrorCode`,再交给 Core 包装回复。桌面端不解释插件业务错误,不分配新码,也不另记一条相同失败日志。 +- 工具窗口保留包内图标声明,在插件重载的后台工作中读入共享图标缓存。工具栏、隐藏入口列表和拖动预览按当前主题读取缓存,模板图标沿用控件着色,原色图标保留填充色。资源缺失或不受支持时复用现有 `plugin_icon` 降级日志,每个资源只记一次;不在绘制时读文件,不写磁盘缓存。 - 正确做法:新增悬停或导航内容继续使用工作台统一浮层入口;插件根据自己收到的业务错误选择本地提示。 - 不要这样做:给某个网页单独加窗口置底代码、用 CSS 层级操作窗口外的原生视图,或根据插件 ID 在宿主转换错误。 @@ -25,6 +28,8 @@ 把后端错误文本拼进通用错误消息虽然能看到一部分原因,却仍然丢失机器可读的分类;让网页或宿主按文本匹配又会依赖翻译。保留契约现有字段即可,不需要新 API。 +把某个品牌图标写入宿主会让插件失去独立维护能力;另建 SVG 绘制器又会重复现有包路径与资源预算保护。因此只接线既有声明和图标适配器,不扩大格式支持。 + ## 后果 宿主中的网页内容遵守与其他正文相同的浮层关系,插件无需配合;页面也能继续使用后端提供的受控业务提示。代价是无头画布只能证明层级声明与错误回复,不能证明系统 WebView 的真实遮挡、指针与焦点行为,仍需要目标平台验收。 @@ -33,7 +38,7 @@ 用户要求停止验证之前,定向回归已执行:`TestPointerHoverPaintsAboveTheNativeContentLayer` 在修复前报告悬停层 0 不高于正文层 0,修复后通过;`TestPagePreservesBackendFunctionFailure` 修复前丢失插件业务码,修复后通过。`TestVisualPointerHover` 采集了浅色、深色、中英文的悬停和导航画面,但无头环境没有原生网页引擎。 -用户随后明确要求自行验收,此后的文档、矩阵和提交收尾没有重新运行测试或检查。macOS 原生 WebView 叠层与 Windows 验收均保持 pending。后续入口为 `scripts/desktop/desktop-go.sh test -race -count=1 ./internal/pluginweb -run TestPagePreservesBackendFunctionFailure` 以及工作台同名层级回归;原生验收步骤见功能矩阵。 +用户随后明确要求自行验收,此后的图标接线、文档、矩阵和提交收尾没有重新运行测试或检查。图标声明保留与明暗主题、模板着色用例已编写,尚未执行。macOS 原生 WebView 叠层与 Windows 验收均保持 pending。后续入口为 `scripts/desktop/desktop-go.sh test -race -count=1 ./internal/pluginweb -run TestPagePreservesBackendFunctionFailure`、工作台同名层级回归,以及 `./internal/pluginservice -run TestInstalledToolWindowKeepsPackageIconDeclaration`、`./internal/workbench -run TestPluginToolWindowUsesPackageIconAcrossThemes`;原生验收步骤见功能矩阵。 ## 适用范围 @@ -41,6 +46,13 @@ - `desktop/internal/workbench/pluginsemantics_hover_test.go` - `desktop/internal/workbench/pluginsemantics_hover_visual_test.go` - `desktop/internal/pluginservice/backendhost.go` +- `desktop/internal/pluginservice/toolwindows.go` +- `desktop/internal/pluginservice/installed_snapshot_test.go` - `desktop/internal/pluginweb/page.go` - `desktop/internal/pluginweb/page_test.go` +- `desktop/internal/workbench/plugintools.go` +- `desktop/internal/workbench/plugintools_test.go` +- `desktop/internal/workbench/plugins.go` +- `desktop/internal/workbench/chrome_view.go` +- `desktop/internal/workbench/drag.go` - [插件网页界面的边界](../architecture/2026-10-18-plugin-web-content-in-host-windows.md) diff --git a/desktop/internal/pluginservice/installed_snapshot_test.go b/desktop/internal/pluginservice/installed_snapshot_test.go index 5e274db379..dac954eb43 100644 --- a/desktop/internal/pluginservice/installed_snapshot_test.go +++ b/desktop/internal/pluginservice/installed_snapshot_test.go @@ -10,6 +10,7 @@ import ( "testing" "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/1lck/Lithe-IDEA/desktop/internal/pluginicons" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginmanager" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginpkg" ) @@ -57,6 +58,21 @@ const snapshotManifest = `{ "outputLinkMatchers":[{"id":"snapshot-link","pattern":"snapshot"}] }` +func TestInstalledToolWindowKeepsPackageIconDeclaration(t *testing.T) { + manifest := strings.Replace(snapshotManifest, `"title":"Before","text":"Snapshot"`, + `"title":"Before","text":"Snapshot","icon":{"path":"icons/light.svg","darkPath":"icons/dark.svg","mode":"original"}`, 1) + entry := snapshotEntry(t, "dev.lithe.test.snapshot", "1.0.0", manifest) + service := &Service{kernel: &fakeKernel{}} + windows, err := service.ToolWindows(context.Background(), []pluginmanager.Entry{entry}) + want := pluginicons.Declaration{Path: "icons/light.svg", DarkPath: "icons/dark.svg", Mode: "original"} + if err != nil || len(windows) != 1 { + t.Fatalf("tool windows = %+v, %v", windows, err) + } + if windows[0].Icon != want || windows[0].IconHost != "" || windows[0].Package != entry.Installed.Path { + t.Fatalf("package icon declaration = %+v, want %+v in its installed package", windows[0], want) + } +} + func TestInstalledSnapshotKeepsOneManifestAcrossConsumers(t *testing.T) { ctx := context.Background() kernel := &snapshotKernel{fakeKernel: &fakeKernel{}} diff --git a/desktop/internal/pluginservice/toolwindows.go b/desktop/internal/pluginservice/toolwindows.go index 69ea07b2a3..dce74d7ba1 100644 --- a/desktop/internal/pluginservice/toolwindows.go +++ b/desktop/internal/pluginservice/toolwindows.go @@ -7,6 +7,7 @@ import ( "fmt" "sort" + "github.com/1lck/Lithe-IDEA/desktop/internal/pluginicons" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginmanager" ) @@ -34,9 +35,9 @@ type ToolWindow struct { // View is the backend view function that draws the window's body for each view event // (pluginview); empty for the other kinds. View string - // IconHost is the declared host icon ID ("database", "git", ...), empty when the window - // declares none. Package resources are not read as icons. + // IconHost names a host icon; Icon instead names read-only package resources. IconHost string + Icon pluginicons.Declaration } // ToolWindows reads the tool windows of every enabled plugin, ordered by @@ -73,7 +74,10 @@ func (snapshot InstalledSnapshot) ToolWindows() ([]ToolWindow, error) { Entry string `json:"entry"` } `json:"web"` Icon *struct { - Host string `json:"host"` + Host string `json:"host"` + Path string `json:"path"` + DarkPath string `json:"darkPath"` + Mode string `json:"mode"` } `json:"icon"` } `json:"toolWindows"` } `json:"ui"` @@ -97,6 +101,9 @@ func (snapshot InstalledSnapshot) ToolWindows() ([]ToolWindow, error) { } if window.Icon != nil { declaredWindow.IconHost = window.Icon.Host + declaredWindow.Icon = pluginicons.Declaration{ + Path: window.Icon.Path, DarkPath: window.Icon.DarkPath, Mode: window.Icon.Mode, + } } if window.View != nil { declaredWindow.View = window.View.Function diff --git a/desktop/internal/workbench/chrome_view.go b/desktop/internal/workbench/chrome_view.go index 952b3283dd..3990c62629 100644 --- a/desktop/internal/workbench/chrome_view.go +++ b/desktop/internal/workbench/chrome_view.go @@ -117,7 +117,7 @@ func (a *App) chromeGlyph(c ui.C, i int, layout glyphLayout, rest, hover gfx.Col box := a.chromeBox(ui.Row(k).Size(layout.side, layout.side).Shrink(0).Center(), ui.ID(k), i, open, "", true). TooltipOn(layout.tooltip) box.Children(func() { - ui.Icon(c, *a.chrome.catalog[i].icon).Size(layout.icon, layout.icon).Color(rest). + ui.Icon(c, *a.chromeItemIcon(i)).Size(layout.icon, layout.icon).Color(rest). StateFrom(box).Hover(ui.Look{}.Color(hover)) }) return box, box.Clicked() @@ -412,7 +412,7 @@ func (a *App) hiddenToolWindowsButton(c ui.C, i int, z zone, layout glyphLayout) button = button.Background(a.colors.Active).Hover(ui.Look{}.Background(a.colors.Active)) } button.Children(func() { - ui.Icon(c, *a.chrome.catalog[i].icon).Size(layout.icon, layout.icon).Color(rest). + ui.Icon(c, *a.chromeItemIcon(i)).Size(layout.icon, layout.icon).Color(rest). StateFrom(button).Hover(ui.Look{}.Color(hover)) }) clicked := button.Clicked() @@ -493,8 +493,8 @@ func (a *App) hiddenToolWindowRow(c ui.C, i int) (ui.Box, bool) { row = a.chromeHover(row) } row.Children(func() { - if it.icon != nil { - ui.Icon(c, *it.icon).Size(chromeIconSize, chromeIconSize).Shrink(0).Color(a.colors.Subtle) + if icon := a.chromeItemIcon(i); icon != nil { + ui.Icon(c, *icon).Size(chromeIconSize, chromeIconSize).Shrink(0).Color(a.colors.Subtle) } ui.Text(c, label).Grow(1).Color(a.colors.Text).LineHeight(chromeLineHeight).Ellipsis() if it.panel { diff --git a/desktop/internal/workbench/drag.go b/desktop/internal/workbench/drag.go index 9d913367dc..4529743a68 100644 --- a/desktop/internal/workbench/drag.go +++ b/desktop/internal/workbench/drag.go @@ -340,7 +340,7 @@ func (a *App) paintSnappedToolGhost(canvas *gfx.Canvas, d *dragState) { gfx.Rect{Width: d.viewport.Width, Height: d.viewport.Height}, ) canvas.RoundedBorder(ghost, dragGhostRadius, dragGhostBorderWidth, a.colors.Accent, a.colors.Ground) - if icon := a.chrome.catalog[d.item].icon; icon != nil { + if icon := a.chromeItemIcon(d.item); icon != nil { canvas.DrawIcon(*icon, ghost.Inset(gfx.All(dragSnappedGhostIconInset)), a.colors.Text) } } @@ -366,7 +366,7 @@ func (a *App) paintDetachedToolGhost(canvas *gfx.Canvas, d *dragState) { } color = color.WithAlpha(dragFloatingGhostOpacity) canvas.RoundedBorder(ghost, dragFloatingGhostRadius, dragFloatingGhostBorderWidth, color, color) - if icon := a.chrome.catalog[d.item].icon; icon != nil { + if icon := a.chromeItemIcon(d.item); icon != nil { canvas.DrawIcon(*icon, ghost.Inset(gfx.All(dragFloatingGhostIconInset)), a.colors.Text.WithAlpha(dragFloatingGhostOpacity)) } } @@ -407,7 +407,7 @@ func (a *App) paintDetachedDropPreview(canvas *gfx.Canvas, target dragTarget) { // because those bars do not detach into the workbench. A title bar button that may also sit // on the stripes takes it while the pointer is over the title bar. func (a *App) paintLegacyDragGhost(canvas *gfx.Canvas, d *dragState) { - icon := a.chrome.catalog[d.item].icon + icon := a.chromeItemIcon(d.item) text := a.dragGhostText(d.item) ghost := gfx.Rect{X: d.x + dragGhostOffset, Y: d.y + dragGhostOffset, Width: dragGhostSize, Height: dragGhostSize} if text != "" { diff --git a/desktop/internal/workbench/plugins.go b/desktop/internal/workbench/plugins.go index 23e0d307d5..55065d3afa 100644 --- a/desktop/internal/workbench/plugins.go +++ b/desktop/internal/workbench/plugins.go @@ -451,6 +451,17 @@ func (a *App) reloadPluginLanguages() { return nil } windows, windowsErr := snapshot.ToolWindows() + for _, window := range windows { + if ctx.Err() != nil || a.pluginReloadGeneration.Load() != generation { + return nil + } + if window.Icon.Path == "" { + continue + } + if err := a.pluginIcons.Read(window.PluginID, window.Package, window.Icon); err != nil { + a.backgroundFailedIn(ctx, "plugin_icon", fmt.Errorf("%s: %w", window.PluginID, err)) + } + } commands, commandsErr := snapshot.ToolCommands() vcsPlugins, vcsErr := snapshot.VcsPlugins() a.pluginReloadMu.Lock() diff --git a/desktop/internal/workbench/plugintools.go b/desktop/internal/workbench/plugintools.go index 06c0788057..bbf58c4d17 100644 --- a/desktop/internal/workbench/plugintools.go +++ b/desktop/internal/workbench/plugintools.go @@ -54,6 +54,20 @@ func pluginToolIcon(host string) *gfx.Icon { return &icon } +// chromeItemIcon uses package icons already read by the plugin reload worker. +// Resolving the theme here keeps dark variants and template tinting in step +// with the containing control without reading files while painting. +func (a *App) chromeItemIcon(i int) *gfx.Icon { + it := &a.chrome.catalog[i] + if tool := it.tool; tool != nil && tool.Icon.Path != "" { + if found, ok := a.pluginIcons.Lookup(tool.PluginID, tool.Icon); ok { + icon := found.For(a.colors.Dark) + return &icon + } + } + return it.icon +} + // pluginItems is the built-in catalog followed by an item for each plugin tool window, then // one for each plugin version control provider. A tool window without its own icon has the // generic tool window icon. @@ -105,7 +119,7 @@ func samePluginItem(a, b *item) bool { func sameToolWindow(a, b *pluginservice.ToolWindow) bool { return a.PluginID == b.PluginID && a.PluginName == b.PluginName && a.Package == b.Package && a.ID == b.ID && a.Title == b.Title && a.Placement == b.Placement && a.Order == b.Order && - a.Text == b.Text && a.Web == b.Web && bytes.Equal(a.Manifest, b.Manifest) + a.Text == b.Text && a.Web == b.Web && a.IconHost == b.IconHost && a.Icon == b.Icon && bytes.Equal(a.Manifest, b.Manifest) } // setPluginTools makes the tool windows and version control providers of the enabled plugins diff --git a/desktop/internal/workbench/plugintools_test.go b/desktop/internal/workbench/plugintools_test.go index 379c91e0a0..f924b32c76 100644 --- a/desktop/internal/workbench/plugintools_test.go +++ b/desktop/internal/workbench/plugintools_test.go @@ -8,6 +8,8 @@ import ( "github.com/1lck/Lithe-IDEA/desktop/internal/contractfixture" "github.com/1lck/Lithe-IDEA/desktop/internal/core" + "github.com/1lck/Lithe-IDEA/desktop/internal/pluginicons" + "github.com/1lck/Lithe-IDEA/desktop/internal/pluginservice" "github.com/1lck/Lithe-IDEA/desktop/internal/pluginstate" "github.com/1lck/Lithe-IDEA/desktop/internal/store" ) @@ -18,6 +20,44 @@ const ( webPanelNotes = pluginItemPrefix + webPanelPlugin + ".notes" ) +func TestPluginToolWindowUsesPackageIconAcrossThemes(t *testing.T) { + directory := t.TempDir() + for name, color := range map[string]string{"light.svg": "#FF0000", "dark.svg": "#0000FF"} { + data := `` + if err := os.WriteFile(filepath.Join(directory, name), []byte(data), 0o600); err != nil { + t.Fatal(err) + } + } + for _, mode := range []string{pluginicons.ModeOriginal, pluginicons.ModeTemplate} { + t.Run(mode, func(t *testing.T) { + tool := pluginservice.ToolWindow{ + PluginID: "dev.lithe.test.tool-icon", ID: "dev.lithe.test.tool-icon.window", Package: directory, + Icon: pluginicons.Declaration{Path: "light.svg", DarkPath: "dark.svg", Mode: mode}, + } + var app App + app.chrome.setItems(pluginItems([]pluginservice.ToolWindow{tool}, nil)) + if err := app.pluginIcons.Read(tool.PluginID, directory, tool.Icon); err != nil { + t.Fatal(err) + } + index := app.chrome.index[pluginItemPrefix+tool.ID] + for _, dark := range []bool{false, true} { + app.colors.Dark = dark + icon := app.chromeItemIcon(index) + if icon == nil { + t.Fatal("declared package icon is missing") + } + if mode == pluginicons.ModeTemplate { + if len(icon.Commands) == 0 || len(icon.Layers) != 0 || icon.Stroke != 0 { + t.Fatalf("template icon does not use the control tint: %+v", icon) + } + } else if len(icon.Layers) != 1 || (!dark && icon.Layers[0].Fill.Red != 1) || (dark && icon.Layers[0].Fill.Blue != 1) { + t.Fatalf("dark=%v: package theme variant = %+v", dark, icon) + } + } + }) + } +} + // webPanelHarness installs the shared web-panel fixture, which declares a web window // on the right and a text window at the bottom, and opens a project. func webPanelHarness(t *testing.T) (*harness, *store.Store) { diff --git a/shared/platform-feature-matrix/features/plugin-web-tool-windows.json b/shared/platform-feature-matrix/features/plugin-web-tool-windows.json index 3171c293e8..ce0ea6bb44 100644 --- a/shared/platform-feature-matrix/features/plugin-web-tool-windows.json +++ b/shared/platform-feature-matrix/features/plugin-web-tool-windows.json @@ -21,7 +21,11 @@ "desktop/internal/pluginservice/backendhost.go", "desktop/internal/workbench/root.go", "desktop/internal/workbench/pluginsemantics_hover_test.go", - "desktop/internal/workbench/pluginsemantics_hover_visual_test.go" + "desktop/internal/workbench/pluginsemantics_hover_visual_test.go", + "desktop/internal/pluginservice/installed_snapshot_test.go", + "desktop/internal/workbench/plugins.go", + "desktop/internal/workbench/chrome_view.go", + "desktop/internal/workbench/drag.go" ] }, "windows": { @@ -42,11 +46,15 @@ "desktop/internal/pluginservice/backendhost.go", "desktop/internal/workbench/root.go", "desktop/internal/workbench/pluginsemantics_hover_test.go", - "desktop/internal/workbench/pluginsemantics_hover_visual_test.go" + "desktop/internal/workbench/pluginsemantics_hover_visual_test.go", + "desktop/internal/pluginservice/installed_snapshot_test.go", + "desktop/internal/workbench/plugins.go", + "desktop/internal/workbench/chrome_view.go", + "desktop/internal/workbench/drag.go" ] }, "owner": "Plugin Platform", - "verification": "自动回归(Viva):scripts/desktop/desktop-go.sh test -race -count=1 ./internal/pluginweb ./internal/pluginservice -run 'TestPage',以及 ./internal/workbench -run TestPluginToolWindows:用共享 web-panel 夹具和真实 Core 验证入口文档注入 CSP 与桥接脚本、包内符号链接/目录链接/../ 与保留的 .lithe-host/ 路径被拒绝、文件大小上限、ui.getState/setState 按窗口与工作区隔离存储在插件状态目录、functions.list/invoke 的结果与只属于本调用的进度、页面取消与关闭页面都取消调用且不再投递、调用 ID 不可复用、对话框一次一个且取消返回 null、workspace.openFile 拒绝工作区外路径、build.* 在未提供构建系统时为 plugin.web.unknownMethod、离开插件源的导航被送回入口、主题变化发送 ui.themeChanged;工作台里文本窗口显示原文,网页窗口在 Web 引擎就绪前显示“正在打开…”、打不开时说明原因,隐藏窗口即关闭页面;停用插件后窗口离开工具栏,期间保存的布局仍保留其位置,重新启用回到原处。产品界面验收仍 pending:macOS 与 Windows 开发版(make -C desktop run)用“从磁盘安装插件”安装 web-panel 夹具(plugin.json 旁放 ui/index.html),打开右侧 Web Panel,确认页面显示、根元素带 data-theme 与 --lithe-* 变量、切换浅色/深色后收到 ui.themeChanged;页面内联脚本与 fetch 外网被 CSP 拦截;lithe.request('ui.setState', {state:{a:1}}) 后隐藏再显示窗口,ui.getState 仍返回该值;dialog.openFile 的标题写明插件名;之后运行 scripts/desktop/verify/verify-runtime-bundle-immutability.sh 确认包与应用 bundle 不变。 2026-11-24 修复补充:TestPagePreservesBackendFunctionFailure 覆盖后端函数的 code、message、pluginErrorCode 原样进入网页回复;TestPointerHoverPaintsAboveTheNativeContentLayer 覆盖工作台浮层高于正文,TestVisualPointerHover 记录深浅色、中英文的悬停和导航表面。原生验收仍 pending:用契约 web-panel 夹具打开网页,在跨越网页区域的位置显示悬停、补全、导航、菜单和对话框,确认遮挡、点击与关闭恢复正确。用户要求自行验收,最终收尾未重新运行检查。", + "verification": "自动回归(Viva):scripts/desktop/desktop-go.sh test -race -count=1 ./internal/pluginweb ./internal/pluginservice -run 'TestPage',以及 ./internal/workbench -run TestPluginToolWindows:用共享 web-panel 夹具和真实 Core 验证入口文档注入 CSP 与桥接脚本、包内符号链接/目录链接/../ 与保留的 .lithe-host/ 路径被拒绝、文件大小上限、ui.getState/setState 按窗口与工作区隔离存储在插件状态目录、functions.list/invoke 的结果与只属于本调用的进度、页面取消与关闭页面都取消调用且不再投递、调用 ID 不可复用、对话框一次一个且取消返回 null、workspace.openFile 拒绝工作区外路径、build.* 在未提供构建系统时为 plugin.web.unknownMethod、离开插件源的导航被送回入口、主题变化发送 ui.themeChanged;工作台里文本窗口显示原文,网页窗口在 Web 引擎就绪前显示“正在打开…”、打不开时说明原因,隐藏窗口即关闭页面;停用插件后窗口离开工具栏,期间保存的布局仍保留其位置,重新启用回到原处。产品界面验收仍 pending:macOS 与 Windows 开发版(make -C desktop run)用“从磁盘安装插件”安装 web-panel 夹具(plugin.json 旁放 ui/index.html),打开右侧 Web Panel,确认页面显示、根元素带 data-theme 与 --lithe-* 变量、切换浅色/深色后收到 ui.themeChanged;页面内联脚本与 fetch 外网被 CSP 拦截;lithe.request('ui.setState', {state:{a:1}}) 后隐藏再显示窗口,ui.getState 仍返回该值;dialog.openFile 的标题写明插件名;之后运行 scripts/desktop/verify/verify-runtime-bundle-immutability.sh 确认包与应用 bundle 不变。 2026-11-24 修复补充:TestPagePreservesBackendFunctionFailure 覆盖后端函数的 code、message、pluginErrorCode 原样进入网页回复;TestPointerHoverPaintsAboveTheNativeContentLayer 覆盖工作台浮层高于正文,TestVisualPointerHover 记录深浅色、中英文的悬停和导航表面。原生验收仍 pending:用契约 web-panel 夹具打开网页,在跨越网页区域的位置显示悬停、补全、导航、菜单和对话框,确认遮挡、点击与关闭恢复正确。用户要求自行验收,最终收尾未重新运行检查。 包图标回归:TestInstalledToolWindowKeepsPackageIconDeclaration、TestPluginToolWindowUsesPackageIconAcrossThemes 已编写未执行;用户自行检查声明 SVG 的工具窗口入口、隐藏列表及拖动预览,亮暗切换与模板着色。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36", "macos": { @@ -100,5 +108,5 @@ "verificationStatus": "pending" } }, - "notes": "Viva 客户端 2026-11-11 接入:页面规则(资源、文档注入、桥接请求校验、回复与事件封装)在 Rust Core plugins.web.*,桌面端只做 Web 视图、包文件读取、状态存储、对话框与调用。尚缺:build.* 方法(本宿主不向页面提供构建系统)、摄像头/麦克风授权、插件声明的窗口图标(暂用通用工具窗口图标);Viva 的 Web 视图无法设置响应头(CSP 以 meta 注入)、无法在导航前拦截(提交后送回入口)、数据存储是持久的,均待上游补齐。 2026-11-24:工作台弹层明确使用 Viva LayerPaneChrome,由框架处理原生网页遮罩与点击;桥接保留后端结构化失败,不把业务错误改为 plugin.web.invalidRequest。两端共用代码,原生验证状态保持 pending。" + "notes": "Viva 客户端 2026-11-11 接入:页面规则(资源、文档注入、桥接请求校验、回复与事件封装)在 Rust Core plugins.web.*,桌面端只做 Web 视图、包文件读取、状态存储、对话框与调用。尚缺:build.* 方法(本宿主不向页面提供构建系统)、摄像头/麦克风授权;Viva 的 Web 视图无法设置响应头(CSP 以 meta 注入)、无法在导航前拦截(提交后送回入口)、数据存储是持久的,均待上游补齐。 2026-11-24:工作台弹层明确使用 Viva LayerPaneChrome,由框架处理原生网页遮罩与点击;桥接保留后端结构化失败,不把业务错误改为 plugin.web.invalidRequest。两端共用代码,原生验证状态保持 pending。 2026-11-24:工具窗口保留包内图标声明,后台复用 pluginicons 只读加载 SVG;工具栏、隐藏入口列表和拖动预览按主题使用缓存,模板使用控件着色。缺失或不支持的图标记录一次降级并使用通用图标。PNG 仍不支持;本次接线按用户要求未运行验证。" } diff --git a/shared/platform-feature-matrix/features/workbench-tool-stripe-icons.json b/shared/platform-feature-matrix/features/workbench-tool-stripe-icons.json index 5cde641dc5..bf1e11881d 100644 --- a/shared/platform-feature-matrix/features/workbench-tool-stripe-icons.json +++ b/shared/platform-feature-matrix/features/workbench-tool-stripe-icons.json @@ -4,8 +4,8 @@ "group": "工作台布局", "capability": "工具窗口栏使用 IntelliJ New UI 的工具窗口图标和尺寸", "owner": "Workbench", - "notes": "Viva 共享实现。项目、提交、结构、查找、Git、终端、问题、运行、调试、构建、通知、服务使用 IntelliJ Community(Apache-2.0,修订 c7f91397daa3a961b4e78bc634fe467a0a7d9ade)的 20×20 New UI 工具窗口图标,许可见 desktop/internal/toolicons/NOTICE;IDEA 没有对应图标的入口(引用、测试、安全、背景)和隐藏入口列表的“…”使用 Lucide 图标,描边减到 1.8 以接近 IDEA 的线宽;插件声明的通用工具图标名映射到同一套图标。icons.go 由 scripts/desktop/generate-desktop-file-icons.sh --tools-only 从 SVG 生成,运行时不读写文件。尺寸:40pt 工具栏、30pt 按钮、20pt 图标、10pt 间距。", - "verification": "打开工作区,对照 IntelliJ IDEA New UI 检查左右工具窗口栏:图标形状和大小一致,选中按钮为主题主色圆角底配反色图标;拖动按钮时拖动预览里的图标居中,插入线落在两个按钮正中。浅色和深色主题各看一次。自动化:stripe_test.go 的 TestToolStripeButtonsHaveTheToolWindowBarSizes。 2026-11-23 CI Viva 断言修复:移除 ui.ContextMenu 等非消费调用上的 Key/Part 传递,保留原有 ui.Spacer 弹性占位,避免 Context 身份泄漏到后续 Spacer 节点并消除叶节点/未消费 Part 断言;macOS/Windows 原生验证仍 pending。", + "notes": "Viva 共享实现。项目、提交、结构、查找、Git、终端、问题、运行、调试、构建、通知、服务使用 IntelliJ Community(Apache-2.0,修订 c7f91397daa3a961b4e78bc634fe467a0a7d9ade)的 20×20 New UI 工具窗口图标,许可见 desktop/internal/toolicons/NOTICE;IDEA 没有对应图标的入口(引用、测试、安全、背景)和隐藏入口列表的“…”使用 Lucide 图标,描边减到 1.8 以接近 IDEA 的线宽;插件声明的通用工具图标名映射到同一套图标。icons.go 由 scripts/desktop/generate-desktop-file-icons.sh --tools-only 从 SVG 生成,运行时不读写文件。尺寸:40pt 工具栏、30pt 按钮、20pt 图标、10pt 间距。 2026-11-24:工具窗口保留包内图标声明,后台复用 pluginicons 只读加载 SVG;工具栏、隐藏入口列表和拖动预览按主题使用缓存,模板使用控件着色。缺失或不支持的图标记录一次降级并使用通用图标。PNG 仍不支持;本次接线按用户要求未运行验证。", + "verification": "打开工作区,对照 IntelliJ IDEA New UI 检查左右工具窗口栏:图标形状和大小一致,选中按钮为主题主色圆角底配反色图标;拖动按钮时拖动预览里的图标居中,插入线落在两个按钮正中。浅色和深色主题各看一次。自动化:stripe_test.go 的 TestToolStripeButtonsHaveTheToolWindowBarSizes。 2026-11-23 CI Viva 断言修复:移除 ui.ContextMenu 等非消费调用上的 Key/Part 传递,保留原有 ui.Spacer 弹性占位,避免 Context 身份泄漏到后续 Spacer 节点并消除叶节点/未消费 Part 断言;macOS/Windows 原生验证仍 pending。 包图标回归:TestInstalledToolWindowKeepsPackageIconDeclaration、TestPluginToolWindowUsesPackageIconAcrossThemes 已编写未执行;用户自行检查声明 SVG 的工具窗口入口、隐藏列表及拖动预览,亮暗切换与模板着色。", "macos": { "implementationStatus": "implemented", "verificationStatus": "pending", @@ -17,7 +17,12 @@ "desktop/internal/workbench/chrome.go", "desktop/internal/workbench/chrome_view.go", "desktop/internal/workbench/stripe_test.go", - "scripts/desktop/generate-desktop-file-icons.sh" + "scripts/desktop/generate-desktop-file-icons.sh", + "desktop/internal/pluginservice/toolwindows.go", + "desktop/internal/pluginservice/installed_snapshot_test.go", + "desktop/internal/workbench/plugins.go", + "desktop/internal/workbench/plugintools_test.go", + "desktop/internal/workbench/drag.go" ] }, "windows": { @@ -31,7 +36,12 @@ "desktop/internal/workbench/chrome.go", "desktop/internal/workbench/chrome_view.go", "desktop/internal/workbench/stripe_test.go", - "scripts/desktop/generate-desktop-file-icons.sh" + "scripts/desktop/generate-desktop-file-icons.sh", + "desktop/internal/pluginservice/toolwindows.go", + "desktop/internal/pluginservice/installed_snapshot_test.go", + "desktop/internal/workbench/plugins.go", + "desktop/internal/workbench/plugintools_test.go", + "desktop/internal/workbench/drag.go" ] } }