File tree Expand file tree Collapse file tree
packages/vscode/src/views/panel/backend/message-handlers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,13 +72,16 @@ export const handle_copy_prompt = async (params: {
7272 const workspace_folder = vscode . workspace . workspaceFolders ?. [ 0 ] . uri . fsPath
7373 const relative_path = active_path . replace ( workspace_folder + '/' , '' )
7474
75- const instructions = ` ${ code_completion_instructions_for_panel (
75+ const system_instructions = code_completion_instructions_for_panel (
7676 relative_path ,
7777 position . line ,
7878 position . character
79- ) } ${ final_instruction ? ` Follow instructions: ${ final_instruction } ` : '' } `
79+ )
80+ const missing_text_tag = final_instruction
81+ ? `<missing_text>${ final_instruction } </missing_text>`
82+ : '<missing_text>'
8083
81- const text = `${ instructions } \n<files>\n${ context_text } <file path="${ relative_path } ">\n<![CDATA[\n${ text_before_cursor } <missing_text> ${ text_after_cursor } \n]]>\n</file>\n</files>\n${ instructions } `
84+ const text = `${ system_instructions } \n<files>\n${ context_text } <file path="${ relative_path } ">\n<![CDATA[\n${ text_before_cursor } ${ missing_text_tag } ${ text_after_cursor } \n]]>\n</file>\n</files>\n${ system_instructions } `
8285
8386 vscode . env . clipboard . writeText ( text . trim ( ) )
8487 } else if ( ! is_in_code_completions_mode ) {
Original file line number Diff line number Diff line change @@ -59,17 +59,14 @@ export const handle_preview_preset = async (
5959 const relative_path = active_path ! . replace ( workspace_folder + '/' , '' )
6060
6161 const config = vscode . workspace . getConfiguration ( 'codeWebChat' )
62- const chat_code_completion_instructions = config . get < string > (
63- 'chatCodeCompletionsInstructions'
64- )
62+ const system_instructions =
63+ config . get < string > ( 'chatCodeCompletionsInstructions' ) || ''
6564
66- const instructions = `${ chat_code_completion_instructions } ${
67- current_instructions
68- ? ` Follow instructions: ${ current_instructions } `
69- : ''
70- } `
65+ const missing_text_tag = current_instructions
66+ ? `<missing_text>${ current_instructions } </missing_text>`
67+ : '<missing_text>'
7168
72- text_to_send = `${ instructions } \n<files>\n${ context_text } <file path="${ relative_path } ">\n<![CDATA[\n${ text_before_cursor } <missing_text> ${ text_after_cursor } \n]]>\n</file>\n</files>\n${ instructions } `
69+ text_to_send = `${ system_instructions } \n<files>\n${ context_text } <file path="${ relative_path } ">\n<![CDATA[\n${ text_before_cursor } ${ missing_text_tag } ${ text_after_cursor } \n]]>\n</file>\n</files>\n${ system_instructions } `
7370 } else if ( panel_provider . web_prompt_type != 'code-completions' ) {
7471 let instructions = apply_preset_affixes_to_instruction ( {
7572 instruction : current_instructions ,
You can’t perform that action at this time.
0 commit comments