2026-05-20 19:04:05 +08:00
|
|
|
|
# 12 Sidex / VSCode Workbench 对照审查 v1
|
|
|
|
|
|
|
|
|
|
|
|
> 状态:process
|
|
|
|
|
|
>
|
|
|
|
|
|
> 日期:2026-05-20
|
|
|
|
|
|
>
|
|
|
|
|
|
> 范围:`reference-code/sidex-main` 对照 MNote 当前主编辑区、资源 tab、File Tree、资源生命周期和 smoke 覆盖。
|
|
|
|
|
|
|
|
|
|
|
|
## 1. 审查方法
|
|
|
|
|
|
|
|
|
|
|
|
本轮使用 CodeGraph 与只读 subagent 并行审查,优先对照 `/mnt/Data1T/mnote/reference-code/sidex-main`,因为该目录包含较完整的 VSCode workbench 源码。`reference-code/vscode` 当前更像裁剪版快照,只作为辅助证据。
|
|
|
|
|
|
|
|
|
|
|
|
审查按功能切面展开:
|
|
|
|
|
|
|
|
|
|
|
|
- Editor / tab:`EditorService.openEditor`、`EditorGroupModel`、`EditorGroupView`、`MultiEditorTabsControl`、`OpenEditorsView`。
|
|
|
|
|
|
- Explorer / file actions:`ExplorerService`、`ExplorerView`、`fileActions`、`ResourceFileEdit` / `IBulkEditService`。
|
|
|
|
|
|
- MNote 对应链路:`mnote-web` 的 `web_shell.rs`、`layout.rs`、`tree.rs`、`local_folder_source.rs`、`resource_trash.rs`、`onlyoffice.rs`、`leptos-tiptap-spike`。
|
|
|
|
|
|
|
|
|
|
|
|
## 2. Sidex / VSCode 可借鉴模型
|
|
|
|
|
|
|
|
|
|
|
|
- Explorer 打开文件不是按 UI 分支散落处理,而是统一交给 `IEditorService.openEditor({ resource, options }, ACTIVE_GROUP / SIDE_GROUP)`。
|
|
|
|
|
|
- `EditorGroupModel` 是 tab/editor 列表真相层,维护 `editors`、`active`、`preview`、`sticky`、`transient`、MRU 和 selection,并发布 open / close / move / dirty / label 等模型事件。
|
|
|
|
|
|
- `EditorTitleControl` / `MultiEditorTabsControl` 只是消费模型做渲染、滚动、reveal active、DnD、右键菜单和 tab action,不承载资源事实。
|
|
|
|
|
|
- `OpenEditorsView` 监听 editor group model,与 active editor、visible editors、dirty/label 状态联动。
|
|
|
|
|
|
- Explorer 文件生命周期通过 `ResourceFileEdit` + `IBulkEditService` 聚合执行,并处理 dirty working copy、readonly、trash / permanent delete、undo label、cancel 和失败 fallback。
|
|
|
|
|
|
|
|
|
|
|
|
## 3. MNote 当前链路
|
|
|
|
|
|
|
|
|
|
|
|
- 主文档页由 `document_page_shell` 生成,SSR 初始只有固定 page tab、resource tab host 和可选 secondary pane。
|
|
|
|
|
|
- `resourceTabRegistry` 是浏览器内存 Map,`openResourceInActiveTab` 按 `objectIdentity` 去重并动态创建 tab/panel;关闭时直接 unmount、remove、delete。
|
|
|
|
|
|
- 文件树点击在 `layout.rs` 中分发:document / markdown 页面走 `navigateToDocument`,asset 触发 `tree.asset.open`;local office 可进 resource tab,Convex office 仍可能新窗口,mindmap 走独立 object shell。
|
|
|
|
|
|
- local_folder executor 已能处理 Markdown、目录、raw file 的 create / rename / copy / move / delete / restore / purge,但 filetree runtime 的打开目标模型和资源生命周期模型仍未完全对齐。
|
|
|
|
|
|
- resource lifecycle 仍散在 tree command、resource_trash 兼容 route、layout 内联 JS 多条路径。
|
|
|
|
|
|
|
|
|
|
|
|
## 4. P0 缺口
|
|
|
|
|
|
|
|
|
|
|
|
### P0-1 统一 editor input / editor group / active editor 模型缺失
|
|
|
|
|
|
|
|
|
|
|
|
MNote 当前 page、secondary pane、resource tab、mindmap shell、OnlyOffice 新窗口分别走不同状态链。`resourceTabRegistry` 只存在于页面内存,不能被 Sidebar、Open Editors、快捷键、持久化恢复或 watcher 统一消费。
|
|
|
|
|
|
|
|
|
|
|
|
建议:先实现 MNote 轻量版 `EditorInput` / `EditorGroupState`,只覆盖 active group 内的 page/resource editor,不照搬 VSCode 完整 DI 和多 group grid。
|
|
|
|
|
|
|
|
|
|
|
|
### P0-2 resource tab 关闭缺少 dirty / saving / conflict 防护
|
|
|
|
|
|
|
|
|
|
|
|
`closeResourceTab` 直接释放 view/session 并移除 DOM,但同一文件中已经存在 `session.dirty`、`saving`、`hasExternalConflict` 等状态。关闭脏资源、保存中资源或外部冲突资源需要最小防护。
|
|
|
|
|
|
|
|
|
|
|
|
建议:关闭前先检查 session 状态;脏资源优先触发保存或阻止关闭并给出确认;保存中/冲突状态不能静默释放。
|
|
|
|
|
|
|
|
|
|
|
|
### P0-3 资源打开策略不一致
|
|
|
|
|
|
|
|
|
|
|
|
local office 可进入主编辑区 tab,Convex office 仍可能新窗口;mindmap 总是 object shell;部分非本页 code/text attachment 会 `window.open`。这和“默认主编辑区 tab,显式新窗口例外”的当前目标不一致。
|
|
|
|
|
|
|
|
|
|
|
|
建议:引入统一 `openResourceEditor(input, target)`,把 `active-tab`、`side`、`new-window` 作为显式目标,并把 resource kind 解析集中在 resolver。
|
|
|
|
|
|
|
|
|
|
|
|
### P0-4 File Tree 打开目标与资源生命周期模型不对齐
|
|
|
|
|
|
|
|
|
|
|
|
`filetree_runtime::OpenTarget` 只能表达 document / index / asset / asset-folder,不能完整表达 raw local file、directory、arbitrary resource;但 local_folder executor 已支持 raw file / directory lifecycle。
|
|
|
|
|
|
|
|
|
|
|
|
建议:扩展 open target / resource identity 合同,至少能稳定表达 `local_file`、`directory`、`mindmap`、`table`、`office`、`image` 等资源类型。
|
|
|
|
|
|
|
|
|
|
|
|
### P0-5 resource lifecycle 仍多入口分散
|
|
|
|
|
|
|
|
|
|
|
|
资源删除/恢复/永久删除仍由 tree command、resource_trash route、layout 内联 JS 分流处理。云端 asset、mindmap、table、本地 raw file 的路径不完全统一,容易造成垃圾箱、刷新、tab 状态不同步。
|
|
|
|
|
|
|
|
|
|
|
|
建议:继续推进 `tree.resource.*` cutover,旧 URL 只作为兼容 alias;前端也应逐步走统一 resource command client。
|
|
|
|
|
|
|
|
|
|
|
|
## 5. P1 缺口
|
|
|
|
|
|
|
|
|
|
|
|
- local_folder `move` 丢弃 `sortOrder`,拖拽排序与持久顺序语义不闭环。
|
|
|
|
|
|
- resource tab active 状态只改 DOM,不同步 URL、sidebar active row、可恢复状态。
|
|
|
|
|
|
- tab identity 混用 `objectIdentity / assetId / href / resource:file:<rootUri>:<path>`,需要 canonical resource identity。
|
|
|
|
|
|
- mindmap 仍是独立 object shell,不是 main editor group 内的 editor kind。
|
|
|
|
|
|
- secondary pane 与 main tab 是两套概念;长期应映射为 side target / side group 语义。
|
|
|
|
|
|
- delete 缺少 dirty / readonly / undo / fallback 统一动作层。
|
|
|
|
|
|
- paste / right-click paste 目标模型不完整;外部 drop 对二进制文件支持不足。
|
|
|
|
|
|
- smoke 偏“资源存在 / 不闪烁”,缺少 editor workbench 语义断言。
|
|
|
|
|
|
|
|
|
|
|
|
## 6. P2 缺口
|
|
|
|
|
|
|
|
|
|
|
|
- tab strip 缺少键盘 roving tabindex、左右切换、关闭快捷键、MRU 回退。
|
|
|
|
|
|
- tab overflow / reveal active / multi-row / context menu / close others 等能力较弱。
|
|
|
|
|
|
- `.txt` / `.json` / `.ts` / PDF / image 等类型 smoke 矩阵不完整。
|
|
|
|
|
|
- PDF badge 当前与 ppt 复用,资源类型与显示颜色语义应拆开。
|
|
|
|
|
|
- File Tree 上下文菜单仍有英文和禁用项暴露实现缺口。
|
|
|
|
|
|
- trash modal 与 resource command 仍是并行入口,需要继续收口到统一资源生命周期视图。
|
|
|
|
|
|
|
|
|
|
|
|
## 7. 不建议照搬
|
|
|
|
|
|
|
|
|
|
|
|
- 不照搬 Sidex / VSCode 的 DI service 容器。
|
|
|
|
|
|
- 不照搬完整多 editor group grid;MNote 当前只需要 active tab + side target 的轻量模型。
|
|
|
|
|
|
- 不照搬 Monaco / TextModel 作为 Markdown 文档事实源;MNote 主编辑仍是 tiptap / Page Aggregate / local Markdown。
|
|
|
|
|
|
- 不照搬 Extension Host、ContextKey 全体系和完整 UndoRedoSource。
|
|
|
|
|
|
- 不把参考项目 UI 层状态当成 MNote 的新事实源;MNote 的树、资源归属、生命周期仍以 Rust kernel / local-first 合同为准。
|
|
|
|
|
|
|
|
|
|
|
|
## 8. 执行拆分
|
|
|
|
|
|
|
|
|
|
|
|
本 review 拆分为三份执行 checklist:
|
|
|
|
|
|
|
|
|
|
|
|
- `design/05-editor-mainline/process/5-16-editor-group-resource-tab-safety-checklist-v1.md`
|
|
|
|
|
|
- `design/04-tree-domain/process/4-38-filetree-resource-lifecycle-open-target-checklist-v1.md`
|
|
|
|
|
|
- `design/05-editor-mainline/process/5-17-resource-editor-kind-and-smoke-matrix-checklist-v1.md`
|
2026-05-20 20:13:24 +08:00
|
|
|
|
|
|
|
|
|
|
第二轮 P0 收口继续拆为四份独立 checklist:
|
|
|
|
|
|
|
|
|
|
|
|
- `design/05-editor-mainline/process/5-18-main-editor-tab-state-and-error-placeholder-checklist-v1.md`
|
|
|
|
|
|
- `design/05-editor-mainline/process/5-19-resource-open-resolver-and-onlyoffice-checklist-v1.md`
|
|
|
|
|
|
- `design/04-tree-domain/process/4-39-filetree-open-target-resource-identity-checklist-v1.md`
|
|
|
|
|
|
- `design/04-tree-domain/process/4-40-resource-lifecycle-command-cutover-smoke-checklist-v1.md`
|