@@ -1565,6 +1565,11 @@ export class ChatWidget extends Disposable implements IChatWidget {
1565
1565
}
1566
1566
1567
1567
private async _applyPromptFileIfSet ( requestInput : IChatRequestInputOptions ) : Promise < IPromptParserResult | undefined > {
1568
+ if ( ! PromptsConfig . enabled ( this . configurationService ) ) {
1569
+ // if prompts are not enabled, we don't need to do anything
1570
+ return undefined ;
1571
+ }
1572
+
1568
1573
1569
1574
let parseResult : IPromptParserResult | undefined ;
1570
1575
@@ -1635,12 +1640,9 @@ export class ChatWidget extends Disposable implements IChatWidget {
1635
1640
1636
1641
const isUserQuery = ! query ;
1637
1642
1638
- const instructionsEnabled = PromptsConfig . enabled ( this . configurationService ) ;
1639
- if ( instructionsEnabled ) {
1640
- // process the prompt command
1641
- await this . _applyPromptFileIfSet ( requestInputs ) ;
1642
- await this . _autoAttachInstructions ( requestInputs ) ;
1643
- }
1643
+ // process the prompt command and instruction files
1644
+ await this . _applyPromptFileIfSet ( requestInputs ) ;
1645
+ await this . _autoAttachInstructions ( requestInputs ) ;
1644
1646
1645
1647
if ( this . viewOptions . enableWorkingSet !== undefined && this . input . currentModeKind === ChatModeKind . Edit && ! this . chatService . edits2Enabled ) {
1646
1648
const uniqueWorkingSetEntries = new ResourceSet ( ) ; // NOTE: this is used for bookkeeping so the UI can avoid rendering references in the UI that are already shown in the working set
@@ -1980,13 +1982,21 @@ export class ChatWidget extends Disposable implements IChatWidget {
1980
1982
* - instructions referenced in an already included instruction file
1981
1983
*/
1982
1984
private async _autoAttachInstructions ( { attachedContext } : IChatRequestInputOptions ) : Promise < void > {
1983
- let readFileTool = this . toolsService . getToolByName ( 'readFile' ) ;
1984
- if ( readFileTool && this . getUserSelectedTools ( ) ?. [ readFileTool . id ] === false ) {
1985
- readFileTool = undefined ;
1986
- }
1985
+ const promptsConfigEnabled = PromptsConfig . enabled ( this . configurationService ) ;
1986
+ this . logService . debug ( `ChatWidget#_autoAttachInstructions: ${ PromptsConfig . KEY } : ${ promptsConfigEnabled } ` ) ;
1987
1987
1988
- const computer = this . instantiationService . createInstance ( ComputeAutomaticInstructions , readFileTool ) ;
1989
- await computer . collect ( attachedContext , CancellationToken . None ) ;
1988
+ if ( promptsConfigEnabled ) {
1989
+ let readFileTool = this . toolsService . getToolByName ( 'readFile' ) ;
1990
+ if ( readFileTool && this . getUserSelectedTools ( ) ?. [ readFileTool . id ] === false ) {
1991
+ readFileTool = undefined ;
1992
+ }
1993
+
1994
+ const computer = this . instantiationService . createInstance ( ComputeAutomaticInstructions , readFileTool ) ;
1995
+ await computer . collect ( attachedContext , CancellationToken . None ) ;
1996
+ } else {
1997
+ const computer = this . instantiationService . createInstance ( ComputeAutomaticInstructions , undefined ) ;
1998
+ await computer . collectCopilotInstructionsOnly ( attachedContext , CancellationToken . None ) ;
1999
+ }
1990
2000
1991
2001
// add to attached list to make the instructions sticky
1992
2002
//this.inputPart.attachmentModel.addContext(...computer.autoAddedInstructions);
0 commit comments