@@ -54,6 +54,7 @@ export interface ISelectOptions {
5454 readonly optionRename ?: boolean ;
5555 readonly optionCopy ?: boolean ;
5656 readonly optionVisibility ?: boolean ;
57+ readonly optionRun ?: boolean ;
5758}
5859
5960export interface ISelectPromptResult {
@@ -323,6 +324,11 @@ const MAKE_INVISIBLE_BUTTON: IQuickInputButton = {
323324 iconClass : ThemeIcon . asClassName ( Codicon . eye ) ,
324325} ;
325326
327+ const RUN_IN_CHAT_BUTTON : IQuickInputButton = {
328+ tooltip : localize ( 'runInChat' , "Run in Chat View" ) ,
329+ iconClass : ThemeIcon . asClassName ( Codicon . play ) ,
330+ } ;
331+
326332export class PromptFilePickers {
327333 constructor (
328334 @IQuickInputService private readonly _quickInputService : IQuickInputService ,
@@ -425,6 +431,9 @@ export class PromptFilePickers {
425431
426432 private async _createPromptPickItems ( options : ISelectOptions , token : CancellationToken ) : Promise < ( IPromptPickerQuickPickItem | IQuickPickSeparator ) [ ] > {
427433 const buttons : IQuickInputButton [ ] = [ ] ;
434+ if ( options . type === PromptsType . prompt && options . optionRun !== false ) {
435+ buttons . push ( RUN_IN_CHAT_BUTTON ) ;
436+ }
428437 if ( options . optionEdit !== false ) {
429438 buttons . push ( EDIT_BUTTON ) ;
430439 }
@@ -481,6 +490,9 @@ export class PromptFilePickers {
481490 const exts = ( await this . _promptsService . listPromptFilesForStorage ( options . type , PromptsStorage . extension , token ) ) . filter ( isExtensionPromptPath ) ;
482491 if ( exts . length ) {
483492 const extButtons : IQuickInputButton [ ] = [ ] ;
493+ if ( options . type === PromptsType . prompt && options . optionRun !== false ) {
494+ extButtons . push ( RUN_IN_CHAT_BUTTON ) ;
495+ }
484496 if ( options . optionEdit !== false ) {
485497 extButtons . push ( EDIT_BUTTON ) ;
486498 }
@@ -613,6 +625,15 @@ export class PromptFilePickers {
613625 }
614626 const value = item . promptFileUri ;
615627
628+ if ( button === RUN_IN_CHAT_BUTTON ) {
629+ const commandId = quickPick . keyMods . ctrlCmd === true
630+ ? 'workbench.action.chat.run-in-new-chat.prompt.current'
631+ : 'workbench.action.chat.run.prompt.current' ;
632+ await this . _commandService . executeCommand ( commandId , value ) ;
633+ quickPick . hide ( ) ;
634+ return false ;
635+ }
636+
616637 // `edit` button was pressed, open the prompt file in editor
617638 if ( button === EDIT_BUTTON ) {
618639 await this . _openerService . open ( value ) ;
@@ -710,7 +731,8 @@ export class PromptFilePickers {
710731 optionDelete : true ,
711732 optionRename : true ,
712733 optionCopy : true ,
713- optionVisibility : false
734+ optionVisibility : false ,
735+ optionRun : false
714736 } ;
715737
716738 try {
0 commit comments