Skip to content

Commit c32a5ab

Browse files
committed
Update the initial checkpoint title to 'Before changes approved' upon successful application of the chat response
1 parent 4e53556 commit c32a5ab

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

‎packages/vscode/src/commands/apply-chat-response-command/apply-chat-response-command.ts‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
} from './utils/preview-handler'
1818
import { process_chat_response, CommandArgs } from './response-processor'
1919
import { Checkpoint } from '../checkpoints-command/types'
20+
import { CHECKPOINTS_STATE_KEY } from '@/constants/state-keys'
2021

2122
export const apply_chat_response_command = (
2223
context: vscode.ExtensionContext,
@@ -72,7 +73,7 @@ export const apply_chat_response_command = (
7273
before_checkpoint = await create_checkpoint(
7374
workspace_provider,
7475
context,
75-
'Before applying changes',
76+
'Before response previewed',
7677
args?.raw_instructions
7778
)
7879

@@ -171,6 +172,24 @@ export const apply_chat_response_command = (
171172
})
172173

173174
if (changes_accepted) {
175+
if (before_checkpoint) {
176+
const checkpoints =
177+
context.workspaceState.get<Checkpoint[]>(
178+
CHECKPOINTS_STATE_KEY,
179+
[]
180+
) ?? []
181+
const checkpoint_to_update = checkpoints.find(
182+
(c) => c.timestamp == before_checkpoint!.timestamp
183+
)
184+
if (checkpoint_to_update) {
185+
checkpoint_to_update.title = 'Before changes approved'
186+
await context.workspaceState.update(
187+
CHECKPOINTS_STATE_KEY,
188+
checkpoints
189+
)
190+
}
191+
}
192+
174193
await create_checkpoint(
175194
workspace_provider,
176195
context,

0 commit comments

Comments
 (0)