Skip to content

Commit 8d1f97f

Browse files
committed
Ensure the prompt field is focused and text is inserted at the cursor after selecting items from quick-pick menus
1 parent 892d428 commit 8d1f97f

3 files changed

Lines changed: 12 additions & 28 deletions

File tree

‎packages/vscode/src/views/panel/backend/message-handlers/handle-at-sign-quick-pick/handle-at-sign-quick-pick.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,4 +296,8 @@ export const handle_at_sign_quick_pick = async (
296296
} else {
297297
panel_provider.add_text_at_cursor_position(replacement)
298298
}
299+
300+
panel_provider.send_message({
301+
command: 'FOCUS_PROMPT_FIELD'
302+
})
299303
}

‎packages/vscode/src/views/panel/backend/message-handlers/handle-hash-sign-quick-pick.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,4 +699,8 @@ export const handle_hash_sign_quick_pick = async (
699699
} else {
700700
panel_provider.add_text_at_cursor_position(replacement)
701701
}
702+
703+
panel_provider.send_message({
704+
command: 'FOCUS_PROMPT_FIELD'
705+
})
702706
}

‎packages/vscode/src/views/panel/backend/message-handlers/handle-show-prompt-template-quick-pick.ts‎

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,6 @@ export const handle_show_prompt_template_quick_pick = async (
4545
let prompt_templates =
4646
config.get<PromptTemplate[]>(prompt_templates_key, []) || []
4747

48-
const set_instructions = async (text: string) => {
49-
switch (mode) {
50-
case 'ask':
51-
panel_provider.ask_instructions = text
52-
break
53-
case 'edit-context':
54-
panel_provider.edit_instructions = text
55-
break
56-
case 'no-context':
57-
panel_provider.no_context_instructions = text
58-
break
59-
case 'code-completions':
60-
panel_provider.code_completion_instructions = text
61-
break
62-
default:
63-
return
64-
}
65-
66-
panel_provider.send_message({
67-
command: 'INSTRUCTIONS',
68-
ask: panel_provider.ask_instructions,
69-
edit_context: panel_provider.edit_instructions,
70-
no_context: panel_provider.no_context_instructions,
71-
code_completions: panel_provider.code_completion_instructions
72-
})
73-
}
74-
7548
let is_editing_template = false
7649

7750
const templates_quick_pick = vscode.window.createQuickPick<
@@ -351,7 +324,10 @@ export const handle_show_prompt_template_quick_pick = async (
351324
}
352325
}
353326

354-
await set_instructions(prompt_text)
327+
panel_provider.add_text_at_cursor_position(prompt_text)
328+
panel_provider.send_message({
329+
command: 'FOCUS_PROMPT_FIELD'
330+
})
355331
}
356332
}),
357333
templates_quick_pick.onDidChangeValue((value) => {

0 commit comments

Comments
 (0)