From df567c2aa57182edc4d5d1e748676523650717f4 Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Mon, 16 Nov 2026 16:06:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(desktop):=20Core=20=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E5=88=B0=20c0dd2a4=EF=BC=8CUnix=20=E6=96=87=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=E9=87=8C=E7=9A=84=E5=8F=8D=E6=96=9C=E6=9D=A0=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E8=AE=A9=E9=A1=B9=E7=9B=AE=E6=A0=91=E6=8A=A5=E9=94=99=20(#2009?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit macOS 上按 Windows 写法配置的 Spring Boot 日志路径 D:\logs 会在项目里创建 一个名字就叫 D:\logs 的文件夹。Core 原来不分平台地把 \ 当成分隔符,把它报成 D:/logs,项目树行校验发现它不在根目录下,整棵树报 workspace.projectTree.rows 的 "A project tree node is not in the folder above it"。 - PINNED_CORE_REVISION 升到 Lithe-core-rust #62 的 c0dd2a4(基于 main 6a14126):路径规则统一进 lithe-platform,Unix 上 \ 和 : 是文件名的一部分, Windows 不变。#62 合入后改为 main 上的 commit。 - 新增 TestProjectTreeShowsUnixNamesWithBackslashes:真实 Core 打开含 D:\logs/spring.log 和 D:\logs\app.log 的目录,断言行的层级和顺序且没有通知; 旧固定版本下它报出与 Issue 相同的通知。Windows 上跳过。 - 功能矩阵 file-explorer 的 verification 记录这次修复。 Closes #2009 --- desktop/internal/workbench/filetree_test.go | 32 +++++++++++++++++++ scripts/desktop/build-desktop-core.sh | 5 ++- .../features/file-explorer.json | 2 +- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/desktop/internal/workbench/filetree_test.go b/desktop/internal/workbench/filetree_test.go index aaf134ff19..b7b1966620 100644 --- a/desktop/internal/workbench/filetree_test.go +++ b/desktop/internal/workbench/filetree_test.go @@ -495,6 +495,38 @@ func TestProjectTreeBatchSelectionFollowsCore(t *testing.T) { } } +// TestProjectTreeShowsUnixNamesWithBackslashes is #2009: on macOS and Linux a backslash is part +// of a file name, as in the folder `D:\logs` that Spring Boot creates for a Windows-style +// `logging.file.path`. Core used to report it as `D:/logs`, two levels deep, so the rows of the +// tree failed with "A project tree node is not in the folder above it" and the tree stayed empty. +func TestProjectTreeShowsUnixNamesWithBackslashes(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("a backslash separates the folders of a path on Windows") + } + root := t.TempDir() + writeTreeFiles(t, root, `D:\logs/spring.log`, `D:\logs\app.log`) + h := newHarness(t, &testKernel{Client: core.NewClient()}) + p := h.openTree(t, root) + folder := p.tree.find(`D:\logs`) + if folder == nil { + t.Fatalf("the root lists no folder named D:\\logs; notifications %q", noticeTexts(h.app)) + } + h.app.toggleFolder(p, folder) + awaitDocumentState(t, h, func() bool { return folder.listed && p.tree.find(`D:\logs/spring.log`) != nil }) + h.settle() + + var rows []string + for _, row := range p.tree.rows { + rows = append(rows, row.path) + } + if want := []string{"", `D:\logs`, `D:\logs/spring.log`, `D:\logs\app.log`}; !slices.Equal(rows, want) { + t.Fatalf("rows = %q, want %q", rows, want) + } + if notices := noticeTexts(h.app); len(notices) != 0 { + t.Fatalf("the tree reported %q", notices) + } +} + func TestChangeListRowSelectionFollowsCore(t *testing.T) { h := newHarness(t, &testKernel{Client: core.NewClient()}) p := &project{} diff --git a/scripts/desktop/build-desktop-core.sh b/scripts/desktop/build-desktop-core.sh index c01e82531c..86042afbe5 100755 --- a/scripts/desktop/build-desktop-core.sh +++ b/scripts/desktop/build-desktop-core.sh @@ -27,6 +27,9 @@ native_path() { fi } +# Lithe-core-rust #62, not merged yet: commit c0dd2a4 of branch fix/2009-unix-backslash-file-names, +# on top of main 6a14126. A backslash or colon in a Unix file name stays part of the name, so a +# folder named D:\logs is one level below the project root and the project tree rows accept it (#2009). # Lithe-core-rust #61, squash-merged into main as 6a14126: the LSP engine keeps a session's hover # answers, so resting on a symbol again answers without asking the server (#1995). It is on top of # #60, squash-merged into main as ca80599: language-server indexing exclusions ask Git once per @@ -122,7 +125,7 @@ PINNED_CORE_REPOSITORY="https://github.com/Lithe-IDEA/Lithe-core-rust.git" # the contract, plugin guides, reference and SDKs live only in shared/plugins; on top of #16 (reported Git queries folded in the console), # #15 (git.write cherryPick, revert and reset fields), #14 (word-level changed ranges of diff # rows), #13, #8, #7, #6 and #4. -PINNED_CORE_REVISION="6a1412635557fcd37766faafbf2fccd4a68dc7db" +PINNED_CORE_REVISION="c0dd2a42ff1baf9d6619d511465f52ac768acbd6" PROFILE="debug" while [[ $# -gt 0 ]]; do case "$1" in diff --git a/shared/platform-feature-matrix/features/file-explorer.json b/shared/platform-feature-matrix/features/file-explorer.json index a255c5394f..e7b32e6f4b 100644 --- a/shared/platform-feature-matrix/features/file-explorer.json +++ b/shared/platform-feature-matrix/features/file-explorer.json @@ -36,7 +36,7 @@ ] }, "owner": "Workspace", - "verification": "macOS 和 Windows 无头测试覆盖目录选择、展开、键盘、虚拟绘制、长文件名滚动、外部新增删除、空目录变化、超过 128 个目录、隐藏路径过滤、视口锚定、过期读取以及与搜索共享监听的关闭和重试;真实 Core 测试覆盖共享自然排序样例及 Python 隐藏路径。运行 scripts/desktop/desktop-go.sh test -race ./internal/workbench -run 'TestProjectTree|TestProjectSearch|TestEverywhere' -count=3 和 scripts/desktop/desktop-go.sh test -race ./internal/core -run TestWorkspaceDirectory -count=3。完整文件树和原生窗口行为仍待验收。 标题栏按钮:运行 scripts/desktop/desktop-go.sh test ./internal/workbench -run 'TestProjectTree(Locate|ExpandsAndCollapses|ExpandAll|Refresh)' -count=1 和 scripts/desktop/desktop-go.sh test ./internal/treelist -count=1;实机打开深层文件后折叠祖先,点击定位确认展开、选中并滚动到中间,键盘焦点在该行;在超过 512 个目录的项目中全部展开出现提示;删除并恢复项目根目录后点击刷新恢复树。", + "verification": "macOS 和 Windows 无头测试覆盖目录选择、展开、键盘、虚拟绘制、长文件名滚动、外部新增删除、空目录变化、超过 128 个目录、隐藏路径过滤、视口锚定、过期读取以及与搜索共享监听的关闭和重试;真实 Core 测试覆盖共享自然排序样例及 Python 隐藏路径。运行 scripts/desktop/desktop-go.sh test -race ./internal/workbench -run 'TestProjectTree|TestProjectSearch|TestEverywhere' -count=3 和 scripts/desktop/desktop-go.sh test -race ./internal/core -run TestWorkspaceDirectory -count=3。完整文件树和原生窗口行为仍待验收。 标题栏按钮:运行 scripts/desktop/desktop-go.sh test ./internal/workbench -run 'TestProjectTree(Locate|ExpandsAndCollapses|ExpandAll|Refresh)' -count=1 和 scripts/desktop/desktop-go.sh test ./internal/treelist -count=1;实机打开深层文件后折叠祖先,点击定位确认展开、选中并滚动到中间,键盘焦点在该行;在超过 512 个目录的项目中全部展开出现提示;删除并恢复项目根目录后点击刷新恢复树。 Unix 文件名里的反斜杠(2026-11-16,#2009,Lithe-core-rust #62):macOS 和 Linux 上 \\ 与 : 是文件名的一部分。Spring Boot 按 Windows 写法配置 logging.file.path: D:\\logs 后在项目里建出的 D:\\logs 目录,显示为根目录下的一个文件夹,展开后列出其中的文件,不再报 workspace.projectTree.rows 的“A project tree node is not in the folder above it”而让项目树为空;Windows 上 \\ 仍是分隔符,行为不变。运行 scripts/desktop/desktop-go.sh test ./internal/workbench -run TestProjectTreeShowsUnixNamesWithBackslashes -count=1(Windows 上跳过);原生窗口验收待做。", "notes": "Viva 接入 Core 按需列目录、单选、方向键及虚拟绘制;项目根节点(包括空项目)可显示和选择,树行尺寸与展开图标参照旧版,批量列目录失败只记录一次宿主错误;新增根节点和失败日志回归仅在 macOS 验证,Windows 待重跑。2026-11-14 起可见行、选择修正、视口顶端行和多选由 Core 计算(workspace.projectTree.rows、workspace.rowSelection.reduce,#1800),树的形状变化时才调用,缩放和重绘不调用;Viva 日志生成与使用门禁跟踪 #1802。macOS 和 Windows 用一个项目级递归监听,供项目树和搜索共用,事件经 Core 过滤,重读保持节点及视口锚点。Linux 暂用最多 128 个按需目录监听,超限提示。多选、批量移动、上下文菜单、完整旧版增量行为与平台差异仍需迁移,macOS 和 Windows 原生窗口、逐像素对照及大项目性能均待验收。 Project 标题栏有定位当前文件、刷新、全部展开、全部折叠四个按钮:定位逐级列出并展开祖先目录后选中、居中并聚焦目标行,路径不可见时放弃并记录 operation_rejected;刷新重读已展开目录,根目录读取失败时重新监听并读取;全部展开按广度优先最多打开 512 个目录,超出时提示;全部折叠保留根目录,被隐藏的选择移到其所在的顶层目录。项目树是 Viva 的 ui.Tree(只声明可见行,RowWidth 使行等宽于最长名称以横向滚动),行尺寸与文字色取自 desktop/internal/treelist,Git Log 改动文件共用。方向键只移动焦点环,选中行跟随点击、Enter 与箭头,待 Viva 提供 TreeState.RowID 后改为跟随焦点。", "legacy": { "revision": "5a54c41aa37a4e6e6b68918a4b05765b9dd07a36",