Skip to content

Commit 8cea104

Browse files
committed
Sync commit file picker selection with currently checked workspace files
1 parent e58c687 commit 8cea104

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎apps/editor/src/commands/apply-context-command/sources/commit-files-source.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ export const handle_commit_files_source = async (
151151

152152
// Inner loop for file selection
153153
while (true) {
154+
const currently_checked = workspace_provider.get_checked_files()
155+
const currently_checked_set = new Set(currently_checked)
156+
154157
const file_items = await Promise.all(
155158
valid_files.map(async (f) => {
156159
const token_count = await workspace_provider.calculate_file_tokens(
@@ -165,7 +168,7 @@ export const handle_commit_files_source = async (
165168
description: display_dir
166169
? `${formatted_token_count} · ${display_dir}`
167170
: formatted_token_count,
168-
picked: true,
171+
picked: currently_checked_set.has(f.absolute_path),
169172
file_path: f.absolute_path,
170173
token_count: token_count.total
171174
}
@@ -233,7 +236,6 @@ export const handle_commit_files_source = async (
233236
}
234237

235238
const selected_paths = selected_files.map((item) => item.file_path)
236-
const currently_checked = workspace_provider.get_checked_files()
237239
let paths_to_apply = selected_paths
238240
let should_continue_file_loop = false
239241

0 commit comments

Comments
 (0)