Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
99f85c9
Separate editor tab placement from content ownership
brennanb2025 Nov 6, 2026
93a5829
Show scoped Source Control sections for attached worktrees
brennanb2025 Nov 6, 2026
3a5be8d
Preserve active diff refresh and validate section catalogs
brennanb2025 Nov 6, 2026
377b192
Complete folder section test worktree metadata
brennanb2025 Nov 6, 2026
508acba
Use contextual types for scoped Source Control actions
brennanb2025 Nov 6, 2026
42ff26c
Preserve optional scoped action parameters
brennanb2025 Nov 6, 2026
cb8c437
Preserve editor ownership through restore, mirroring and workspace re…
brennanb2025 Nov 6, 2026
afd5e79
Retire Source Control drafts only after confirmed owner removal
brennanb2025 Nov 6, 2026
012924a
Limit section work to visible expanded repositories
brennanb2025 Nov 6, 2026
fb4c7e0
Keep editor follow-up actions and bulk closes in their invoking views
brennanb2025 Nov 6, 2026
dba7ab6
Track the consolidated editor order writer in its owning module
brennanb2025 Nov 6, 2026
a2e94ff
Use complete typed fixtures for repair contracts
brennanb2025 Nov 6, 2026
4407f53
Preserve live editor placement during layout readback
brennanb2025 Nov 6, 2026
a382456
Pass projected editor placement directly to serialization
brennanb2025 Nov 6, 2026
f0af280
Merge main for shared workspace lineage resolution
brennanb2025 Nov 6, 2026
51df133
Read attached worktree lineage from shared graph module
brennanb2025 Nov 6, 2026
16c490d
Retain inferred owner checks and scope placement retirement
brennanb2025 Nov 6, 2026
069d1cb
Preserve selection in untouched workspaces during purge
brennanb2025 Nov 6, 2026
c48b55e
Exercise editor placements in existing launch and lifecycle fixtures
brennanb2025 Nov 6, 2026
18168b3
Preserve shared buffer prompts and editor strip order
brennanb2025 Nov 6, 2026
e621180
Pause inactive section context subscriptions
brennanb2025 Nov 6, 2026
38335b5
Keep section recovery and file actions in the folder workspace
brennanb2025 Nov 6, 2026
ecc9eb8
Describe attached Source Control in folder workspace CLI help
brennanb2025 Nov 6, 2026
ad5dc48
Attribute Git metadata signals once per dispatch
brennanb2025 Nov 6, 2026
62c2f26
Watch mounted source control sections outside the warm budget
brennanb2025 Nov 6, 2026
405d2ea
Resolve section watches only for served filesystem roots
brennanb2025 Nov 6, 2026
3e862a8
Restore restart-stable editor identity across SSH opens
brennanb2025 Nov 6, 2026
43639ab
Apply section terminal routing to explicit Chat choices
brennanb2025 Nov 6, 2026
844c719
Include cross-store descendants in folder workspace panels
brennanb2025 Nov 6, 2026
89a18b4
Keep cross-host recovery on its existing workspace route
brennanb2025 Nov 6, 2026
89911e5
Start cross-host section agents in their workspace without navigation
brennanb2025 Nov 6, 2026
489ef35
Update memoized Source Control labels on language changes
brennanb2025 Nov 6, 2026
1028e5f
Remove unused terminal close-to-right implementation
brennanb2025 Nov 6, 2026
6eb4bd6
Suspend inactive Source Control body observers
brennanb2025 Nov 6, 2026
149d095
Retain base ref query while section observation pauses
brennanb2025 Nov 6, 2026
22b196c
Cover retained base ref search across section visibility
brennanb2025 Nov 6, 2026
dbbc85d
Resolve note menu ownership from the retained snapshot
brennanb2025 Nov 6, 2026
4c43cbe
Preserve section agent working directories and background placement
brennanb2025 Nov 6, 2026
7b98c28
Keep Source Control sections active while their overlays are open
brennanb2025 Nov 6, 2026
8e71210
Read current settings when Source Control commands execute
brennanb2025 Nov 6, 2026
1e7fd19
Merge origin/main for folder Source Control CI
brennanb2025 Nov 6, 2026
b06a3c7
Adapt editor and browser test stores to view subscriptions
brennanb2025 Nov 6, 2026
8abd7ba
Preserve bound store hooks for ordinary app views
brennanb2025 Nov 6, 2026
e4ab7cf
Trust agent starts outside the placement workspace
brennanb2025 Nov 6, 2026
828b178
Trust the section worktree through transient launch ownership
brennanb2025 Nov 6, 2026
4c8c327
Extract editor follow-up file actions from the panel
brennanb2025 Nov 6, 2026
11f02b2
Fail section launches when trust capability lookup fails
brennanb2025 Nov 6, 2026
8fdc999
Merge main into folder workspace Source Control
brennanb2025 Nov 6, 2026
3df1659
Merge main into folder workspace Source Control
brennanb2025 Nov 6, 2026
a7304a1
Follow the moved pane launch test in web configs
brennanb2025 Nov 6, 2026
611c71b
Preserve section file ownership during refresh and close
brennanb2025 Nov 6, 2026
15de3e8
Share tab order removal across editor close paths
brennanb2025 Nov 6, 2026
9f09df8
Verify companion editor close through the real store
brennanb2025 Nov 6, 2026
5e91fc0
Close all workspace split copies for legacy mobile file requests
brennanb2025 Nov 6, 2026
2c2bbe3
Keep unmatched mobile close requests within their workspace
brennanb2025 Nov 6, 2026
f534514
Reuse the agent menu render snapshot
brennanb2025 Nov 6, 2026
dc03689
Merge main and preserve folder Source Control ownership
brennanb2025 Nov 7, 2026
fbc3671
Merge main and retain section launch coverage
brennanb2025 Nov 7, 2026
b65ded9
Keep attached folder roots scoped to their resolved host
brennanb2025 Nov 7, 2026
63cdc9f
Merge main into folder workspace source control
brennanb2025 Nov 7, 2026
b8549e9
Apply repository trust decisions to the launch trust owner
brennanb2025 Nov 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/focus-setting-read-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This is a RATCHET: counts may only go DOWN. Only creation flows with no source row may read
# the default host, through defaultCreationHost. Everything else routes by the owner.
# Prune after removing reads: pnpm check:focus-read-ratchet --prune
1 src/renderer/src/app-shell/ActiveWorkspaceSyncGate.tsx
3 src/renderer/src/app-shell/ActiveWorkspaceSyncGate.tsx # existing watch selector now visible through useCallback; includes its import-path occurrence
2 src/renderer/src/app-shell/use-app-shell-services.ts
2 src/renderer/src/App.tsx
1 src/renderer/src/component-fixtures/component-fixture-explorer.tsx # dev-only fixture page seeds default settings
Expand Down
14 changes: 7 additions & 7 deletions config/main-layout-writer-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,27 @@
1 src/main/persistence/tracking-repos/project-group-operations.ts
4 src/main/persistence/tracking-repos/repo-worktree-pruning.ts
3 src/main/persistence/tracking-repos/worktree-identity-migration.ts
2 src/main/pty/scrollback/terminal-scrollback-snapshots.ts
1 src/main/runtime/browser/client-pages/client-hosted-browser-page-persistence.ts
1 src/main/runtime/client/runtime-client-state.ts
1 src/main/runtime/mobile-session-editor-projection.ts
3 src/main/runtime/terminal/surface/mobile-session-layout-projection.ts
4 src/main/runtime/runtime-legacy-worker-terminal-recovery-persistence.ts
2 src/main/runtime/terminal/launch/runtime-pane-admission.ts
7 src/main/runtime/terminal/adoption/runtime-terminal-orphan-session-adoption.ts
1 src/main/runtime/workspaces/session-hosts/runtime-workspace-session-controller.ts
2 src/main/runtime/session-graph/session-graph-promotion.ts
2 src/main/runtime/session-lifecycle/projection/apply-mobile-session-tab-navigation.ts
2 src/main/runtime/session-lifecycle/projection/build-headless-mobile-session-browser-tabs.ts
2 src/main/runtime/session-tabs/headless-tab-group-moves.ts
6 src/main/runtime/session-tabs/headless-tab-properties.ts
2 src/main/runtime/session-tabs/headless-terminal-tab-titles.ts
1 src/main/runtime/session-tabs/structured-session-tab-close.ts
1 src/main/runtime/session-tabs/terminal-surface-retirements.ts
2 src/main/runtime/terminal/adoption/adopt-terminal-orphans-from-inventory.ts
7 src/main/runtime/terminal/adoption/runtime-terminal-orphan-session-adoption.ts
1 src/main/runtime/terminal/driver/terminal-driver-resources.ts
3 src/main/runtime/terminal/stop/worktree-terminal-stop.ts
4 src/main/runtime/terminal/identity/workspace-session-worktree-id.ts
2 src/main/runtime/terminal/launch/runtime-pane-admission.ts
3 src/main/runtime/terminal/stop/worktree-terminal-stop.ts
3 src/main/runtime/terminal/surface/mobile-session-layout-projection.ts
1 src/main/runtime/workspaces/session-hosts/get-runtime-id.ts
2 src/main/runtime/session-tabs/headless-terminal-tab-titles.ts
1 src/main/runtime/workspaces/session-hosts/runtime-workspace-session-controller.ts
1 src/main/ssh/orcad-migration-source-retention.ts
1 src/main/ssh/targets/ssh-target-id-migration.ts
2 src/main/pty/scrollback/terminal-scrollback-snapshots.ts
24 changes: 14 additions & 10 deletions config/renderer-layout-writer-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
7 src/renderer/src/lib/workspace-session-hydration-keys.ts
25 src/renderer/src/lib/workspace-session-patch.ts
3 src/renderer/src/lib/workspace-session-staged-browser-tabs.ts
1 src/renderer/src/lib/workspace-session-unified-tabs.ts
17 src/renderer/src/lib/workspace-session.ts
3 src/renderer/src/runtime/local-structured-session-tabs-sync/snapshot-projection.ts
3 src/renderer/src/runtime/structured-agent-session-tab-retirement.ts
Expand All @@ -52,38 +53,41 @@
5 src/renderer/src/store/slices/browser/browser-page-focus-actions.ts
2 src/renderer/src/store/slices/browser/browser-page-state-actions.ts
1 src/renderer/src/store/slices/browser/browser-tab-actions.ts
5 src/renderer/src/store/slices/browser/browser-tab-open-view.ts # extracted from browser-tab-actions.ts
4 src/renderer/src/store/slices/browser/browser-tab-focus-actions.ts
5 src/renderer/src/store/slices/browser/browser-tab-open-view.ts # extracted from browser-tab-actions.ts
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
2 src/renderer/src/store/slices/browser/create-browser-slice.ts
9 src/renderer/src/store/slices/editor/actions/check-run-details-actions.ts
7 src/renderer/src/store/slices/editor/actions/close-file-action.ts
6 src/renderer/src/store/slices/editor/actions/close-file-action.ts
1 src/renderer/src/store/slices/editor/actions/git-status-actions.ts
4 src/renderer/src/store/slices/editor/actions/hydrated-editor-session-state.ts
3 src/renderer/src/store/slices/editor/actions/markdown-preview-actions.ts
27 src/renderer/src/store/slices/editor/actions/open-combined-diff.ts
13 src/renderer/src/store/slices/editor/actions/open-conflict-file.ts
14 src/renderer/src/store/slices/editor/actions/open-conflict-review.ts
4 src/renderer/src/store/slices/editor/actions/open-file-apply.ts
3 src/renderer/src/store/slices/editor/actions/open-combined-diff.ts
1 src/renderer/src/store/slices/editor/actions/open-conflict-file.ts
6 src/renderer/src/store/slices/editor/actions/open-conflict-review.ts
3 src/renderer/src/store/slices/editor/actions/open-file-apply.ts
3 src/renderer/src/store/slices/editor/actions/open-file-mutations.ts
7 src/renderer/src/store/slices/editor/actions/open-file-state.ts
26 src/renderer/src/store/slices/editor/actions/open-history-diff.ts
2 src/renderer/src/store/slices/editor/actions/open-history-diff.ts
1 src/renderer/src/store/slices/editor/actions/open-unstaged-diff.ts
10 src/renderer/src/store/slices/editor/actions/recently-closed-editor-tabs.ts
11 src/renderer/src/store/slices/editor/actions/recently-closed-editor-tabs.ts
2 src/renderer/src/store/slices/editor/actions/rekey-open-files-action.ts
5 src/renderer/src/store/slices/editor/actions/restored-editor-owner-in-place.ts
10 src/renderer/src/store/slices/editor/actions/restored-editor-owner-transition.ts
3 src/renderer/src/store/slices/editor/file-ids/hydrated-editor-file-ids.ts
2 src/renderer/src/store/slices/editor/file-ids/hydrated-editor-file-selection.ts
1 src/renderer/src/store/slices/editor/file-ids/open-file-path-rekey.ts
4 src/renderer/src/store/slices/editor/tabs/editor-open-target-group.ts
1 src/renderer/src/store/slices/editor/tabs/workspace-editor-files.ts
2 src/renderer/src/store/slices/tab-group-reference-repair.ts
4 src/renderer/src/store/slices/tab-group-state.ts
1 src/renderer/src/store/slices/tabs-hydration.ts
4 src/renderer/src/store/slices/tabs/create-tabs-slice.ts
17 src/renderer/src/store/slices/tabs/tabs-close-actions.ts
12 src/renderer/src/store/slices/tabs/rename-worktree-layout.ts
9 src/renderer/src/store/slices/tabs/tabs-close-actions.ts
14 src/renderer/src/store/slices/tabs/tabs-create-actions.ts
23 src/renderer/src/store/slices/tabs/tabs-drag-preview-actions.ts
11 src/renderer/src/store/slices/tabs/tabs-drop-actions.ts
8 src/renderer/src/store/slices/tabs/tabs-empty-workspace.ts
4 src/renderer/src/store/slices/tabs/tabs-focus-actions.ts
12 src/renderer/src/store/slices/tabs/tabs-group-actions.ts
1 src/renderer/src/store/slices/tabs/tabs-host-mirroring.ts
Expand All @@ -93,7 +97,7 @@
4 src/renderer/src/store/slices/tabs/tabs-session-actions.ts
1 src/renderer/src/store/slices/tabs/tabs-split-ratio-actions.ts
5 src/renderer/src/store/slices/tabs/tabs-surface.ts
33 src/renderer/src/store/slices/tabs/worktree-layout-lifecycle.ts
24 src/renderer/src/store/slices/tabs/worktree-layout-lifecycle.ts
6 src/renderer/src/store/slices/terminal-orphan-helpers.ts
4 src/renderer/src/store/slices/terminal-tab-title-batch.ts
6 src/renderer/src/store/slices/terminals.ts
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
// @vitest-environment happy-dom
import { cleanup, fireEvent, render } from '@testing-library/react'
import { afterEach, expect, it, vi } from 'vitest'
import { useAppStore } from '@/store'
import {
drawTabsFromMain,
type TabsDrawnFromMain
} from '@/store/slices/tabs-drawn-from-main.test-fixture'
import {
EDITOR_OWNER,
EDITOR_PLACEMENT,
seedEditorPlacementConsumers
} from '@/store/slices/editor-placement-consumers.test-fixture'
import type { EditorToggleValue } from './view-mode/EditorViewToggle'

vi.mock('@/runtime/runtime-rpc-client', async (original) =>
(
await import('@/runtime/layout-apply-test-transport.test-fixture')
).runtimeRpcClientWithLayoutApply(await original())
)
vi.mock('@/runtime/runtime-layout-client', async (original) =>
(
await import('@/runtime/layout-apply-test-transport.test-fixture')
).runtimeLayoutClientWithTestFrames(await original())
)
vi.mock('./useEditorPanelContentState', () => ({
useEditorPanelContentState: () => ({
fileContents: {},
diffContents: {},
reloadContent: () => {}
})
}))
vi.mock('./EditorPanelShell', () => ({
EditorPanelShell: ({
onOpenDiffTargetFile,
onEditorToggleChange,
onOpenMarkdownPreview,
onOpenPreviewToSide
}: {
onOpenDiffTargetFile: () => void
onEditorToggleChange: (mode: EditorToggleValue) => void
onOpenMarkdownPreview: () => void
onOpenPreviewToSide: () => void
}) => (
<>
<button onClick={onOpenDiffTargetFile}>Open</button>
<button onClick={() => onEditorToggleChange('rich')}>Rich</button>
<button onClick={onOpenMarkdownPreview}>Markdown preview</button>
<button onClick={onOpenPreviewToSide}>Side preview</button>
</>
)
}))
import EditorPanel from './EditorPanel'

let main: TabsDrawnFromMain | undefined
afterEach(() => {
cleanup()
main?.close()
main = undefined
})

it.each(['Open', 'Rich', 'Markdown preview'])(
'%s from a child diff opens the result in the invoking folder group',
async (action) => {
const file = seedEditorPlacementConsumers()
main = await drawTabsFromMain(useAppStore)
const screen = render(<EditorPanel activeFileId={file.id} activeViewStateId="x-source-tab" />)
fireEvent.click(screen.getByText(action))
await main.settle()
const state = useAppStore.getState()
const result = state.openFiles.find(
(entry) => entry.mode === (action === 'Markdown preview' ? 'markdown-preview' : 'edit')
)
expect(result).toMatchObject({
worktreeId: EDITOR_OWNER,
filePath: '/repo/notes.md',
runtimeEnvironmentId: null
})
expect(
state.unifiedTabsByWorktree[EDITOR_PLACEMENT]?.find((tab) => tab.entityId === result?.id)
).toMatchObject({ groupId: 'x-source' })
expect(state.unifiedTabsByWorktree[EDITOR_OWNER]?.map((tab) => tab.id)).toEqual(['y-tab'])
if (action === 'Rich') {
expect(state.markdownViewMode[result!.id]).toBe('rich')
}
}
)

it('opens an HTML side preview beside its invoking folder group', async () => {
const file = seedEditorPlacementConsumers({
filePath: '/repo/index.html',
relativePath: 'index.html',
language: 'html'
})
main = await drawTabsFromMain(useAppStore)
const screen = render(<EditorPanel activeFileId={file.id} activeViewStateId="x-source-tab" />)
fireEvent.click(screen.getByText('Side preview'))
await main.settle()
const state = useAppStore.getState()
const browser = state.browserTabsByWorktree[EDITOR_PLACEMENT]?.[0]
expect(browser?.url).toBe('file:///repo/index.html')
expect(
state.unifiedTabsByWorktree[EDITOR_PLACEMENT]?.find((tab) => tab.entityId === browser?.id)
).toMatchObject({ groupId: 'x-other' })
expect(state.browserTabsByWorktree[EDITOR_OWNER] ?? []).toEqual([])
})

it('places an SSH document preview in the folder while its document location retains the child', async () => {
const file = seedEditorPlacementConsumers({
filePath: '/repo/index.html',
relativePath: 'index.html',
language: 'html'
})
useAppStore.setState((state) => ({
repos: state.repos.map((repo) => ({
...repo,
connectionId: 'child-ssh',
executionHostId: 'ssh:child-ssh'
})),
worktreesByRepo: {
repo1: state.worktreesByRepo.repo1!.map((worktree) => ({
...worktree,
hostId: 'ssh:child-ssh'
}))
},
sshConnectionStates: new Map([
[
'child-ssh',
{
targetId: 'child-ssh',
status: 'connected',
error: null,
reconnectAttempt: 0,
connectionGeneration: 1
}
]
])
}))
main = await drawTabsFromMain(useAppStore)
const screen = render(<EditorPanel activeFileId={file.id} activeViewStateId="x-source-tab" />)
fireEvent.click(screen.getByText('Side preview'))
await main.settle()
const state = useAppStore.getState()
const preview = state.browserTabsByWorktree[EDITOR_PLACEMENT]?.[0]
expect(preview?.docLocation).toEqual({
kind: 'workspace-doc',
worktreeId: EDITOR_OWNER,
filePath: '/repo/index.html'
})
expect(
state.unifiedTabsByWorktree[EDITOR_PLACEMENT]?.find((tab) => tab.entityId === preview?.id)
?.groupId
).toBe('x-other')
expect(state.browserTabsByWorktree[EDITOR_OWNER] ?? []).toEqual([])
})
36 changes: 20 additions & 16 deletions src/renderer/src/components/editor/EditorPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { editorViewPlacement } from '@/store/slices/editor/tabs/editor-view-placement'
import React, { useCallback, useMemo, useRef, useState } from 'react'
import { useAppStore } from '@/store'
import { getConnectionId } from '@/lib/connection-context'
Expand Down Expand Up @@ -161,7 +162,7 @@ function EditorPanelInner({
)?.kind !== 'local'
)

useMarkdownPreviewShortcut({ activeFile, panelRef, openMarkdownPreview })
useMarkdownPreviewShortcut({ activeFile, activeViewStateId, panelRef, openMarkdownPreview })

const handleContentChangeForFile = useEditorContentChangeHandler({ fileContents, diffContents })

Expand Down Expand Up @@ -243,30 +244,30 @@ function EditorPanelInner({

const handleOpenPreviewToSide = (): void => {
const state = useAppStore.getState()
const sourceGroupId = activeViewStateId
? ((state.unifiedTabsByWorktree[activeFile.worktreeId] ?? []).find(
(t) => t.id === activeViewStateId
)?.groupId ?? null)
: null
const placement = editorViewPlacement(state, activeFile, activeViewStateId)
openFilePreviewToSide({
language: model.resolvedLanguage,
filePath: activeFile.filePath,
worktreeId: activeFile.worktreeId,
sourceGroupId
placementWorkspaceId: placement.placementWorkspaceId,
sourceGroupId: placement.targetGroupId ?? null
})
}
const handleOpenDiffTargetFile = (preferredMarkdownViewMode?: 'rich'): void => {
if (!model.openFileState.canOpen) {
return
}
const openedFileId = openFile({
filePath: activeFile.filePath,
relativePath: activeFile.relativePath,
worktreeId: activeFile.worktreeId,
runtimeEnvironmentId: activeFile.runtimeEnvironmentId,
language: detectLanguage(activeFile.relativePath),
mode: 'edit'
})
const openedFileId = openFile(
{
filePath: activeFile.filePath,
relativePath: activeFile.relativePath,
worktreeId: activeFile.worktreeId,
runtimeEnvironmentId: activeFile.runtimeEnvironmentId,
language: detectLanguage(activeFile.relativePath),
mode: 'edit'
},
editorViewPlacement(useAppStore.getState(), activeFile, activeViewStateId)
)
if (preferredMarkdownViewMode) {
setEditorViewMode(openedFileId, 'edit')
setMarkdownViewMode(openedFileId, preferredMarkdownViewMode)
Expand Down Expand Up @@ -303,7 +304,10 @@ function EditorPanelInner({
runtimeEnvironmentId: activeFile.runtimeEnvironmentId,
language: model.resolvedLanguage
},
{ sourceFileId: activeFile.id }
{
sourceFileId: activeFile.id,
...editorViewPlacement(useAppStore.getState(), activeFile, activeViewStateId)
}
)
}
const disableRenameBrowse = Boolean(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function attachEditorAutosaveController(store: AppStoreApi): () => void {
if (!(event instanceof CustomEvent)) {
return
}
const { fileId, onNotClosed }: EditorSaveAndCloseDetail = event.detail
const { fileId, tabId, onNotClosed }: EditorSaveAndCloseDetail = event.detail
const file = store.getState().openFiles.find((openFile) => openFile.id === fileId)
if (!file) {
return
Expand All @@ -68,7 +68,11 @@ export function attachEditorAutosaveController(store: AppStoreApi): () => void {
return
}
}
store.getState().closeFile(fileId)
if (tabId) {
store.getState().closeUnifiedTab(tabId)
} else {
store.getState().closeFile(fileId)
}
}

const handleSaveFile = async (event: Event): Promise<void> => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export type EditorSaveFileTarget = {

export type EditorSaveAndCloseDetail = {
fileId: string
tabId?: string
/** Called at once when the tab stays open, so a waiting dialog needn't time out. */
onNotClosed?: (reason: 'blocked-stale' | 'not-utf8' | 'not-saved') => void
}
Expand All @@ -83,6 +84,7 @@ export type EditorFileSavedDetail = {

export type EditorRequestFileCloseDetail = {
fileId: string
tabId?: string
/** Runs once the file actually closes — after save or discard, never on cancel. */
onClosed?: () => void
}
Expand Down Expand Up @@ -227,7 +229,7 @@ export async function requestEditorFileSave(target: EditorSaveFileTarget): Promi

export function requestEditorFileClose(
fileId: string,
options?: Pick<EditorRequestFileCloseDetail, 'onClosed'>
options?: Pick<EditorRequestFileCloseDetail, 'onClosed' | 'tabId'>
): void {
window.dispatchEvent(
new CustomEvent<EditorRequestFileCloseDetail>(ORCA_EDITOR_REQUEST_FILE_CLOSE_EVENT, {
Expand Down
Loading
Loading