Skip to content

Commit fba1076

Browse files
committed
Include saved contexts in duplicated workspace state
1 parent 77e554d commit fba1076

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎packages/vscode/src/commands/duplicate-workspace-command.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import {
55
API_EDIT_FORMAT_STATE_KEY,
66
CHAT_EDIT_FORMAT_STATE_KEY,
77
DUPLICATE_WORKSPACE_CONTEXT_STATE_KEY,
8+
SAVED_CONTEXTS_STATE_KEY,
89
RANGES_STATE_KEY,
910
type DuplicateWorkspaceContext
1011
} from '../constants/state-keys'
12+
import { SavedContext } from '@/types/context'
1113

1214
export function duplicate_workspace_command(
1315
workspace_provider: WorkspaceProvider,
@@ -42,13 +44,17 @@ export function duplicate_workspace_command(
4244

4345
const ranges =
4446
context.workspaceState.get<Record<string, string>>(RANGES_STATE_KEY)
47+
const saved_contexts = context.workspaceState.get<SavedContext[]>(
48+
SAVED_CONTEXTS_STATE_KEY
49+
)
4550
const context_to_save: DuplicateWorkspaceContext = {
4651
checked_files,
4752
checked_websites,
4853
workspace_root_folders,
4954
timestamp: Date.now(),
5055
open_editors,
51-
ranges
56+
ranges,
57+
saved_contexts
5258
}
5359

5460
const api_edit_format = context.workspaceState.get(

‎packages/vscode/src/constants/state-keys.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { SavedContext } from '@/types/context'
2+
13
// Note: Use kebab-case for new keys
24
export const LAST_APPLIED_CHANGES_STATE_KEY = 'last-applied-changes-state'
35
export const LAST_APPLIED_CHANGES_EDITOR_STATE_STATE_KEY =
@@ -77,6 +79,7 @@ export type DuplicateWorkspaceContext = {
7779
workspace_root_folders: string[]
7880
open_editors?: { path: string; view_column?: number }[]
7981
ranges?: Record<string, string>
82+
saved_contexts?: SavedContext[]
8083
}
8184

8285
export type HistoryEntry = {

0 commit comments

Comments
 (0)