Skip to content

Commit 69e70bf

Browse files
committed
Ensure the "Reference in Prompt" command checks or partially checks directories when referencing them
1 parent 4d08d4e commit 69e70bf

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

‎packages/ui/src/components/editor/panel/ChatInput/hooks/use-handlers.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,11 @@ export const use_handlers = (
423423
}
424424

425425
if (key == 'z' && (ctrlKey || metaKey) && !shiftKey) {
426-
handle_undo_at_sign(e)
427-
return
426+
if (saved_value_before_at_sign !== null) {
427+
handle_undo_at_sign(e)
428+
return
429+
}
430+
// Otherwise, we don't return, allowing the default undo behavior
428431
}
429432

430433
if (props.value) {

‎packages/vscode/src/commands/reference-in-prompt-command.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ export const reference_in_prompt_command = (
3232
.get_all_checked_paths()
3333
.includes(file_path)
3434

35-
if (!is_checked) {
35+
const is_partially_checked =
36+
uri.isDirectory && workspace_provider.is_partially_checked(file_path)
37+
38+
if (!is_checked && !is_partially_checked) {
3639
await workspace_provider.update_check_state(
3740
uri,
3841
vscode.TreeItemCheckboxState.Checked

‎packages/vscode/src/context/providers/workspace-provider.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,6 +1328,10 @@ export class WorkspaceProvider
13281328
return this.user_ignore.ignores(relative_path)
13291329
}
13301330

1331+
public is_partially_checked(path: string): boolean {
1332+
return this.partially_checked_dirs.has(path)
1333+
}
1334+
13311335
public async check_all(): Promise<void> {
13321336
for (const workspace_root of this.workspace_roots) {
13331337
this.checked_items.set(

0 commit comments

Comments
 (0)