@@ -137,6 +137,11 @@ export interface IWorkingSetEntry {
137137 uri : URI ;
138138}
139139
140+ interface ICustomMode {
141+ mode : string ;
142+ argumentHint ?: string ;
143+ }
144+
140145const GlobalLastChatModeKey = 'chat.lastChatMode' ;
141146
142147export class ChatInputPart extends Disposable implements IHistoryNavigationWidget {
@@ -319,13 +324,18 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
319324 readonly onDidChangeCurrentChatMode : Event < void > = this . _onDidChangeCurrentChatMode . event ;
320325
321326 private readonly _currentModeObservable : ISettableObservable < IChatMode > ;
327+ private readonly _currentModeLabelObservable : ISettableObservable < ICustomMode > ;
322328 public get currentModeKind ( ) : ChatModeKind {
323329 const mode = this . _currentModeObservable . get ( ) ;
324330 return mode . kind === ChatModeKind . Agent && ! this . agentService . hasToolsAgent ?
325331 ChatModeKind . Edit :
326332 mode . kind ;
327333 }
328334
335+ public get currentModeLabel ( ) : IObservable < ICustomMode > {
336+ return this . _currentModeLabelObservable ;
337+ }
338+
329339 public get currentModeObs ( ) : IObservable < IChatMode > {
330340 return this . _currentModeObservable ;
331341 }
@@ -425,6 +435,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
425435 super ( ) ;
426436 this . _contextResourceLabels = this . _register ( this . instantiationService . createInstance ( ResourceLabels , { onDidChangeVisibility : this . _onDidChangeVisibility . event } ) ) ;
427437 this . _currentModeObservable = observableValue < IChatMode > ( 'currentMode' , this . options . defaultMode ?? ChatMode . Agent ) ;
438+ this . _currentModeLabelObservable = observableValue < ICustomMode > ( 'currentModeLabel' , { mode : ( this . options . defaultMode ?? ChatMode . Agent ) . label , argumentHint : ( this . options . defaultMode ?? ChatMode . Agent ) . description . get ( ) } ) ;
428439
429440 this . _register ( this . editorService . onDidActiveEditorChange ( ( ) => {
430441 this . _indexOfLastOpenedContext = - 1 ;
@@ -746,6 +757,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
746757 }
747758
748759 this . _currentModeObservable . set ( mode , undefined ) ;
760+ this . _currentModeLabelObservable . set ( { mode : mode . label , argumentHint : mode . argumentHint ?. get ( ) } , undefined ) ;
749761 this . chatModeKindKey . set ( mode . kind ) ;
750762 this . _onDidChangeCurrentChatMode . fire ( ) ;
751763
@@ -798,23 +810,29 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
798810 if ( verbose ) {
799811 kbLabel = this . keybindingService . lookupKeybinding ( AccessibilityCommandId . OpenAccessibilityHelp ) ?. getLabel ( ) ;
800812 }
813+ const mode = this . _currentModeObservable . get ( ) ;
801814
802815 // Include model information if available
803816 const modelName = this . _currentLanguageModel ?. metadata . name ;
804817 const modelInfo = modelName ? localize ( 'chatInput.model' , ", {0}. " , modelName ) : '' ;
805818
806819 let modeLabel = '' ;
807- switch ( this . currentModeKind ) {
808- case ChatModeKind . Agent :
809- modeLabel = localize ( 'chatInput.mode.agent' , "(Agent), edit files in your workspace." ) ;
810- break ;
811- case ChatModeKind . Edit :
812- modeLabel = localize ( 'chatInput.mode.edit' , "(Edit), edit files in your workspace." ) ;
813- break ;
814- case ChatModeKind . Ask :
815- default :
816- modeLabel = localize ( 'chatInput.mode.ask' , "(Ask), ask questions or type / for topics." ) ;
817- break ;
820+ if ( ! mode . isBuiltin ) {
821+ const mode = this . currentModeLabel . get ( ) ;
822+ modeLabel = localize ( 'chatInput.mode.custom' , "({0}), {1}" , mode . mode , mode . argumentHint ) ;
823+ } else {
824+ switch ( this . currentModeKind ) {
825+ case ChatModeKind . Agent :
826+ modeLabel = localize ( 'chatInput.mode.agent' , "(Agent), edit files in your workspace." ) ;
827+ break ;
828+ case ChatModeKind . Edit :
829+ modeLabel = localize ( 'chatInput.mode.edit' , "(Edit), edit files in your workspace." ) ;
830+ break ;
831+ case ChatModeKind . Ask :
832+ default :
833+ modeLabel = localize ( 'chatInput.mode.ask' , "(Ask), ask questions or type / for topics." ) ;
834+ break ;
835+ }
818836 }
819837 if ( verbose ) {
820838 return kbLabel
0 commit comments