@@ -1586,6 +1586,11 @@ export class ChatWidget extends Disposable implements IChatWidget {
1586
1586
}
1587
1587
1588
1588
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
+
1589
1594
1590
1595
let parseResult : IPromptParserResult | undefined ;
1591
1596
@@ -1656,8 +1661,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
1656
1661
1657
1662
const isUserQuery = ! query ;
1658
1663
1659
- const instructionsEnabled = PromptsConfig . enabled ( this . configurationService ) ;
1660
- if ( instructionsEnabled && ! this . viewModel . editing ) {
1664
+ if ( ! this . viewModel . editing ) {
1661
1665
// process the prompt command
1662
1666
await this . _applyPromptFileIfSet ( requestInputs ) ;
1663
1667
await this . _autoAttachInstructions ( requestInputs ) ;
@@ -1999,14 +2003,22 @@ export class ChatWidget extends Disposable implements IChatWidget {
1999
2003
* - instructions referenced in an already included instruction file
2000
2004
*/
2001
2005
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
+ }
2007
2015
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
+ }
2010
2022
2011
2023
// add to attached list to make the instructions sticky
2012
2024
//this.inputPart.attachmentModel.addContext(...computer.autoAddedInstructions);
0 commit comments