From 9048dbe42d06c4c06a7b8b9dea20ef462a44bad7 Mon Sep 17 00:00:00 2001 From: HuanLinOTO Date: Mon, 24 Aug 2026 18:04:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20revealInExplorer=20=E6=8A=98=E5=8F=A0?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=97=B6=E8=87=AA=E5=8A=A8=E5=B1=95=E5=BC=80?= =?UTF-8?q?=EF=BC=88Copilot=20review=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit type-only openTab 按契约永不展开面板,折叠侧栏下 show-in-folder 揭示高亮不可见。 遵循 subagent 自动打开的既有模式:面板折叠则展开,activePane 钉到右侧首叶, 再 openTab 聚焦文件窗口。 --- src/client/intercept.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/client/intercept.tsx b/src/client/intercept.tsx index 05385ac..68b7d37 100644 --- a/src/client/intercept.tsx +++ b/src/client/intercept.tsx @@ -8,7 +8,7 @@ */ import { IconCodeOutline16 } from '@deepseek-ai/dsh-client-ui-primitives' import type { Context } from '../context-types.ts' -import { revealPaths, type SidebarStore } from './state.ts' +import { firstLeaf, revealPaths, togglePanel, type SidebarStore } from './state.ts' import { t } from './locales.ts' import { resolveSidebarPath, selectProducedFiles } from './produced-files.ts' import { wrapOpenPath } from './openpath-intercept.ts' @@ -48,8 +48,17 @@ export function revealInExplorer( const cwd = summary?.cwd const targets = files.length > 0 ? files : cwd === undefined ? [] : [cwd] store.reduce(state => revealPaths(state, cwd, targets)) - // A content open (path seed) lands in sight: the single-instance editor - // home tab (the files window) is focused and its hosting panel expands. + // A type-only open never auto-expands the panel (only content opens do, + // see service.openTab) — so a reveal opens the panel itself when it is + // collapsed, exactly like the subagent auto-open flows, or the highlight + // would be set on an invisible panel. + store.reduce(s => (s.panelOpen ? s : togglePanel(s))) + // Pin the landing to the right panel: the files window must appear where + // the panel just expanded, not in a bottom-panel pane the user last + // touched. + store.reduce(s => ({ ...s, activePane: firstLeaf(s.splits).id })) + // Focus the single-instance editor home tab (the files window) where the + // reveal highlight renders. ctx.betterSidebar?.openTab({ type: 'editor', title: t('files') }) }