Skip to content

Commit 854fcd2

Browse files
committed
Include empty prompts in commit message context and file cleanup
- Update run-generate-action.ts to include prompts with empty strings when gathering files for the ASCII tree, while continuing to filter them out from the QuickPick selection and the commit message bullet points. └── apps └── editor └── src ├── commands │ ├── apply-response-command │ │ └── utils │ │ └── preview-handler.ts │ ├── code-at-cursor-command │ │ ├── code-at-cursor-commands.ts │ │ ├── index.ts │ │ └── utils │ │ ├── get-code-at-cursor-config.ts │ │ ├── perform-code-at-cursor.ts │ │ └── show-ghost-text.ts │ ├── 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 │ └── history-command │ └── actions │ └── restore-checkpoint.ts └── services └── git-discard-file-watcher.ts
1 parent 1d5f72a commit 854fcd2

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ export const run_generate_action = async (params: {
566566
.getConfiguration('codeWebChat')
567567
.get<boolean>('selectAllPromptsInCommitMessagesByDefault', true)
568568

569-
const relevant_prompts = all_prompts
569+
const all_relevant_prompts = all_prompts
570570
.filter((p) =>
571571
p.files.some((file) => {
572572
const rel_path = path.isAbsolute(file)
@@ -579,14 +579,17 @@ export const run_generate_action = async (params: {
579579
(p, index, self) =>
580580
index == self.findIndex((sp) => sp.prompt == p.prompt)
581581
)
582-
.filter((p) => p.prompt.trim() != '')
582+
583+
const relevant_prompts = all_relevant_prompts.filter((p) => p.prompt.trim() != '')
584+
const empty_prompts = all_relevant_prompts.filter((p) => p.prompt.trim() == '')
583585

584586
const get_tree_text_if_applicable = async (
585587
selected_prompts: typeof relevant_prompts,
588+
empty_prompts: typeof relevant_prompts,
586589
show_back_button: boolean
587590
): Promise<string | undefined | 'back'> => {
588591
const selected_files_set = new Set<string>()
589-
for (const p of selected_prompts) {
592+
for (const p of [...selected_prompts, ...empty_prompts]) {
590593
for (const f of p.selected_files || []) {
591594
selected_files_set.add(f)
592595
}
@@ -880,6 +883,7 @@ export const run_generate_action = async (params: {
880883
params.provided_text === undefined || can_go_back_in_wizard
881884
const result = await get_tree_text_if_applicable(
882885
selected_prompts,
886+
empty_prompts,
883887
show_back_button
884888
)
885889
if (result == 'back') {
@@ -929,7 +933,7 @@ export const run_generate_action = async (params: {
929933
CommitMessageDetails.remove_committed_files({
930934
extension_context: params.extension_context,
931935
workspace_root,
932-
prompts: relevant_prompts.map((p) => p.prompt),
936+
prompts: all_relevant_prompts.map((p) => p.prompt),
933937
committed_files: staged_files
934938
})
935939

0 commit comments

Comments
 (0)