Skip to content

Commit 8d7a3c0

Browse files
committed
Configure quick picks to ignore focus out during commit message generation
- the very first quick pick should not set ignoreFocusOut, but nested ones, should - in commit message generation flow, subsequent quick pick should have ignoreFocusOut: true (omit very fist quick pick) - 'commit message actions' if shown after unstaged files, should have ignoreFocusOut: true └── apps └── editor └── src ├── commands │ └── generate-commit-message-commands │ ├── actions │ │ ├── get-prompt-data.ts │ │ └── run-generate-action.ts │ ├── generate-commit-message-commands.ts │ ├── index.ts │ └── utils │ ├── build-commit-message-prompt.ts │ ├── generate-commit-message-with-api.ts │ ├── get-commit-message-config.ts │ └── strip-wrapping-quotes.ts ├── i18n │ └── translations │ └── commands │ └── generate-commit-message.ts └── utils ├── git-repository-utils.ts └── show-configurations-quick-pick.ts
1 parent 26dee60 commit 8d7a3c0

4 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎apps/editor/src/commands/generate-commit-message-commands/actions/run-generate-action.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ export const run_generate_action = async (params: {
155155
'common.action-quick-pick.placeholder',
156156
{ tokens: display_token_count(base_token_count) }
157157
)
158+
quick_pick.ignoreFocusOut = true
158159

159160
const close_button = {
160161
iconPath: new vscode.ThemeIcon('close'),
@@ -410,7 +411,8 @@ export const run_generate_action = async (params: {
410411
items: valid_web_configurations,
411412
type: 'web',
412413
last_selected_id: last_selected_name,
413-
show_back_button: true
414+
show_back_button: true,
415+
ignore_focus_out: true
414416
})
415417

416418
if (result == 'back') {

‎apps/editor/src/commands/generate-commit-message-commands/utils/get-commit-message-config.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ export const get_commit_message_api_configuration = async (params: {
5757
items: api_configurations,
5858
type: 'api',
5959
last_selected_id,
60-
show_back_button
60+
show_back_button,
61+
ignore_focus_out: true
6162
})
6263

6364
if (result == 'back' || !result) {

‎apps/editor/src/utils/git-repository-utils.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ export const prepare_staged_changes = async (params: {
375375
quick_pick.placeholder = t(
376376
'command.generate-commit-message.select-files'
377377
)
378-
quick_pick.ignoreFocusOut = true
379378

380379
const close_button = {
381380
iconPath: new vscode.ThemeIcon('close'),

‎apps/editor/src/utils/show-configurations-quick-pick.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export type ShowConfigurationsQuickPickOptions<T> = {
1414
title?: string
1515
placeholder?: string
1616
show_back_button?: boolean
17+
ignore_focus_out?: boolean
1718
}
1819

1920
const map_api_configuration_to_item = (api_configuration: ApiConfiguration) => {
@@ -136,6 +137,9 @@ export const show_configurations_quick_pick = async <T>(
136137
quick_pick.title = title
137138
quick_pick.placeholder = placeholder
138139
quick_pick.matchOnDescription = true
140+
if (options.ignore_focus_out) {
141+
quick_pick.ignoreFocusOut = true
142+
}
139143

140144
const close_button = {
141145
iconPath: new vscode.ThemeIcon('close'),

0 commit comments

Comments
 (0)