@@ -54,7 +54,6 @@ class AbstractNewPromptFileAction extends Action2 {
54
54
const commandService = accessor . get ( ICommandService ) ;
55
55
const notificationService = accessor . get ( INotificationService ) ;
56
56
const userDataSyncEnablementService = accessor . get ( IUserDataSyncEnablementService ) ;
57
- const snippetService = accessor . get ( ISnippetsService ) ;
58
57
const editorService = accessor . get ( IEditorService ) ;
59
58
const fileService = accessor . get ( IFileService ) ;
60
59
const instaService = accessor . get ( IInstantiationService ) ;
@@ -80,15 +79,10 @@ class AbstractNewPromptFileAction extends Action2 {
80
79
81
80
const editor = getCodeEditor ( editorService . activeTextEditorControl ) ;
82
81
if ( editor && editor . hasModel ( ) && isEqual ( editor . getModel ( ) . uri , promptUri ) ) {
83
- const languageId = getLanguageIdForPromptsType ( this . type ) ;
84
-
85
- const snippets = await snippetService . getSnippets ( languageId , { fileTemplateSnippets : true , noRecencySort : true , includeNoPrefixSnippets : true } ) ;
86
- if ( snippets . length > 0 ) {
87
- SnippetController2 . get ( editor ) ?. apply ( [ {
88
- range : editor . getModel ( ) . getFullModelRange ( ) ,
89
- template : snippets [ 0 ] . body
90
- } ] ) ;
91
- }
82
+ SnippetController2 . get ( editor ) ?. apply ( [ {
83
+ range : editor . getModel ( ) . getFullModelRange ( ) ,
84
+ template : getDefaultContentSnippet ( this . type ) ,
85
+ } ] ) ;
92
86
}
93
87
94
88
if ( selectedFolder . storage !== 'user' ) {
@@ -145,6 +139,33 @@ class AbstractNewPromptFileAction extends Action2 {
145
139
}
146
140
}
147
141
142
+ function getDefaultContentSnippet ( promptType : PromptsType ) : string {
143
+ switch ( promptType ) {
144
+ case PromptsType . prompt :
145
+ return [
146
+ `---` ,
147
+ `mode: \${1|ask,edit,agent|}` ,
148
+ `---` ,
149
+ `\${2:Expected output and any relevant constraints for this task.}` ,
150
+ ] . join ( '\n' ) ;
151
+ case PromptsType . instructions :
152
+ return [
153
+ `---` ,
154
+ `applyTo: '\${1|**,**/*.ts|}'` ,
155
+ `---` ,
156
+ `\${2:Coding standards, domain knowledge, and preferences that AI should follow.}` ,
157
+ ] . join ( '\n' ) ;
158
+ case PromptsType . mode :
159
+ return [
160
+ `---` ,
161
+ `description: '\${1:Description of the custom chat mode.}'` ,
162
+ `tools: [ '\${2:tool1}', '\${3:tool2}' ]` ,
163
+ `---` ,
164
+ ] . join ( '\n' ) ;
165
+ default :
166
+ throw new Error ( `Unknown prompt type: ${ promptType } ` ) ;
167
+ }
168
+ }
148
169
149
170
export const NEW_PROMPT_COMMAND_ID = 'workbench.command.new.prompt' ;
150
171
export const NEW_INSTRUCTIONS_COMMAND_ID = 'workbench.command.new.instructions' ;
0 commit comments