Skip to content

Commit f53f65d

Browse files
Mucheen1lck
andauthored
fix(macos): 修复壁纸模式编辑器右侧黑边 (#943)
Co-authored-by: Lichenkang <2188718831@qq.com>
1 parent 1f09fbc commit f53f65d

9 files changed

Lines changed: 55 additions & 8 deletions

File tree

‎.agents/notes/implemented/architecture/2026-09-15-macos-monaco-feasibility-probe.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,9 @@ Monaco 视图。语法 token 仍使用统一的 `color-mappings.json` 与共享
370370
选择、当前行和缩进引导线仍使用当前主题颜色。只把 SwiftUI 外层设为透明是不够的,
371371
因为不透明的 WebView 或 `editor.background` 仍会覆盖图片。也不能把 Monaco 永久设成
372372
透明,否则没有背景图时会丢失正常的编辑器表面和主题颜色。
373+
主题背景色还必须传给 `editorOverviewRuler.background`。启用右侧代码缩略图时,
374+
Monaco 会给未指定背景的概览标尺填入默认分词背景色,在壁纸模式下形成黑色竖条;
375+
显式传入透明色后,概览标尺与编辑区一起露出工作台图片。
373376

374377
### 只读差异视图
375378

‎.agents/skills/write-stable-tests/references/windows-and-rust.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ Git subprocesses, sometimes rebuilding several repositories in one case. The
5252
SharedRust lane assigns the `tests::git_history_rewrite::` module and the older
5353
`tests::git::git_write_squashes_`, `git_write_deletes_a_local_commit_`, and
5454
`git_write_edits_a_local_commit_message_` scenarios a 30-second process budget.
55-
Core rebase requests use a nested 20-second deadline. Other cases retain the
56-
normal 15-second budget. The Rust runner's repeatable
55+
The `tests::git_patch_exchange::patch_metadata_can_list_an_oversized_export_before_selecting_a_small_subset`
56+
case also gets 30 seconds because it writes and inspects a real file larger
57+
than the 32 MiB patch limit; Windows CI terminated it at 16.1 seconds under
58+
the default 15-second limit. Core rebase requests use a nested 20-second
59+
deadline. Other cases retain the normal 15-second budget. The Rust runner's repeatable
5760
`--test-budget prefix=milliseconds` option uses the most specific matching
5861
prefix, records each case's effective budget in JSON, uses that budget for
5962
HTML/JUnit classification, and remains capped by the shared suite deadline.

‎.agents/skills/write-stable-tests/scripts/test-stability-windows.ps1‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ function Invoke-TimedRustTests {
7575
"tests::git_history_rewrite::",
7676
"tests::git::git_write_squashes_",
7777
"tests::git::git_write_deletes_a_local_commit_",
78-
"tests::git::git_write_edits_a_local_commit_message_"
78+
"tests::git::git_write_edits_a_local_commit_message_",
79+
"tests::git_patch_exchange::patch_metadata_can_list_an_oversized_export_before_selecting_a_small_subset"
7980
)) {
8081
$arguments += @("--test-budget", "${prefix}=30000")
8182
}

‎.github/workflows/ci-windows.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ jobs:
463463
--test-budget tests::git::git_write_squashes_=30000 `
464464
--test-budget tests::git::git_write_deletes_a_local_commit_=30000 `
465465
--test-budget tests::git::git_write_edits_a_local_commit_message_=30000 `
466+
--test-budget tests::git_patch_exchange::patch_metadata_can_list_an_oversized_export_before_selecting_a_small_subset=30000 `
466467
--build-timeout-ms 600000 `
467468
--suite-timeout-ms 1200000 `
468469
--report .artifacts/test-stability/windows-real-jdt.json

‎docs/development/platform-parity-matrix.csv‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ workspace-tabs-projects,工作区,工作区生命周期,多项目与多标签,
1515
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
1616
editor-pointer-selection,编辑器,文本编辑,鼠标与触控板点击、选词和拖选,已实现,待验证,已实现,待验证,Editor,macOS 分别启用微信输入法和系统 ABC,快速轻点不同位置后松手移动,确认不扩展选区、不移动文字;验证同位置双击选词、Shift 点击扩选、按住拖选、选中文字拖放、主编辑器和分屏及 diff。运行 scripts/probe-macos-monaco.sh --workbench-tests;Windows 验证同样的正常鼠标交互。,macOS 在宿主修正 WebKit 零按钮按下事件,保留 Monaco 选择语义。Linux Chromium 真实 Monaco 控制事件回放通过,仍待 macOS 微信输入法与 Windows WebView2 实机验证。,macos/EditorFrontend/main.ts; macos/EditorFrontend/mouse-input.ts; macos/Experiments/Monaco/mouse-input.integration.ts,windows/tauri/src/features/editor/components/monaco-editor.tsx
1717
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
18+
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
1819
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
1920
editor-multiline-tabs,编辑器,文本编辑,多行标签与标签导航,已实现,待验证,已实现,待验证,Editor,打开足够多文件触发多行标签,确认滚动、切换、关闭和活动文件保持。,,macos/Sources/Lithe/Views/Editor,windows/tauri/src/features/tabs
2021
search-quick-open,搜索,搜索与导航,快速打开文件与符号,已实现,待验证,已实现,待验证,Search,使用文件名、路径和符号查询,确认排序、键盘导航和打开位置。,,macos/Sources/Lithe/Views/Search; macos/Sources/Lithe/Views/Workbench,windows/tauri/src/features/quick-open

‎docs/development/platform-parity-matrix.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
55
- 最后复核:2026-09-27
66
- 盘点状态:initial-static-inventory(根据 macOS Views/Application/Services、Windows features/extensions 和共享契约的代码入口进行初版盘点;未替代真实运行验收。)
7-
- 功能项:101
8-
- macOS:实现:✅ 88 已实现,🟡 3 部分实现,❌ 7 未实现,🧩 3 平台专属;验证:✔️ 0 已验证,🔍 91 待验证,— 10 不适用
9-
- Windows:实现:✅ 87 已实现,🟡 10 部分实现,❌ 4 未实现,🧩 0 平台专属;验证:✔️ 0 已验证,🔍 97 待验证,— 4 不适用
7+
- 功能项:102
8+
- macOS:实现:✅ 89 已实现,🟡 3 部分实现,❌ 7 未实现,🧩 3 平台专属;验证:✔️ 0 已验证,🔍 92 待验证,— 10 不适用
9+
- Windows:实现:✅ 87 已实现,🟡 10 部分实现,❌ 4 未实现,🧩 1 平台专属;验证:✔️ 0 已验证,🔍 97 待验证,— 5 不适用
1010

1111
## 实现状态定义
1212

@@ -66,13 +66,14 @@
6666
</details>
6767

6868
<details>
69-
<summary><strong>编辑器</strong> · 13 个能力点</summary>
69+
<summary><strong>编辑器</strong> · 14 个能力点</summary>
7070

7171
| 功能组 | 能力点 | macOS | Windows | 负责人 | 验证方式 | 备注 |
7272
| --- | --- | --- | --- | --- | --- | --- |
7373
| 文本编辑 | **文本编辑与标签生命周期**<br><sub>editor-text-tabs</sub> | ✅ 已实现<br><sub>🔍 待验证</sub><br><sub>`macos/Sources/Lithe/Views/Editor`、`macos/Sources/Lithe/Models/Editor`</sub> | ✅ 已实现<br><sub>🔍 待验证</sub><br><sub>`windows/tauri/src/features/editor`、`windows/tauri/src/features/tabs`</sub> | Editor | 打开、编辑、保存、关闭和恢复多个文本文件,确认光标、脏状态和标签状态;在 macOS 打开无扩展名文本文件,确认标签与项目树图标一致;从外部改为二进制后折叠并展开项目树,确认两处图标更新一致。 | |
7474
| 文本编辑 | **鼠标与触控板点击、选词和拖选**<br><sub>editor-pointer-selection</sub> | ✅ 已实现<br><sub>🔍 待验证</sub><br><sub>`macos/EditorFrontend/main.ts`、`macos/EditorFrontend/mouse-input.ts`、`macos/Experiments/Monaco/mouse-input.integration.ts`</sub> | ✅ 已实现<br><sub>🔍 待验证</sub><br><sub>`windows/tauri/src/features/editor/components/monaco-editor.tsx`</sub> | Editor | macOS 分别启用微信输入法和系统 ABC,快速轻点不同位置后松手移动,确认不扩展选区、不移动文字;验证同位置双击选词、Shift 点击扩选、按住拖选、选中文字拖放、主编辑器和分屏及 diff。运行 scripts/probe-macos-monaco.sh --workbench-tests;Windows 验证同样的正常鼠标交互。 | macOS 在宿主修正 WebKit 零按钮按下事件,保留 Monaco 选择语义。Linux Chromium 真实 Monaco 控制事件回放通过,仍待 macOS 微信输入法与 Windows WebView2 实机验证。 |
7575
| 文本编辑 | **语法高亮与编辑器模型**<br><sub>editor-language-basics</sub> | ✅ 已实现<br><sub>🔍 待验证</sub><br><sub>`macos/Sources/Lithe/Views/Editor`、`macos/Sources/Lithe/Models/Editor`</sub> | ✅ 已实现<br><sub>🔍 待验证</sub><br><sub>`windows/tauri/src/features/editor`、`frontend/editor`、`windows/tauri/src/features/editor/engines/monaco/theme.ts`</sub> | Editor | 分别打开 Java、Markdown 和普通文本,确认语言识别、语法高亮和模型切换;开启缩略图并滚动,确认滚动条轨道不透出编辑器代码。 | |
76+
| 编辑器外观 | **macOS 工作台壁纸模式下,编辑器概览标尺与代码缩略图随编辑器背景透明,不显示黑色竖条;普通主题仍保持实体背景**<br><sub>editor-wallpaper-overview-ruler</sub> | ✅ 已实现<br><sub>🔍 待验证</sub><br><sub>`frontend/editor/src/theme.ts`、`macos/Sources/Lithe/Platform/MacOS/MonacoWorkbenchEditor.swift`、`macos/Experiments/Monaco/workbench.integration.ts`</sub> | 🧩 平台专属<br><sub>— 不适用</sub><br><sub>`windows/tauri/src/features/editor/engines/monaco/theme.ts`</sub> | Editor | 在 macOS 选择工作台背景并打开文本文件,分别关闭和打开右侧 Agent 面板,确认编辑器最右侧概览标尺不出现黑色竖条;关闭背景图后确认普通主题底色保持不变。运行真实 WebKit 工作台主题集成测试。Windows 不使用 macOS 原生工作台壁纸。 | |
7677
| 文本编辑 | **LSP 语义高亮**<br><sub>editor-semantic-highlighting</sub> | ✅ 已实现<br><sub>🔍 待验证</sub><br><sub>`macos/Sources/Lithe/Models/AppModel/AppModel+LanguageEditing.swift`、`macos/Sources/LitheLanguageIntelligenceModule/Runtime/LanguageServerSession.swift`、`frontend/editor/src/semantic-tokens.ts`</sub> | ✅ 已实现<br><sub>🔍 待验证</sub><br><sub>`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`</sub> | Editor / Language Tooling | 打开普通 Java 文件并等待 JDTLS 就绪,开启语义高亮,确认字段、方法等按协商图例上色;编辑、切换、关闭文档和重连服务器后不应用旧结果;服务器 refresh 后重新请求;关闭设置或大文件降级时保留基础语法高亮。 | Windows 复用 Core semanticTokens 和共享 fixture,修复 #675;Linux 上的适配器与模型测试不替代 Windows WebView2/JDTLS 实机验收。 |
7778
| 文本编辑 | **多行标签与标签导航**<br><sub>editor-multiline-tabs</sub> | ✅ 已实现<br><sub>🔍 待验证</sub><br><sub>`macos/Sources/Lithe/Views/Editor`</sub> | ✅ 已实现<br><sub>🔍 待验证</sub><br><sub>`windows/tauri/src/features/tabs`</sub> | Editor | 打开足够多文件触发多行标签,确认滚动、切换、关闭和活动文件保持。 | |
7879
| Markdown | **Markdown 预览与富文本渲染**<br><sub>markdown-rendering</sub> | ✅ 已实现<br><sub>🔍 待验证</sub><br><sub>`macos/Sources/Lithe/Views/Editor/MarkdownPreviewView.swift`、`macos/Sources/Lithe/Core/Ports/MarkdownRendering.swift`</sub> | ✅ 已实现<br><sub>🔍 待验证</sub><br><sub>`windows/tauri/src/features/editor/markdown`</sub> | Editor | 使用代码高亮、表格、Mermaid、链接和相对路径 fixture 对比渲染结果。 | |

‎frontend/editor/src/theme.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ export function defineWorkbenchTheme(input: WorkbenchThemeInput, palette: Syntax
4747
"editorOverviewRuler.wordHighlightTextForeground": "#00000000",
4848
};
4949
const surfaceColors: [keyof NonNullable<WorkbenchThemeInput["colors"]>, string[]][] = [
50+
// Monaco otherwise fills the right overview ruler from tokenizer defaults when the minimap is enabled.
5051
["background", ["editor.background", "editorGutter.background", "editorStickyScroll.background",
51-
"editorStickyScrollGutter.background", "minimap.background"]],
52+
"editorStickyScrollGutter.background", "minimap.background", "editorOverviewRuler.background"]],
5253
["cursor", ["editorCursor.foreground"]],
5354
["selection", ["editor.selectionBackground", "editor.inactiveSelectionBackground"]],
5455
["lineHighlight", ["editor.lineHighlightBackground"]],

‎macos/Experiments/Monaco/workbench.integration.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,14 @@ async function verify() {
393393
});
394394
const surface = editor.getDomNode()!;
395395
const backgroundColor = () => getComputedStyle(surface).backgroundColor.replace(/ /g, "");
396+
const overviewRulerBackground = () => getComputedStyle(surface)
397+
.getPropertyValue("--vscode-editorOverviewRuler-background").trim().replace(/ /g, "");
398+
const overviewRulerPixel = () => {
399+
editor.render();
400+
const canvas = surface.querySelector<HTMLCanvasElement>(".decorationsOverviewRuler")!;
401+
assert(canvas.width > 0 && canvas.height > 0, "overview ruler has no render surface");
402+
return [...canvas.getContext("2d")!.getImageData(Math.floor(canvas.width / 2), Math.floor(canvas.height / 2), 1, 1).data];
403+
};
396404
try {
397405
window.lithe.configure({
398406
fontFamily: "monospace", fontSize: 13, wrap: false, minimap: true,
@@ -403,6 +411,9 @@ async function verify() {
403411
const solid = backgroundColor();
404412
assert(["rgb(242,243,244)", "rgba(242,243,244,1)"].includes(solid),
405413
`host light theme did not replace Monaco's initial dark surface: ${solid}`);
414+
assert(overviewRulerBackground() === "#f2f3f4",
415+
`opaque overview ruler background did not match the editor surface: ${overviewRulerBackground()}`);
416+
assert(overviewRulerPixel().join() === "242,243,244,255", "solid overview ruler rendered with a different background");
406417
window.lithe.configure({
407418
fontFamily: "monospace", fontSize: 13, wrap: false, minimap: true,
408419
theme: { id: "probe-light-wallpaper", dark: false, colors: {
@@ -412,6 +423,9 @@ async function verify() {
412423
const transparent = backgroundColor();
413424
assert(transparent === "rgba(0,0,0,0)",
414425
`transparent Monaco surface still covered the native wallpaper: ${transparent}`);
426+
assert(overviewRulerBackground() === "rgba(0,0,0,0)",
427+
`overview ruler still covered the native wallpaper: ${overviewRulerBackground()}`);
428+
assert(overviewRulerPixel().join() === "0,0,0,0", "transparent overview ruler rendered an opaque strip");
415429
} finally {
416430
window.lithe.configure({ dark: false, fontFamily: "monospace", fontSize: 13, wrap: false, minimap: true });
417431
await window.lithe.retain([]);

‎shared/platform-feature-matrix.json‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,28 @@
460460
"owner": "Editor",
461461
"verification": "分别打开 Java、Markdown 和普通文本,确认语言识别、语法高亮和模型切换;开启缩略图并滚动,确认滚动条轨道不透出编辑器代码。"
462462
},
463+
{
464+
"id": "editor-wallpaper-overview-ruler",
465+
"area": "编辑器",
466+
"group": "编辑器外观",
467+
"capability": "macOS 工作台壁纸模式下,编辑器概览标尺与代码缩略图随编辑器背景透明,不显示黑色竖条;普通主题仍保持实体背景",
468+
"macos": {
469+
"implementationStatus": "implemented",
470+
"verificationStatus": "pending",
471+
"evidence": [
472+
"frontend/editor/src/theme.ts",
473+
"macos/Sources/Lithe/Platform/MacOS/MonacoWorkbenchEditor.swift",
474+
"macos/Experiments/Monaco/workbench.integration.ts"
475+
]
476+
},
477+
"windows": {
478+
"implementationStatus": "platform-specific",
479+
"verificationStatus": "not-applicable",
480+
"evidence": ["windows/tauri/src/features/editor/engines/monaco/theme.ts"]
481+
},
482+
"owner": "Editor",
483+
"verification": "在 macOS 选择工作台背景并打开文本文件,分别关闭和打开右侧 Agent 面板,确认编辑器最右侧概览标尺不出现黑色竖条;关闭背景图后确认普通主题底色保持不变。运行真实 WebKit 工作台主题集成测试。Windows 不使用 macOS 原生工作台壁纸。"
484+
},
463485
{
464486
"id": "editor-semantic-highlighting",
465487
"area": "编辑器",

0 commit comments

Comments
 (0)