From d7a5362039707a74a72f0ed5c2e4e92dbeecc70f Mon Sep 17 00:00:00 2001 From: Mucheen <1528136628@qq.com> Date: Mon, 28 Sep 2026 10:48:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(macos):=20=E4=BF=AE=E5=A4=8D=E5=A3=81?= =?UTF-8?q?=E7=BA=B8=E6=A8=A1=E5=BC=8F=E7=BC=96=E8=BE=91=E5=99=A8=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E9=BB=91=E8=BE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...26-09-15-macos-monaco-feasibility-probe.md | 3 +++ docs/development/platform-parity-matrix.csv | 1 + docs/development/platform-parity-matrix.md | 9 ++++---- frontend/editor/src/theme.ts | 3 ++- .../Monaco/workbench.integration.ts | 14 ++++++++++++ shared/platform-feature-matrix.json | 22 +++++++++++++++++++ 6 files changed, 47 insertions(+), 5 deletions(-) diff --git a/.agents/notes/implemented/architecture/2026-09-15-macos-monaco-feasibility-probe.md b/.agents/notes/implemented/architecture/2026-09-15-macos-monaco-feasibility-probe.md index 2ac763f39..aa9b7f71c 100644 --- a/.agents/notes/implemented/architecture/2026-09-15-macos-monaco-feasibility-probe.md +++ b/.agents/notes/implemented/architecture/2026-09-15-macos-monaco-feasibility-probe.md @@ -345,6 +345,9 @@ Monaco 视图。语法 token 仍使用统一的 `color-mappings.json` 与共享 选择、当前行和缩进引导线仍使用当前主题颜色。只把 SwiftUI 外层设为透明是不够的, 因为不透明的 WebView 或 `editor.background` 仍会覆盖图片。也不能把 Monaco 永久设成 透明,否则没有背景图时会丢失正常的编辑器表面和主题颜色。 +主题背景色还必须传给 `editorOverviewRuler.background`。启用右侧代码缩略图时, +Monaco 会给未指定背景的概览标尺填入默认分词背景色,在壁纸模式下形成黑色竖条; +显式传入透明色后,概览标尺与编辑区一起露出工作台图片。 ### 只读差异视图 diff --git a/docs/development/platform-parity-matrix.csv b/docs/development/platform-parity-matrix.csv index 1c6c29e25..0559c8f30 100644 --- a/docs/development/platform-parity-matrix.csv +++ b/docs/development/platform-parity-matrix.csv @@ -12,6 +12,7 @@ workspace-document-sync,工作区,工作区生命周期,脏状态、保存与外 workspace-tabs-projects,工作区,工作区生命周期,多项目与多标签,已实现,待验证,已实现,待验证,Workspace,同时打开多个项目和文件,确认标签、项目上下文和关闭恢复行为。 Windows 重复打开同一本地目录(含大小写、分隔符和目录链接别名)时,恢复并聚焦已有窗口及项目标签;连续打开只产生一个窗口,关闭或打开失败后可以重试。,,macos/Sources/Lithe/Views/Workspace; macos/Sources/Lithe/Views/Editor,windows/tauri/src/features/workspace; windows/tauri/src/features/tabs; windows/tauri/src-tauri/src/project_windows.rs; windows/tauri/src-tauri/src/project_window_registry.rs; windows/tauri/src/features/window/services/project-window-router.ts editor-text-tabs,编辑器,文本编辑,文本编辑与标签生命周期,已实现,待验证,已实现,待验证,Editor,打开、编辑、保存、关闭和恢复多个文本文件,确认光标、脏状态和标签状态;在 macOS 打开无扩展名文本文件,确认标签与项目树图标一致;从外部改为二进制后折叠并展开项目树,确认两处图标更新一致。,,macos/Sources/Lithe/Views/Editor; macos/Sources/Lithe/Models/Editor,windows/tauri/src/features/editor; windows/tauri/src/features/tabs editor-language-basics,编辑器,文本编辑,语法高亮与编辑器模型,已实现,待验证,已实现,待验证,Editor,分别打开 Java、Markdown 和普通文本,确认语言识别、语法高亮和模型切换;开启缩略图并滚动,确认滚动条轨道不透出编辑器代码。,,macos/Sources/Lithe/Views/Editor; macos/Sources/Lithe/Models/Editor,windows/tauri/src/features/editor; frontend/editor; windows/tauri/src/features/editor/engines/monaco/theme.ts +editor-wallpaper-overview-ruler,编辑器,编辑器外观,macOS 工作台壁纸模式下,编辑器概览标尺与代码缩略图随编辑器背景透明,不显示黑色竖条;普通主题仍保持实体背景,已实现,待验证,平台专属,不适用,Editor,在 macOS 选择工作台背景并打开文本文件,分别关闭和打开右侧 Agent 面板,确认编辑器最右侧概览标尺不出现黑色竖条;关闭背景图后确认普通主题底色保持不变。运行真实 WebKit 工作台主题集成测试。Windows 不使用 macOS 原生工作台壁纸。,,frontend/editor/src/theme.ts; macos/Sources/Lithe/Platform/MacOS/MonacoWorkbenchEditor.swift; macos/Experiments/Monaco/workbench.integration.ts,windows/tauri/src/features/editor/engines/monaco/theme.ts editor-semantic-highlighting,编辑器,文本编辑,LSP 语义高亮,已实现,待验证,已实现,待验证,Editor / Language Tooling,打开普通 Java 文件并等待 JDTLS 就绪,开启语义高亮,确认字段、方法等按协商图例上色;编辑、切换、关闭文档和重连服务器后不应用旧结果;服务器 refresh 后重新请求;关闭设置或大文件降级时保留基础语法高亮。,Windows 复用 Core semanticTokens 和共享 fixture,修复 #675;Linux 上的适配器与模型测试不替代 Windows WebView2/JDTLS 实机验收。,macos/Sources/Lithe/Models/AppModel/AppModel+LanguageEditing.swift; macos/Sources/LitheLanguageIntelligenceModule/Runtime/LanguageServerSession.swift; frontend/editor/src/semantic-tokens.ts,windows/tauri/src/platform/lsp-core-adapter.ts; windows/tauri/src/features/editor/lsp/lsp-client.ts; windows/tauri/src/features/editor/engines/monaco/semantic-token-provider.ts; windows/tauri/src/features/editor/engines/monaco/semantic-token-provider.test.ts; windows/tauri/src/platform/lsp-core-adapter.test.ts editor-multiline-tabs,编辑器,文本编辑,多行标签与标签导航,已实现,待验证,已实现,待验证,Editor,打开足够多文件触发多行标签,确认滚动、切换、关闭和活动文件保持。,,macos/Sources/Lithe/Views/Editor,windows/tauri/src/features/tabs search-quick-open,搜索,搜索与导航,快速打开文件与符号,已实现,待验证,已实现,待验证,Search,使用文件名、路径和符号查询,确认排序、键盘导航和打开位置。,,macos/Sources/Lithe/Views/Search; macos/Sources/Lithe/Views/Workbench,windows/tauri/src/features/quick-open diff --git a/docs/development/platform-parity-matrix.md b/docs/development/platform-parity-matrix.md index e55e4495b..f013f862a 100644 --- a/docs/development/platform-parity-matrix.md +++ b/docs/development/platform-parity-matrix.md @@ -4,9 +4,9 @@ - 最后复核:2026-09-25 - 盘点状态:initial-static-inventory(根据 macOS Views/Application/Services、Windows features/extensions 和共享契约的代码入口进行初版盘点;未替代真实运行验收。) -- 功能项:94 -- macOS:实现:✅ 81 已实现,🟡 3 部分实现,❌ 7 未实现,🧩 3 平台专属;验证:✔️ 0 已验证,🔍 84 待验证,— 10 不适用 -- Windows:实现:✅ 82 已实现,🟡 8 部分实现,❌ 4 未实现,🧩 0 平台专属;验证:✔️ 0 已验证,🔍 90 待验证,— 4 不适用 +- 功能项:95 +- macOS:实现:✅ 82 已实现,🟡 3 部分实现,❌ 7 未实现,🧩 3 平台专属;验证:✔️ 0 已验证,🔍 85 待验证,— 10 不适用 +- Windows:实现:✅ 82 已实现,🟡 8 部分实现,❌ 4 未实现,🧩 1 平台专属;验证:✔️ 0 已验证,🔍 90 待验证,— 5 不适用 ## 实现状态定义 @@ -64,12 +64,13 @@
-编辑器 · 12 个能力点 +编辑器 · 13 个能力点 | 功能组 | 能力点 | macOS | Windows | 负责人 | 验证方式 | 备注 | | --- | --- | --- | --- | --- | --- | --- | | 文本编辑 | **文本编辑与标签生命周期**
editor-text-tabs | ✅ 已实现
🔍 待验证
`macos/Sources/Lithe/Views/Editor`、`macos/Sources/Lithe/Models/Editor` | ✅ 已实现
🔍 待验证
`windows/tauri/src/features/editor`、`windows/tauri/src/features/tabs` | Editor | 打开、编辑、保存、关闭和恢复多个文本文件,确认光标、脏状态和标签状态;在 macOS 打开无扩展名文本文件,确认标签与项目树图标一致;从外部改为二进制后折叠并展开项目树,确认两处图标更新一致。 | | | 文本编辑 | **语法高亮与编辑器模型**
editor-language-basics | ✅ 已实现
🔍 待验证
`macos/Sources/Lithe/Views/Editor`、`macos/Sources/Lithe/Models/Editor` | ✅ 已实现
🔍 待验证
`windows/tauri/src/features/editor`、`frontend/editor`、`windows/tauri/src/features/editor/engines/monaco/theme.ts` | Editor | 分别打开 Java、Markdown 和普通文本,确认语言识别、语法高亮和模型切换;开启缩略图并滚动,确认滚动条轨道不透出编辑器代码。 | | +| 编辑器外观 | **macOS 工作台壁纸模式下,编辑器概览标尺与代码缩略图随编辑器背景透明,不显示黑色竖条;普通主题仍保持实体背景**
editor-wallpaper-overview-ruler | ✅ 已实现
🔍 待验证
`frontend/editor/src/theme.ts`、`macos/Sources/Lithe/Platform/MacOS/MonacoWorkbenchEditor.swift`、`macos/Experiments/Monaco/workbench.integration.ts` | 🧩 平台专属
— 不适用
`windows/tauri/src/features/editor/engines/monaco/theme.ts` | Editor | 在 macOS 选择工作台背景并打开文本文件,分别关闭和打开右侧 Agent 面板,确认编辑器最右侧概览标尺不出现黑色竖条;关闭背景图后确认普通主题底色保持不变。运行真实 WebKit 工作台主题集成测试。Windows 不使用 macOS 原生工作台壁纸。 | | | 文本编辑 | **LSP 语义高亮**
editor-semantic-highlighting | ✅ 已实现
🔍 待验证
`macos/Sources/Lithe/Models/AppModel/AppModel+LanguageEditing.swift`、`macos/Sources/LitheLanguageIntelligenceModule/Runtime/LanguageServerSession.swift`、`frontend/editor/src/semantic-tokens.ts` | ✅ 已实现
🔍 待验证
`windows/tauri/src/platform/lsp-core-adapter.ts`、`windows/tauri/src/features/editor/lsp/lsp-client.ts`、`windows/tauri/src/features/editor/engines/monaco/semantic-token-provider.ts`、`windows/tauri/src/features/editor/engines/monaco/semantic-token-provider.test.ts`、`windows/tauri/src/platform/lsp-core-adapter.test.ts` | Editor / Language Tooling | 打开普通 Java 文件并等待 JDTLS 就绪,开启语义高亮,确认字段、方法等按协商图例上色;编辑、切换、关闭文档和重连服务器后不应用旧结果;服务器 refresh 后重新请求;关闭设置或大文件降级时保留基础语法高亮。 | Windows 复用 Core semanticTokens 和共享 fixture,修复 #675;Linux 上的适配器与模型测试不替代 Windows WebView2/JDTLS 实机验收。 | | 文本编辑 | **多行标签与标签导航**
editor-multiline-tabs | ✅ 已实现
🔍 待验证
`macos/Sources/Lithe/Views/Editor` | ✅ 已实现
🔍 待验证
`windows/tauri/src/features/tabs` | Editor | 打开足够多文件触发多行标签,确认滚动、切换、关闭和活动文件保持。 | | | Markdown | **Markdown 预览与富文本渲染**
markdown-rendering | ✅ 已实现
🔍 待验证
`macos/Sources/Lithe/Views/Editor/MarkdownPreviewView.swift`、`macos/Sources/Lithe/Core/Ports/MarkdownRendering.swift` | ✅ 已实现
🔍 待验证
`windows/tauri/src/features/editor/markdown` | Editor | 使用代码高亮、表格、Mermaid、链接和相对路径 fixture 对比渲染结果。 | | diff --git a/frontend/editor/src/theme.ts b/frontend/editor/src/theme.ts index 4ca63b489..cadd04353 100644 --- a/frontend/editor/src/theme.ts +++ b/frontend/editor/src/theme.ts @@ -47,8 +47,9 @@ export function defineWorkbenchTheme(input: WorkbenchThemeInput, palette: Syntax "editorOverviewRuler.wordHighlightTextForeground": "#00000000", }; const surfaceColors: [keyof NonNullable, string[]][] = [ + // Monaco otherwise fills the right overview ruler from tokenizer defaults when the minimap is enabled. ["background", ["editor.background", "editorGutter.background", "editorStickyScroll.background", - "editorStickyScrollGutter.background", "minimap.background"]], + "editorStickyScrollGutter.background", "minimap.background", "editorOverviewRuler.background"]], ["cursor", ["editorCursor.foreground"]], ["selection", ["editor.selectionBackground", "editor.inactiveSelectionBackground"]], ["lineHighlight", ["editor.lineHighlightBackground"]], diff --git a/macos/Experiments/Monaco/workbench.integration.ts b/macos/Experiments/Monaco/workbench.integration.ts index b8d344a39..5c3c5d638 100644 --- a/macos/Experiments/Monaco/workbench.integration.ts +++ b/macos/Experiments/Monaco/workbench.integration.ts @@ -391,6 +391,14 @@ async function verify() { }); const surface = editor.getDomNode()!; const backgroundColor = () => getComputedStyle(surface).backgroundColor.replace(/ /g, ""); + const overviewRulerBackground = () => getComputedStyle(surface) + .getPropertyValue("--vscode-editorOverviewRuler-background").trim().replace(/ /g, ""); + const overviewRulerPixel = () => { + editor.render(); + const canvas = surface.querySelector(".decorationsOverviewRuler")!; + assert(canvas.width > 0 && canvas.height > 0, "overview ruler has no render surface"); + return [...canvas.getContext("2d")!.getImageData(Math.floor(canvas.width / 2), Math.floor(canvas.height / 2), 1, 1).data]; + }; try { window.lithe.configure({ fontFamily: "monospace", fontSize: 13, wrap: false, minimap: true, @@ -401,6 +409,9 @@ async function verify() { const solid = backgroundColor(); assert(["rgb(242,243,244)", "rgba(242,243,244,1)"].includes(solid), `host light theme did not replace Monaco's initial dark surface: ${solid}`); + assert(overviewRulerBackground() === "#f2f3f4", + `opaque overview ruler background did not match the editor surface: ${overviewRulerBackground()}`); + assert(overviewRulerPixel().join() === "242,243,244,255", "solid overview ruler rendered with a different background"); window.lithe.configure({ fontFamily: "monospace", fontSize: 13, wrap: false, minimap: true, theme: { id: "probe-light-wallpaper", dark: false, colors: { @@ -410,6 +421,9 @@ async function verify() { const transparent = backgroundColor(); assert(transparent === "rgba(0,0,0,0)", `transparent Monaco surface still covered the native wallpaper: ${transparent}`); + assert(overviewRulerBackground() === "rgba(0,0,0,0)", + `overview ruler still covered the native wallpaper: ${overviewRulerBackground()}`); + assert(overviewRulerPixel().join() === "0,0,0,0", "transparent overview ruler rendered an opaque strip"); } finally { window.lithe.configure({ dark: false, fontFamily: "monospace", fontSize: 13, wrap: false, minimap: true }); await window.lithe.retain([]); diff --git a/shared/platform-feature-matrix.json b/shared/platform-feature-matrix.json index f8308ed12..38448032f 100644 --- a/shared/platform-feature-matrix.json +++ b/shared/platform-feature-matrix.json @@ -377,6 +377,28 @@ "owner": "Editor", "verification": "分别打开 Java、Markdown 和普通文本,确认语言识别、语法高亮和模型切换;开启缩略图并滚动,确认滚动条轨道不透出编辑器代码。" }, + { + "id": "editor-wallpaper-overview-ruler", + "area": "编辑器", + "group": "编辑器外观", + "capability": "macOS 工作台壁纸模式下,编辑器概览标尺与代码缩略图随编辑器背景透明,不显示黑色竖条;普通主题仍保持实体背景", + "macos": { + "implementationStatus": "implemented", + "verificationStatus": "pending", + "evidence": [ + "frontend/editor/src/theme.ts", + "macos/Sources/Lithe/Platform/MacOS/MonacoWorkbenchEditor.swift", + "macos/Experiments/Monaco/workbench.integration.ts" + ] + }, + "windows": { + "implementationStatus": "platform-specific", + "verificationStatus": "not-applicable", + "evidence": ["windows/tauri/src/features/editor/engines/monaco/theme.ts"] + }, + "owner": "Editor", + "verification": "在 macOS 选择工作台背景并打开文本文件,分别关闭和打开右侧 Agent 面板,确认编辑器最右侧概览标尺不出现黑色竖条;关闭背景图后确认普通主题底色保持不变。运行真实 WebKit 工作台主题集成测试。Windows 不使用 macOS 原生工作台壁纸。" + }, { "id": "editor-semantic-highlighting", "area": "编辑器",