@@ -1586,6 +1586,11 @@ export class ChatWidget extends Disposable implements IChatWidget {
15861586 }
15871587
15881588 private async _applyPromptFileIfSet ( requestInput : IChatRequestInputOptions ) : Promise < IPromptParserResult | undefined > {
1589+ if ( ! PromptsConfig . enabled ( this . configurationService ) ) {
1590+ // if prompts are not enabled, we don't need to do anything
1591+ return undefined ;
1592+ }
1593+
15891594
15901595 let parseResult : IPromptParserResult | undefined ;
15911596
@@ -1656,8 +1661,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
16561661
16571662 const isUserQuery = ! query ;
16581663
1659- const instructionsEnabled = PromptsConfig . enabled ( this . configurationService ) ;
1660- if ( instructionsEnabled && ! this . viewModel . editing ) {
1664+ if ( ! this . viewModel . editing ) {
16611665 // process the prompt command
16621666 await this . _applyPromptFileIfSet ( requestInputs ) ;
16631667 await this . _autoAttachInstructions ( requestInputs ) ;
@@ -1999,14 +2003,22 @@ export class ChatWidget extends Disposable implements IChatWidget {
19992003 * - instructions referenced in an already included instruction file
20002004 */
20012005 private async _autoAttachInstructions ( { attachedContext } : IChatRequestInputOptions ) : Promise < void > {
2002- let readFileTool = this . toolsService . getToolByName ( 'readFile' ) ;
2003- const enablementMap = this . input . selectedToolsModel . enablementMap . get ( ) ;
2004- if ( readFileTool && Iterable . some ( enablementMap , ( [ tool , enabled ] ) => tool . id === readFileTool ! . id && enabled === false ) ) {
2005- readFileTool = undefined ;
2006- }
2006+ const promptsConfigEnabled = PromptsConfig . enabled ( this . configurationService ) ;
2007+ this . logService . debug ( `ChatWidget#_autoAttachInstructions: ${ PromptsConfig . KEY } : ${ promptsConfigEnabled } ` ) ;
2008+
2009+ if ( promptsConfigEnabled ) {
2010+ let readFileTool = this . toolsService . getToolByName ( 'readFile' ) ;
2011+ const enablementMap = this . input . selectedToolsModel . enablementMap . get ( ) ;
2012+ if ( readFileTool && Iterable . some ( enablementMap , ( [ tool , enabled ] ) => tool . id === readFileTool ! . id && enabled === false ) ) {
2013+ readFileTool = undefined ;
2014+ }
20072015
2008- const computer = this . instantiationService . createInstance ( ComputeAutomaticInstructions , readFileTool ) ;
2009- await computer . collect ( attachedContext , CancellationToken . None ) ;
2016+ const computer = this . instantiationService . createInstance ( ComputeAutomaticInstructions , readFileTool ) ;
2017+ await computer . collect ( attachedContext , CancellationToken . None ) ;
2018+ } else {
2019+ const computer = this . instantiationService . createInstance ( ComputeAutomaticInstructions , undefined ) ;
2020+ await computer . collectCopilotInstructionsOnly ( attachedContext , CancellationToken . None ) ;
2021+ }
20102022
20112023 // add to attached list to make the instructions sticky
20122024 //this.inputPart.attachmentModel.addContext(...computer.autoAddedInstructions);
0 commit comments