File tree Expand file tree Collapse file tree
packages/ui/src/components/editor/panel/prompts/PromptField/hooks/use-handlers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,11 +34,16 @@ export const create_perform_paste =
3434 let text_to_insert = text
3535 let caret_offset_adjustment = 0
3636
37+ const is_file_in_context =
38+ props . currently_open_file_path !== undefined &&
39+ ( props . context_file_paths ?? [ ] ) . includes ( props . currently_open_file_path )
40+
3741 if (
3842 ! refs . is_shift_pressed_ref . current &&
3943 props . current_selection &&
4044 text == props . current_selection . text &&
41- props . currently_open_file_path
45+ props . currently_open_file_path &&
46+ is_file_in_context
4247 ) {
4348 const { start_line, start_col, end_line, end_col } =
4449 props . current_selection
@@ -97,10 +102,15 @@ export const create_handle_paste =
97102 return
98103 }
99104
105+ const is_file_in_context =
106+ props . currently_open_file_path !== undefined &&
107+ ( props . context_file_paths ?? [ ] ) . includes ( props . currently_open_file_path )
108+
100109 const is_fragment_paste =
101110 props . current_selection &&
102111 text == props . current_selection . text &&
103- props . currently_open_file_path
112+ props . currently_open_file_path &&
113+ is_file_in_context
104114
105115 const has_symbols =
106116 get_symbol_ranges ( {
You can’t perform that action at this time.
0 commit comments