@@ -100,9 +100,6 @@ const get_edit_context_config = async (
100100 if ( config . reasoning_effort ) {
101101 description_parts . push ( `${ config . reasoning_effort } ` )
102102 }
103- if ( config . instructions_placement == 'below-only' ) {
104- description_parts . push ( 'cache-enabled' )
105- }
106103
107104 const buttons : vscode . QuickInputButton [ ] = [ ]
108105
@@ -258,54 +255,33 @@ const perform_context_editing = async (params: {
258255 instructions = replace_selection_placeholder ( instructions )
259256 }
260257
261- let pre_context_instructions = instructions
262- let post_context_instructions = instructions
258+ let processed_instructions = instructions
263259
264- if ( pre_context_instructions . includes ( '#Changes:' ) ) {
265- pre_context_instructions = await replace_changes_symbol ( {
266- instruction : pre_context_instructions ,
267- workspace_provider : params . file_tree_provider
268- } )
269- post_context_instructions = await replace_changes_symbol ( {
270- instruction : post_context_instructions ,
271- after_context : true ,
260+ if ( processed_instructions . includes ( '#Changes:' ) ) {
261+ processed_instructions = await replace_changes_symbol ( {
262+ instruction : processed_instructions ,
272263 workspace_provider : params . file_tree_provider
273264 } )
274265 }
275266
276- if ( pre_context_instructions . includes ( '#Commit:' ) ) {
277- pre_context_instructions = await replace_commit_symbol ( {
278- instruction : pre_context_instructions
279- } )
280- post_context_instructions = await replace_commit_symbol ( {
281- instruction : post_context_instructions ,
282- after_context : true
267+ if ( processed_instructions . includes ( '#Commit:' ) ) {
268+ processed_instructions = await replace_commit_symbol ( {
269+ instruction : processed_instructions
283270 } )
284271 }
285272
286- if ( pre_context_instructions . includes ( '#ContextAtCommit:' ) ) {
287- pre_context_instructions = await replace_context_at_commit_symbol ( {
288- instruction : pre_context_instructions ,
289- workspace_provider : params . file_tree_provider
290- } )
291- post_context_instructions = await replace_context_at_commit_symbol ( {
292- instruction : post_context_instructions ,
293- after_context : true ,
273+ if ( processed_instructions . includes ( '#ContextAtCommit:' ) ) {
274+ processed_instructions = await replace_context_at_commit_symbol ( {
275+ instruction : processed_instructions ,
294276 workspace_provider : params . file_tree_provider
295277 } )
296278 }
297279
298- if ( pre_context_instructions . includes ( '#SavedContext:' ) ) {
299- pre_context_instructions = await replace_saved_context_placeholder ( {
300- instruction : pre_context_instructions ,
301- context : params . context ,
302- workspace_provider : params . file_tree_provider
303- } )
304- post_context_instructions = await replace_saved_context_placeholder ( {
305- instruction : post_context_instructions ,
280+ if ( processed_instructions . includes ( '#SavedContext:' ) ) {
281+ processed_instructions = await replace_saved_context_placeholder ( {
282+ instruction : processed_instructions ,
306283 context : params . context ,
307284 workspace_provider : params . file_tree_provider ,
308- just_opening_tag : true
309285 } )
310286 }
311287
@@ -380,26 +356,17 @@ const perform_context_editing = async (params: {
380356 } [ edit_format ]
381357 const edit_format_instructions =
382358 config . get < string > ( instructions_key ) || default_instructions
383- let loop_pre_context_instructions = pre_context_instructions
384- let loop_post_context_instructions = post_context_instructions
385359
360+ let system_instructions_xml = ''
386361 if ( edit_format_instructions ) {
387- const system_instructions = `<system>\n${ edit_format_instructions } \n</system>`
388- loop_pre_context_instructions += `\n${ system_instructions } `
389- loop_post_context_instructions = `${ system_instructions } \n${ loop_post_context_instructions } `
362+ system_instructions_xml = `<system>\n${ edit_format_instructions } \n</system>`
390363 }
391364
392- // Use instructions placement setting to determine message structure
393- const instructions_placement =
394- edit_context_config . instructions_placement || 'above-and-below'
395- let content : string
396- if ( instructions_placement == 'below-only' ) {
397- // Place instructions only below context for better caching
398- content = `${ files } \n${ loop_post_context_instructions } `
399- } else {
400- // Default: place instructions above and below context for better adherence
401- content = `${ loop_pre_context_instructions } \n${ files } \n${ loop_post_context_instructions } `
402- }
365+ const content = `${
366+ system_instructions_xml ? system_instructions_xml + '\n' : ''
367+ } ${ files } \n${
368+ system_instructions_xml ? system_instructions_xml + '\n' : ''
369+ } ${ processed_instructions } `
403370
404371 const system_instructions = vscode . workspace
405372 . getConfiguration ( 'codeWebChat' )
0 commit comments