File tree Expand file tree Collapse file tree
apps/editor/src/views/panel/backend/utils
packages/ui/src/components/editor/panel/PromptField/hooks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export const replace_document_symbol = async (params: {
4242 result_string += params . instruction . slice ( last_index , match . index )
4343
4444 if ( replacement . success && replacement . content ) {
45- result_string += `\n<document>\n< ![CDATA[\n${ replacement . content } \n]]>\n</document >\n`
45+ result_string += `\n<![CDATA[\n${ replacement . content } \n]]>\n`
4646 } else {
4747 result_string += match [ 0 ]
4848 }
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ export const replace_selection_symbol = (instruction: string): string => {
88
99 const active_editor = vscode . window . activeTextEditor
1010 if ( ! active_editor || active_editor . selection . isEmpty ) {
11- // If no selection, just return the original instruction
1211 vscode . window . showInformationMessage (
1312 dictionary . information_message . NO_TEXT_SELECTED_FOR_SELECTION_PLACEHOLDER
1413 )
@@ -18,10 +17,8 @@ export const replace_selection_symbol = (instruction: string): string => {
1817 const selected_text = active_editor . document . getText ( active_editor . selection )
1918 const document = active_editor . document
2019 const current_file_path = vscode . workspace . asRelativePath ( document . uri )
21- const start = active_editor . selection . start
22- const end = active_editor . selection . end
2320
24- const replacement_text = `\n<fragment path="${ current_file_path } " start=" ${ start . line + 1 } : ${ start . character + 1 } " end=" ${ end . line + 1 } : ${ end . character + 1 } " >\n<![CDATA[\n${ selected_text } \n]]>\n</fragment>`
21+ const replacement_text = `\n<fragment path="${ current_file_path } ">\n<![CDATA[\n${ selected_text } \n]]>\n</fragment>`
2522
2623 return instruction . replace ( / \s * # S e l e c t i o n \s * / g, replacement_text )
2724}
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ export const replace_website_symbol = async (params: {
5353 result_string += params . instruction . slice ( last_index , match . index )
5454
5555 if ( replacement . success && replacement . content ) {
56- result_string += `\n<document>\n< ![CDATA[\n${ replacement . content } \n]]>\n</document >\n`
56+ result_string += `\n<![CDATA[\n${ replacement . content } \n]]>\n`
5757 } else {
5858 result_string += match [ 0 ]
5959 }
Original file line number Diff line number Diff line change @@ -714,7 +714,16 @@ export const use_handlers = (
714714 return
715715 }
716716
717- if ( ! is_shift_pressed_ref . current && text . length > 1000 ) {
717+ const is_fragment_paste =
718+ props . current_selection &&
719+ text == props . current_selection . text &&
720+ props . currently_open_file_path
721+
722+ if (
723+ ! is_shift_pressed_ref . current &&
724+ text . includes ( '\n' ) &&
725+ ! is_fragment_paste
726+ ) {
718727 const selection = window . getSelection ( )
719728 if (
720729 selection &&
You can’t perform that action at this time.
0 commit comments