@@ -1565,6 +1565,11 @@ export class ChatWidget extends Disposable implements IChatWidget {
15651565 }
15661566
15671567 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+
15681573
15691574 let parseResult : IPromptParserResult | undefined ;
15701575
@@ -1635,12 +1640,9 @@ export class ChatWidget extends Disposable implements IChatWidget {
16351640
16361641 const isUserQuery = ! query ;
16371642
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 ) ;
16441646
16451647 if ( this . viewOptions . enableWorkingSet !== undefined && this . input . currentModeKind === ChatModeKind . Edit && ! this . chatService . edits2Enabled ) {
16461648 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 {
19801982 * - instructions referenced in an already included instruction file
19811983 */
19821984 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 } ` ) ;
19871987
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+ }
19902000
19912001 // add to attached list to make the instructions sticky
19922002 //this.inputPart.attachmentModel.addContext(...computer.autoAddedInstructions);
0 commit comments