Skip to content

Commit f3632ce

Browse files
committed
Prevent storing apply from clipboard as the last used patch repair action
- should not save 'apply from clipboard' as last used
1 parent 98dfd63 commit f3632ce

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

‎apps/editor/src/views/prompt/backend/message-handlers/handle-patch-repair.ts‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export const handle_patch_repair = async (params: {
7171
const default_workspace_path =
7272
vscode.workspace.workspaceFolders?.[0]?.uri.fsPath
7373

74-
// Prepare files to process
7574
const files_to_process = failed_files
7675
.map((file_state) => {
7776
const relevant_item = parsed_response.find((item) => {
@@ -223,22 +222,24 @@ export const handle_patch_repair = async (params: {
223222

224223
if (!action) return
225224

226-
params.prompt_view_provider.extension_context.workspaceState.update(
227-
LAST_USED_PATCH_REPAIR_ACTION_STATE_KEY,
228-
action
229-
)
230-
params.prompt_view_provider.extension_context.globalState.update(
231-
LAST_USED_PATCH_REPAIR_ACTION_STATE_KEY,
232-
action
233-
)
225+
if (action != 'apply-from-clipboard') {
226+
params.prompt_view_provider.extension_context.workspaceState.update(
227+
LAST_USED_PATCH_REPAIR_ACTION_STATE_KEY,
228+
action
229+
)
230+
params.prompt_view_provider.extension_context.globalState.update(
231+
LAST_USED_PATCH_REPAIR_ACTION_STATE_KEY,
232+
action
233+
)
234+
}
234235
}
235236

236237
if (action == 'apply-from-clipboard') {
237238
await vscode.commands.executeCommand('codeWebChat.applyResponse')
238239
return
239240
}
240241

241-
if (action === 'copy') {
242+
if (action == 'copy') {
242243
let chatbot_prompt = ''
243244
for (const item of files_to_process) {
244245
const backticks = item.file_state.content.includes('```') ? '````' : '```'
@@ -257,7 +258,7 @@ export const handle_patch_repair = async (params: {
257258
return
258259
}
259260

260-
if (action === 'autofill') {
261+
if (action == 'autofill') {
261262
const config = vscode.workspace.getConfiguration('codeWebChat')
262263
const all_web_configurations = config.get<ConfigWebConfigurationFormat[]>('chatbots', [])
263264
const valid_web_configurations = all_web_configurations.filter(
@@ -290,7 +291,7 @@ export const handle_patch_repair = async (params: {
290291
show_back_button: false
291292
})
292293

293-
if (!result || result === 'back') {
294+
if (!result || result == 'back') {
294295
return
295296
}
296297
selected_web_configuration_name = result.item.name

0 commit comments

Comments
 (0)