Skip to content

Commit 58e0afc

Browse files
committed
Update prune context instructions to use configurable settings from workspace configuration
1 parent 6b83dda commit 58e0afc

5 files changed

Lines changed: 28 additions & 6 deletions

File tree

‎packages/vscode/package.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,7 @@
687687
},
688688
"codeWebChat.pruneContextInstructions": {
689689
"type": "string",
690-
"scope": "resource",
691-
"default": "Find all files building modules the task touches (including tests, type definitions, etc.)."
690+
"scope": "resource"
692691
},
693692
"codeWebChat.chatPresetsForAskAboutContext": {
694693
"type": "array",

‎packages/vscode/src/views/panel/backend/message-handlers/handle-copy-prompt.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,13 @@ export const handle_copy_prompt = async (params: {
201201
system_instructions_xml = `<system>\n${edit_format_instructions}\n</system>`
202202
}
203203
} else if (is_in_prune_context_prompt_type) {
204-
system_instructions_xml = `${prune_context_instructions}\n${prune_context_format}`
204+
const config = vscode.workspace.getConfiguration('codeWebChat')
205+
const config_prune_instructions = config.get<string>(
206+
'pruneContextInstructions'
207+
)
208+
const instructions_to_use =
209+
config_prune_instructions || prune_context_instructions
210+
system_instructions_xml = `${instructions_to_use}\n${prune_context_format}`
205211
}
206212

207213
const text = context_text

‎packages/vscode/src/views/panel/backend/message-handlers/handle-edit-context.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,12 @@ export const handle_edit_context = async (
418418

419419
let system_instructions_xml = ''
420420
if (is_prune_context) {
421-
system_instructions_xml = `${prune_context_instructions}\n${prune_context_format}`
421+
const config_prune_instructions = config.get<string>(
422+
'pruneContextInstructions'
423+
)
424+
const instructions_to_use =
425+
config_prune_instructions || prune_context_instructions
426+
system_instructions_xml = `${instructions_to_use}\n${prune_context_format}`
422427
} else if (edit_format_instructions) {
423428
system_instructions_xml = `<system>\n${edit_format_instructions}\n</system>`
424429
}

‎packages/vscode/src/views/panel/backend/message-handlers/handle-prune-context.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,13 @@ export const handle_prune_context = async (
383383

384384
const files = `<files>${collected_files}\n</files>`
385385

386-
const system_instructions_xml = `${prune_context_instructions}\n${prune_context_format}`
386+
const config = vscode.workspace.getConfiguration('codeWebChat')
387+
const config_prune_instructions = config.get<string>(
388+
'pruneContextInstructions'
389+
)
390+
const instructions_to_use =
391+
config_prune_instructions || prune_context_instructions
392+
const system_instructions_xml = `${instructions_to_use}\n${prune_context_format}`
387393

388394
const content = `${system_instructions_xml}\n${files}\n${system_instructions_xml}\n${processed_instructions}`
389395

‎packages/vscode/src/views/panel/backend/message-handlers/handle-send-prompt.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,13 @@ export const handle_send_prompt = async (params: {
280280
system_instructions_xml = `<system>\n${edit_format_instructions}\n</system>`
281281
}
282282
} else if (params.panel_provider.web_prompt_type == 'prune-context') {
283-
system_instructions_xml = `${prune_context_instructions}\n${prune_context_format}`
283+
const config = vscode.workspace.getConfiguration('codeWebChat')
284+
const config_prune_instructions = config.get<string>(
285+
'pruneContextInstructions'
286+
)
287+
const instructions_to_use =
288+
config_prune_instructions || prune_context_instructions
289+
system_instructions_xml = `${instructions_to_use}\n${prune_context_format}`
284290
}
285291

286292
return {

0 commit comments

Comments
 (0)