@@ -612,7 +612,9 @@ export class PromptsService extends Disposable implements IPromptsService {
612612 const parsedPromptFile = await this . parseNew ( promptPath . uri , token ) ;
613613 const name = parsedPromptFile ?. header ?. name ?? promptPath . name ?? getCleanPromptName ( promptPath . uri ) ;
614614 const description = parsedPromptFile ?. header ?. description ?? promptPath . description ;
615- return { status : 'loaded' , promptPath : this . withPromptPathMetadata ( promptPath , name , description ) , parsedPromptFile } satisfies ISlashCommandDiscoveryResult ;
615+ const argumentHint = parsedPromptFile ?. header ?. argumentHint ;
616+ const userInvocable = parsedPromptFile ?. header ?. userInvocable ;
617+ return { status : 'loaded' , promptPath : this . withPromptPathMetadata ( promptPath , name , description ) , argumentHint, userInvocable } satisfies ISlashCommandDiscoveryResult ;
616618 } catch ( e ) {
617619 this . logger . error ( `[computeSlashCommandDiscoveryInfo] Failed to parse prompt file for slash command: ${ promptPath . uri } ` , e instanceof Error ? e . message : String ( e ) ) ;
618620 return { status : 'skipped' , skipReason : 'parse-error' , errorMessage : e instanceof Error ? e . message : String ( e ) , promptPath } satisfies ISlashCommandDiscoveryResult ;
@@ -639,8 +641,8 @@ export class PromptsService extends Disposable implements IPromptsService {
639641 const seen = new ResourceSet ( ) ;
640642
641643 for ( const file of discoveryInfo . files ) {
642- if ( file . status === 'loaded' && file . parsedPromptFile ) {
643- result . push ( this . asChatPromptSlashCommand ( file . parsedPromptFile , file . promptPath ) ) ;
644+ if ( file . status === 'loaded' ) {
645+ result . push ( this . asChatPromptSlashCommand ( file . argumentHint , file . userInvocable , file . promptPath ) ) ;
644646 seen . add ( file . promptPath . uri ) ;
645647 }
646648 }
@@ -649,7 +651,9 @@ export class PromptsService extends Disposable implements IPromptsService {
649651 for ( const model of this . modelService . getModels ( ) ) {
650652 if ( model . getLanguageId ( ) === PROMPT_LANGUAGE_ID && model . uri . scheme === Schemas . untitled && ! seen . has ( model . uri ) ) {
651653 const parsedPromptFile = this . getParsedPromptFile ( model ) ;
652- result . push ( this . asChatPromptSlashCommand ( parsedPromptFile , { uri : model . uri , storage : PromptsStorage . local , type : PromptsType . prompt } ) ) ;
654+ const name = parsedPromptFile ?. header ?. name ?? getCleanPromptName ( model . uri ) ;
655+ const description = parsedPromptFile ?. header ?. description ;
656+ result . push ( this . asChatPromptSlashCommand ( parsedPromptFile ?. header ?. argumentHint , parsedPromptFile ?. header ?. userInvocable , { uri : model . uri , storage : PromptsStorage . local , type : PromptsType . prompt , name, description } ) ) ;
653657 }
654658 }
655659
@@ -672,8 +676,8 @@ export class PromptsService extends Disposable implements IPromptsService {
672676 return undefined ;
673677 }
674678
675- private asChatPromptSlashCommand ( parsedPromptFile : ParsedPromptFile , promptPath : IPromptPath ) : IChatPromptSlashCommand {
676- let name = parsedPromptFile ?. header ?. name ?? promptPath . name ?? getCleanPromptName ( promptPath . uri ) ;
679+ private asChatPromptSlashCommand ( argumentHint : string | undefined , userInvocable : boolean | undefined , promptPath : IPromptPath ) : IChatPromptSlashCommand {
680+ let name = promptPath . name ?? getCleanPromptName ( promptPath . uri ) ;
677681 name = name . replace ( / [ ^ \p{ L} \d _ \- \. : ] + / gu, '-' ) ; // replace spaces with dashes
678682 return {
679683 uri : promptPath . uri ,
@@ -683,9 +687,9 @@ export class PromptsService extends Disposable implements IPromptsService {
683687 type : promptPath . type ,
684688 extension : promptPath . extension ,
685689 pluginUri : promptPath . pluginUri ,
686- description : parsedPromptFile ?. header ?. description ?? promptPath . description ,
687- argumentHint : parsedPromptFile ?. header ?. argumentHint ,
688- userInvocable : parsedPromptFile ?. header ?. userInvocable ?? true ,
690+ description : promptPath . description ,
691+ argumentHint : argumentHint ,
692+ userInvocable : userInvocable ?? true ,
689693 when : undefined ,
690694 } ;
691695 }
0 commit comments