fix: "Show in folder" reveals in the explorer instead of opening a directory in the editor
The open-path interception reroutes EVERY chat-side file open into the
sidebar editor, including the stock "Show in folder" gesture: the
ui-deliverables row passes "." (resolved to "<cwd>/." by the chat view),
so clicking it opened a bogus editor tab for the workspace directory
(host error: '"..." is a directory').
- openpath-intercept: detect the folder-reveal gesture ("." / "./" /
"<cwd>/.") and route it to a new revealInExplorer dep instead of the editor.
- intercept: revealInExplorer switches to the explorer tab (expanding the
panel), expands the produced files' parent directories, and highlights /
scrolls to them; the intercepted produced-files row now also renders its
own "Show in folder" button when files are hidden.
- produced-files: selectProducedFiles reads the engine Turn data
(owner.turn.data.get("deliverables")) — the same source ui-deliverables
uses — with the node replica as fallback. The old code read owner.nodes,
which the real TurnTailOwnerProps ({turn, seq, openFile}) does not carry,
so the takeover never claimed the chain.
- state: transient `revealed` set (never persisted) plus a revealPaths
reducer that expands ancestor directories.
- ExplorerView: highlight + scroll revealed rows; Sidebar/tabs/service
thread `revealed` through TabComponentProps.
- tests: folder-gesture routing, engine-data selector, wiring seat, zh/en copy.
This commit is contained in:
1 parent
5d2d6e5801
commit
1ca4d4ef4d
11 files changed
+267
-22
No files matched your search
@@ -147,6 +147,12 @@ describe('turn-tail interception registration (issue #15)', () => {
|
||||
// Enabled (default): a produced turn claims the chain; an empty one declines.
|
||||
expect(select(producedOwner(['a.ts', 'b.ts']))).toEqual(['a.ts', 'b.ts'])
|
||||
expect(select(emptyOwner())).toBeNull()
|
||||
// The engine Turn data path (the real owner currency: { turn, seq,
|
||||
// openFile }) claims through the deliverables record too.
|
||||
expect(select({
|
||||
turn: { data: { get: (key: string) => key === 'deliverables' ? { produced: [{ seq: 1, path: 'a.ts' }] } : undefined } },
|
||||
seq: 1,
|
||||
})).toEqual(['a.ts'])
|
||||
|
||||
// Editor tab disabled: even a produced turn falls back to the default
|
||||
// deliverables row (chips that cannot open must not be offered).
|
||||
@@ -156,13 +162,14 @@ describe('turn-tail interception registration (issue #15)', () => {
|
||||
restore()
|
||||
})
|
||||
|
||||
it('wires the openInSidebar seat to the sidebar editor tab', () => {
|
||||
it('wires the openInSidebar and onShowInFolder seats', () => {
|
||||
const fake = fakeSlots(true)
|
||||
const ctx = clientCtx(fake.slots)
|
||||
const store = createSidebarStore()
|
||||
const restore = registerTurnTailInterception(ctx, store)
|
||||
const inject = fake.registered[0]!.options.inject as (sessionId: string) => {
|
||||
openInSidebar: (path: string) => void
|
||||
onShowInFolder: (files: readonly string[]) => void
|
||||
}
|
||||
|
||||
// The seat hands the session-scoped opener to the chips row.
|
||||
@@ -176,6 +183,14 @@ describe('turn-tail interception registration (issue #15)', () => {
|
||||
id: 'editor:/w/src/a.ts',
|
||||
})
|
||||
|
||||
// The show-in-folder seat reveals the produced files in the explorer tab.
|
||||
expect(seat.onShowInFolder).toBeTypeOf('function')
|
||||
seat.onShowInFolder(['/w/src/a.ts'])
|
||||
expect(ctx.betterSidebar.openTab).toHaveBeenLastCalledWith(expect.objectContaining({
|
||||
type: 'explorer',
|
||||
path: '/w',
|
||||
}))
|
||||
|
||||
restore()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user