Skip to content

Commit 3df7d00

Browse files
committed
Preserve selection timestamps when duplicating workspaces and load checked files state on provider initialization
1 parent a9544e5 commit 3df7d00

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎apps/editor/src/commands/duplicate-workspace-command.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ export const duplicate_workspace_command = (
1616
'codeWebChat.duplicateWorkspace',
1717
async () => {
1818
const checked_files = workspace_provider.get_all_checked_paths()
19+
const checked_files_timestamps: Record<string, number> = {}
20+
21+
for (const file_path of checked_files) {
22+
const timestamp = workspace_provider.get_selection_timestamp(file_path)
23+
if (timestamp !== undefined) {
24+
checked_files_timestamps[file_path] = timestamp
25+
}
26+
}
27+
1928
const workspace_root_folders =
2029
vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath) ??
2130
[]
@@ -39,6 +48,7 @@ export const duplicate_workspace_command = (
3948
context.workspaceState.get<Record<string, string>>(RANGES_STATE_KEY)
4049
const context_to_save: DuplicateWorkspaceContext = {
4150
checked_files,
51+
checked_files_timestamps,
4252
workspace_root_folders,
4353
timestamp: Date.now(),
4454
open_editors,

‎apps/editor/src/context/providers/workspace/workspace-provider.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ export class WorkspaceProvider
140140
this._ranges_watcher.onDidDelete(() => this.load_all_ranges())
141141

142142
this.ranges_initialization = this.load_all_ranges()
143+
144+
this.load_checked_files_state()
143145
}
144146

145147
private async _save_checked_files_state(): Promise<void> {

0 commit comments

Comments
 (0)