Skip to content

Commit 3c5f7ec

Browse files
committed
Enable checkImportedFiles for context files and optimize checked state updates using batch processing
1 parent 97d1262 commit 3c5f7ec

2 files changed

Lines changed: 17 additions & 33 deletions

File tree

apps/editor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@
725725
},
726726
{
727727
"command": "codeWebChat.checkImportedFiles",
728-
"when": "(view == codeWebChatViewWorkspace || view == codeWebChatViewContext) && viewItem == file",
728+
"when": "(view == codeWebChatViewWorkspace || view == codeWebChatViewContext) && (viewItem == file || viewItem == contextFile)",
729729
"group": "1_modification@2.5"
730730
},
731731
{

apps/editor/src/commands/check-imported-files-command.ts

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -275,39 +275,23 @@ export const check_imported_files_command = (
275275
}
276276

277277
const valid_selected = selected_items.filter((i) => i.uri !== undefined)
278-
const selected_uris = new Set(
279-
valid_selected.map((item) => item.uri!.toString())
280-
)
281278

282-
for (const item of quick_pick_items) {
283-
if (item.kind === vscode.QuickPickItemKind.Separator || !item.uri)
284-
continue
285-
const is_selected = selected_uris.has(item.uri.toString())
286-
287-
if (is_selected !== item.picked) {
288-
const state = is_selected
289-
? vscode.TreeItemCheckboxState.Checked
290-
: vscode.TreeItemCheckboxState.Unchecked
291-
292-
const file_item = new FileItem(
293-
path.basename(item.uri.fsPath),
294-
item.uri,
295-
vscode.TreeItemCollapsibleState.None,
296-
false,
297-
state,
298-
false,
299-
false,
300-
undefined,
301-
undefined,
302-
undefined,
303-
undefined,
304-
undefined,
305-
false
306-
)
307-
308-
await workspace_provider.update_check_state(file_item, state)
309-
}
310-
}
279+
const shown_paths = quick_pick_items
280+
.filter(
281+
(item) => item.kind !== vscode.QuickPickItemKind.Separator && item.uri
282+
)
283+
.map((item) => item.uri!.fsPath)
284+
285+
const selected_paths = valid_selected.map((item) => item.uri!.fsPath)
286+
287+
const paths_to_apply = [
288+
...new Set([
289+
...currently_checked.filter((p) => !shown_paths.includes(p)),
290+
...selected_paths
291+
])
292+
]
293+
294+
await workspace_provider.set_checked_files(paths_to_apply)
311295
}
312296
)
313297
}

0 commit comments

Comments
 (0)