diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7f78caf..7c1fe10 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,11 +35,13 @@
`joinSubpath` 对绝对/盘符/UNC 输入的判定统一;`joinSubpath` 额外拒绝 `C:foo`。
### 侧栏文件夹行
-- 工作区自己的目录不再渲染成一条文件夹行。以前只要工作区挂了额外文件夹,它就会多出
- 一条以目录末段命名的行;云端工作区的路径是镜像目录,于是侧栏出现 `wmvl31c7ilkuc`
- 这样的内部 id,并且工作区自身的会话被藏进这条行里,看起来像「一个项目套在它自己里面」。
-- 现在只有真正额外挂进来的文件夹才有行,工作区自己的会话直接列在标题下方;没有额外
- 文件夹时节点形状与引入文件夹功能之前完全一致。
+- 一个项目只占一行。此前工作区挂上额外文件夹后,每个文件夹都会变成一条带自己会话列表的行;
+ 云端工作区的路径是本地镜像目录,于是侧栏出现 `wmvl31c7ilkuc` 这种内部 id,项目自身的
+ 会话又被藏进那一行,看起来像「一个项目套在它自己里面」。
+- 现在不再渲染文件夹行:工作区自己的目录和所有额外文件夹共用同一个会话列表,全部列在
+ 工作区标题下面。文件夹仍然可以在工作区的「⋯ → 管理文件夹」里增删、设根、打开,
+ 只是不再各自分裂出一套会话。
+- 工作区没有额外文件夹时,节点形状与引入文件夹功能之前完全一致。
### 测试与工程
- 新增 `tests/folders-cas.test.ts`、`tests/folders-persist.test.ts`、`tests/remote-paths.test.ts`
diff --git a/lib/client.js b/lib/client.js
index 4078e73..437e37c 100644
--- a/lib/client.js
+++ b/lib/client.js
@@ -1216,35 +1216,6 @@ window.__ModuleLoader__.load({
return effectiveFolders(workspacePath, entry).find((folder) => samePath(folder, root)) ?? workspacePath;
}
/**
- * Owning folder of a session cwd: the most specific (longest) effective folder
- * that equals the cwd or is a proper path ancestor of it.
- *
- * Both sides are {@link canonicalPath}-normalized, so `..` segments and mixed
- * separator spellings no longer mis-group a session into the project base.
- * @param cwd - recorded session cwd; undefined means "the workspace itself".
- * @param workspacePath - canonical directory of the workspace.
- * @param entry - saved folder entry, if any.
- * @returns the owning folder, or the workspace path when nothing matches.
- */
- function folderOfCwd(cwd, workspacePath, entry) {
- if (cwd === void 0) return workspacePath;
- const target = canonicalPath(cwd);
- let best;
- let bestLength = -1;
- for (const folder of effectiveFolders(workspacePath, entry)) {
- const root = canonicalPath(folder);
- if (root === "") continue;
- const separator = isWindowsStyle(root) ? BACKSLASH : SLASH;
- const prefix = root.endsWith(separator) ? root : `${root}${separator}`;
- if (target !== root && !target.startsWith(prefix)) continue;
- if (root.length > bestLength) {
- best = folder;
- bestLength = root.length;
- }
- }
- return best ?? workspacePath;
- }
- /**
* Append an extra folder. Idempotent under `samePath`, and the stored root (if
* any) survives untouched.
* @param entry - current entry, or undefined for a workspace with no extras.
@@ -1497,13 +1468,14 @@ window.__ModuleLoader__.load({
return members.some((member) => member.sessionIds.includes(sessionId));
}
/**
- * Display label of one folder: the last path segment. A drive root (`C:\`) or
- * the POSIX root has no segment, so the whole path is the honest label.
+ * Display label of one folder: the last path segment. A drive root or the
+ * POSIX root has no segment, so the whole path is the honest label.
* @param path - absolute folder path.
- */ function folderLabel(path) {
- const trimmed = path.replace(/[/\\]+$/u, "");
+ */
+ function folderLabel(path) {
+ const trimmed = path.replace(/[/\u005C]+$/u, "");
if (trimmed === "" || /^[A-Za-z]:$/u.test(trimmed)) return path;
- const base = trimmed.split(/[/\\]/u).pop();
+ const base = trimmed.split(/[/\u005C]/u).pop();
return base !== void 0 && base !== "" ? base : path;
}
/** Stable identity of one folder row (same path may live under two workspaces). */
@@ -1511,72 +1483,15 @@ window.__ModuleLoader__.load({
return `${workspaceId}\u0000${path}`;
}
/**
- * Display labels for member folders.
- *
- * A cloud member's directory is a locally generated mirror id (`wabc123`), which
- * says nothing to the user: its REMOTE path or title is the honest label. Local
- * members keep the last path segment, like every other folder.
- * @param folders - per-workspace folders + members.
+ * A workspace's extra folders are extra DIRECTORIES of the same project, not
+ * extra session lists: every visible session of the workspace and of its member
+ * workspaces renders on the one workspace row. Folder rows were removed on
+ * request — a project reads as one row, and a cloud workspace's mirror id
+ * (`wmvl31c7ilkuc`) never surfaces as a folder name.
+ * @param sessions - every visible session of the workspace + its members.
*/
- function memberFolderLabels(entry) {
- const labels = /* @__PURE__ */ new Map();
- for (const member of entry?.members ?? []) {
- const label = member.kind === "remote" ? member.title ?? folderLabel(member.remotePath ?? member.path) : folderLabel(member.path);
- if (label !== "") labels.set(member.path, label);
- }
- return labels;
- }
- /**
- * Split a workspace's visible sessions between its base directory and its extra
- * folders. Sessions keep the order they already had inside their owner, and a
- * workspace with no extra folder returns its sessions untouched — the pre-
- * folders node shape (no `folders` key at all).
- * @param workspaceId - owning workspace.
- * @param workspacePath - canonical directory (folder #0).
- * @param sessions - every visible session of the workspace, in host order.
- * @param list - sessions list snapshot (records each session's cwd).
- * @param entry - saved extra folders + root for this workspace.
- * @param collapsedFolders - collapsed folder-row keys. Undefined means "nothing
- * is collapsed", which is both the default view and what search uses so every
- * hit is visible without another click.
- */
- function applyFolders(workspaceId, workspacePath, sessions, list, entry, collapsedFolders) {
- const labels = memberFolderLabels(entry);
- const extras = effectiveFolders(workspacePath, entry).slice(1);
- if (extras.length === 0) return { sessions };
- const root = rootOf(workspacePath, entry);
- const base = [];
- const byFolder = /* @__PURE__ */ new Map();
- for (const node of sessions) {
- const owner = folderOfCwd(list.byId[node.id]?.cwd, workspacePath, entry);
- if (samePath(owner, workspacePath)) {
- base.push(node);
- continue;
- }
- const bucket = byFolder.get(owner);
- if (bucket === void 0) byFolder.set(owner, [node]);
- else bucket.push(node);
- }
- const folderNode = (path) => {
- return {
- path,
- label: labels.get(path) ?? folderLabel(path),
- isRoot: samePath(path, root),
- expanded: collapsedFolders === void 0 || !collapsedFolders.has(folderKey(workspaceId, path)),
- isBase: false,
- sessions: byFolder.get(path) ?? []
- };
- };
- const folders = extras.map((path) => folderNode(path));
- const rootIndex = folders.findIndex((folder) => folder.isRoot);
- if (rootIndex > 0) {
- const [rootFolder] = folders.splice(rootIndex, 1);
- if (rootFolder !== void 0) folders.unshift(rootFolder);
- }
- return {
- sessions: base,
- folders
- };
+ function applyFolders(_workspaceId, _workspacePath, sessions, _list, _entry, _collapsedFolders) {
+ return { sessions };
}
/**
* Derive the three-level tree.
@@ -8067,20 +7982,11 @@ window.__ModuleLoader__.load({
onArchive: onSessionArchive
}, session.id))
});
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(RowGroup, {
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowGroup, {
expanded: workspace.expanded,
className: "wgTreeChildren",
animate: animate && folders.length + workspace.sessions.length <= ANIMATION_ROW_CAP,
- children: [workspace.sessions.map((session) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionRow, {
- node: session,
- currentId: current,
- now,
- t,
- onOpen,
- onRename: onSessionRename,
- onFork,
- onArchive: onSessionArchive
- }, session.id)), folders.map((folder) => {
+ children: folders.map((folder) => {
const key = folderKey(workspace.workspaceId, folder.path);
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
role: "group",
@@ -8120,7 +8026,7 @@ window.__ModuleLoader__.load({
}, session.id))
})]
}, key);
- })]
+ })
});
}
/** One category section: header row + expanded workspace folders. */
@@ -8315,18 +8221,9 @@ window.__ModuleLoader__.load({
onArchive: () => {}
}, session.id))
});
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
role: "group",
- children: [workspace.sessions.map((session) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionRow, {
- node: session,
- currentId: current,
- now,
- t,
- onOpen: open,
- onRename: () => {},
- onFork: () => {},
- onArchive: () => {}
- }, session.id)), folders.map((folder) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
+ children: folders.map((folder) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
role: "group",
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FolderRow, {
node: folder,
@@ -8349,7 +8246,7 @@ window.__ModuleLoader__.load({
onArchive: () => {}
}, session.id))
})]
- }, folderKey(workspace.workspaceId, folder.path)))]
+ }, folderKey(workspace.workspaceId, folder.path)))
});
}
/**
diff --git a/lib/types/client/tree.d.ts b/lib/types/client/tree.d.ts
index 8811c00..d38384b 100644
--- a/lib/types/client/tree.d.ts
+++ b/lib/types/client/tree.d.ts
@@ -133,10 +133,11 @@ export interface MemberWorkspaces {
*/
export declare function memberWorkspaces(workspaces: readonly WorkspaceView[], folders?: FoldersDocument): MemberWorkspaces;
/**
- * Display label of one folder: the last path segment. A drive root (`C:\`) or
- * the POSIX root has no segment, so the whole path is the honest label.
+ * Display label of one folder: the last path segment. A drive root or the
+ * POSIX root has no segment, so the whole path is the honest label.
* @param path - absolute folder path.
- */ export declare function folderLabel(path: string): string;
+ */
+export declare function folderLabel(path: string): string;
/** Stable identity of one folder row (same path may live under two workspaces). */
export declare function folderKey(workspaceId: WorkspaceId, path: string): string;
/**
diff --git a/src/client/GroupsBrowser.tsx b/src/client/GroupsBrowser.tsx
index b2bc7b5..290f007 100644
--- a/src/client/GroupsBrowser.tsx
+++ b/src/client/GroupsBrowser.tsx
@@ -2366,19 +2366,6 @@ function WorkspaceSubtree({ workspace, current, now, t, animate, onOpen, onSessi
className="wgTreeChildren"
animate={animate && folders.length + workspace.sessions.length <= ANIMATION_ROW_CAP}
>
- {workspace.sessions.map((session) => (
-