@@ -13,6 +13,7 @@ import { DisposableStore } from '../../../../../../../base/common/lifecycle.js';
13
13
import { dirname , extUri } from '../../../../../../../base/common/resources.js' ;
14
14
import { isLinux , isWindows } from '../../../../../../../base/common/platform.js' ;
15
15
import { ILabelService } from '../../../../../../../platform/label/common/label.js' ;
16
+ import { IOpenerService } from '../../../../../../../platform/opener/common/opener.js' ;
16
17
import { IViewsService } from '../../../../../../services/views/common/viewsService.js' ;
17
18
import { assertDefined , WithUriValue } from '../../../../../../../base/common/types.js' ;
18
19
import { getCleanPromptName } from '../../../../../../../platform/prompts/common/constants.js' ;
@@ -45,6 +46,7 @@ export interface ISelectPromptOptions {
45
46
46
47
readonly labelService : ILabelService ;
47
48
readonly viewsService : IViewsService ;
49
+ readonly openerService : IOpenerService ;
48
50
readonly quickInputService : IQuickInputService ;
49
51
}
50
52
@@ -100,7 +102,7 @@ export const askToSelectPrompt = async (
100
102
}
101
103
102
104
// otherwise show the prompt file selection dialog
103
- const { viewsService } = options ;
105
+ const { viewsService, openerService } = options ;
104
106
105
107
const quickPick = quickInputService . createQuickPick < WithUriValue < IQuickPickItem > > ( ) ;
106
108
quickPick . activeItems = activeItem ? [ activeItem ] : [ ] ;
@@ -124,9 +126,27 @@ export const askToSelectPrompt = async (
124
126
} ) ;
125
127
126
128
disposables . add ( quickPick . onDidAccept ( async ( event ) => {
129
+ const { alt, ctrlCmd } = quickPick . keyMods ;
130
+
131
+ // TODO: @lego - refactor?
132
+ // if `cmd`/`ctrl` key was pressed, open the selected prompt file(s)
133
+ if ( ctrlCmd ) {
134
+ for ( const selectedItem of quickPick . selectedItems ) {
135
+ await openerService . open ( selectedItem . value ) ;
136
+ }
137
+
138
+ // if user submitted their selection, close the dialog
139
+ if ( ! event . inBackground ) {
140
+ disposables . dispose ( ) ;
141
+ }
142
+
143
+ return ;
144
+ }
145
+
146
+ // otherwise attach the selected prompt to a chat input
127
147
lastActiveWidget = await getChatWidgetObject (
128
148
options ,
129
- quickPick . keyMods . alt ,
149
+ alt ,
130
150
viewsService ,
131
151
) ;
132
152
@@ -139,7 +159,7 @@ export const askToSelectPrompt = async (
139
159
140
160
// if user submitted their selection, close the dialog
141
161
if ( ! event . inBackground ) {
142
- return disposables . dispose ( ) ;
162
+ disposables . dispose ( ) ;
143
163
}
144
164
} ) ) ;
145
165
0 commit comments