feat(sidebar): 菜单层级/性能 + 选中条吸底 + 打包进度 + 修复「在侧边打开」
用户实测反馈 5 条:
1) 文件列表性能 / 右键菜单不再刷屏(先测量后改,探针 tests/file-tree-menu-perf.spec.tsx)
- 宿主应用列表按路径缓存:N 次打开菜单只请求 1 次(原每次 1 次 + Loading 帧)
- 行上的 git 数据改为原始值(tone/letter):共享 store 每次轮询重建对象不再触达行
(探针:开窗 folderIcons 4 → 0;root 行也 memo 化)
- 菜单开关不触发目录重列(fsTree=0);实测「菜单打开期间暂停轮询」会让变更行瞬时
掉色并多两次重渲染,故按测量结果放弃该做法(数字与理由写进探针注释)
2) 「已选择 N 项」条移到底部:滚动容器最后一个内容子节点 + sticky bottom(不遮最后
一行),窄栏 flex-wrap 换行不出横向滚动条
3) 菜单层级重构:一级只留默认动作(宿主默认应用 / 打开方式 ▸ / 在文件管理器中显示 /
新 Tab / 在侧边打开 / 下载 / 压缩并下载 / 复制路径 / 重命名 / 删除;目录行另有
新建文件夹、上传到此处),应用列表整体收进「打开方式」子菜单;宿主探测到本机关联
应用时默认不显示插件自研 open-with 项目,新增设置开关 openWithPluginTargets
(editor descriptor 的 pluginToggles)可强制并存;宿主不可用时插件项目照旧
4) 压缩并下载显示进度:宿主改为可观测任务(archive.build / archive.status /
/sidebar/archive?id=,4 并发 + 5 分钟 TTL + sessionId 绑定,buildZip 逐条目
onProgress),客户端轮询 250ms 显示「正在打包 done/total · N%」,ready 后 blob 下载,
失败进 zipFailed
5) 修复「在侧边打开没有效果」:根因是它只写插件底部工作台(原生右侧栏的 tab 不在
bottomSplits 里),现按承载面分流 —— 原生 tab 走 service.openTab(target:'side') →
宿主 openResource(preferNewPane, revealIfOpened:false) 真正分栏;底部工作台行为不变
(接入 API 变更已同步 docs/external-plugin-guide.md)
验证:typecheck / lint / test(135 文件 1461 通过)/ build 全绿;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.1.7-rc.1 dsh' pnpm test:mount 7/7 通过;
新增/更新测试:menu-perf(3)、archive(10)、open-in-app(18)、open-with(10)、multiselect(9)、
zip(37)、service(64)、editor-host(11)、builtins(23)、locales(20)
This commit is contained in:
1 parent
13d4bae321
commit
ee1fe05067
41 files changed
+2228
-597
No files matched your search
@@ -145,6 +145,9 @@ export function EditorHost(props: {
|
||||
// target list, a URL vocabulary or a spawn route — the host reports which
|
||||
// applications are actually installed for THIS path.
|
||||
const openInApp = useMemo(() => createOpenInApp(ctx), [ctx])
|
||||
// The plugin's own service (native-tab opens, "open to the side"): absent in
|
||||
// stripped-down hosts, where every flow degrades to the bottom workbench.
|
||||
const service = ctx.get('betterSidebar')
|
||||
// The file tree's "open with" configuration (pluginSettings['editor']): a
|
||||
// blob subscription, so a pin click or a settings-page edit re-renders the
|
||||
// menu immediately. The parsed config also drives which targets are shown
|
||||
@@ -155,6 +158,11 @@ export function EditorHost(props: {
|
||||
)
|
||||
const openWithConfig = useMemo(() => parseOpenWithConfig(editorBlob.openWith), [editorBlob])
|
||||
const openWithTargets = useMemo(() => resolveOpenWithTargets(openWithConfig), [openWithConfig])
|
||||
// The declarative "always show the plugin's own targets" switch (the editor
|
||||
// card's pluginToggles row): a plain boolean on the SAME blob, so both the
|
||||
// settings page and the tree's menu see one value. Absent/false keeps the
|
||||
// host-first behavior (the tree decides what to hide).
|
||||
const openWithShowPluginTargets = editorBlob.openWithPluginTargets === true
|
||||
// A path-less tab shows the empty-state hint in merged mode — and in split
|
||||
// mode it is the standalone explorer (tree-only, see the render below). A
|
||||
// folder tab is a folder window in BOTH modes: the tree rooted at the
|
||||
@@ -185,8 +193,22 @@ export function EditorHost(props: {
|
||||
* The context menu's "open to the side": a fresh editor tab (uid id — the
|
||||
* `'editor:' + path` convention would clash with the id safety net on a
|
||||
* second side-open of the same file) in a rightward split of THIS pane.
|
||||
*
|
||||
* Native right-Sidebar tabs do NOT live in `bottomSplits`, so the bottom
|
||||
* branch would fall through to `firstLeaf` — a pane the user has not
|
||||
* expanded, i.e. "nothing happened". Those tabs instead ask the host for a
|
||||
* second pane through the service (`target: 'side'` → the host's
|
||||
* `preferNewPane`), which is the same gesture in the surface the user is
|
||||
* actually looking at.
|
||||
*/
|
||||
const openFileSide = (absolute: string): void => {
|
||||
// `store.tabOpen` answers from THIS session's own state map — the bottom
|
||||
// workbench's splits. A natively-hosted tab (right Sidebar) is absent
|
||||
// from them even while it is on screen.
|
||||
if (service !== undefined && !store.tabOpen(scope.sessionId, tab.id)) {
|
||||
service.openTab({ type: 'editor', path: absolute, target: 'side' }, scope)
|
||||
return
|
||||
}
|
||||
store.reduce((state) => {
|
||||
const pane = leafWithTab(state.bottomSplits, tab.id) ?? firstLeaf(state.bottomSplits)
|
||||
const fresh: SidebarTab = {
|
||||
@@ -405,6 +427,7 @@ export function EditorHost(props: {
|
||||
onOpenFileNewTab={openFileNewTab}
|
||||
onOpenFileSide={openFileSide}
|
||||
openInApp={openInApp}
|
||||
openWithShowPluginTargets={openWithShowPluginTargets}
|
||||
openWithTargets={openWithTargets}
|
||||
openWithPinned={openWithConfig.pinned}
|
||||
openWithSsh={openWithSshActive(openWithConfig)}
|
||||
@@ -532,6 +555,7 @@ export function EditorHost(props: {
|
||||
onOpenFileNewTab={openFileNewTab}
|
||||
onOpenFileSide={openFileSide}
|
||||
openInApp={openInApp}
|
||||
openWithShowPluginTargets={openWithShowPluginTargets}
|
||||
openWithTargets={openWithTargets}
|
||||
openWithPinned={openWithConfig.pinned}
|
||||
openWithSsh={openWithSshActive(openWithConfig)}
|
||||
|
||||
Reference in new issue
Block a user