@@ -70,7 +70,7 @@ class SlashCommandCompletions extends Disposable {
70
70
71
71
this . _register ( this . languageFeaturesService . completionProvider . register ( { scheme : Schemas . vscodeChatInput , hasAccessToAllModels : true } , {
72
72
_debugDisplayName : 'globalSlashCommands' ,
73
- triggerCharacters : [ '/' ] ,
73
+ triggerCharacters : [ chatSubcommandLeader ] ,
74
74
provideCompletionItems : async ( model : ITextModel , position : Position , _context : CompletionContext , _token : CancellationToken ) => {
75
75
const widget = this . chatWidgetService . getWidgetByInputUri ( model . uri ) ;
76
76
if ( ! widget || ! widget . viewModel ) {
@@ -158,7 +158,7 @@ class SlashCommandCompletions extends Disposable {
158
158
} ) ) ;
159
159
this . _register ( this . languageFeaturesService . completionProvider . register ( { scheme : Schemas . vscodeChatInput , hasAccessToAllModels : true } , {
160
160
_debugDisplayName : 'promptSlashCommands' ,
161
- triggerCharacters : [ '/' ] ,
161
+ triggerCharacters : [ chatSubcommandLeader ] ,
162
162
provideCompletionItems : async ( model : ITextModel , position : Position , _context : CompletionContext , _token : CancellationToken ) => {
163
163
const widget = this . chatWidgetService . getWidgetByInputUri ( model . uri ) ;
164
164
if ( ! widget || ! widget . viewModel ) {
@@ -206,7 +206,7 @@ class SlashCommandCompletions extends Disposable {
206
206
207
207
this . _register ( this . languageFeaturesService . completionProvider . register ( { scheme : Schemas . vscodeChatInput , hasAccessToAllModels : true } , {
208
208
_debugDisplayName : 'mcpPromptSlashCommands' ,
209
- triggerCharacters : [ '/' ] ,
209
+ triggerCharacters : [ chatSubcommandLeader ] ,
210
210
provideCompletionItems : async ( model : ITextModel , position : Position , _context : CompletionContext , _token : CancellationToken ) => {
211
211
const widget = this . chatWidgetService . getWidgetByInputUri ( model . uri ) ;
212
212
if ( ! widget || ! widget . viewModel ) {
@@ -259,7 +259,7 @@ class AgentCompletions extends Disposable {
259
259
260
260
const subCommandProvider : CompletionItemProvider = {
261
261
_debugDisplayName : 'chatAgentSubcommand' ,
262
- triggerCharacters : [ '/' ] ,
262
+ triggerCharacters : [ chatSubcommandLeader ] ,
263
263
provideCompletionItems : async ( model : ITextModel , position : Position , _context : CompletionContext , token : CancellationToken ) => {
264
264
const widget = this . chatWidgetService . getWidgetByInputUri ( model . uri ) ;
265
265
if ( ! widget || ! widget . viewModel ) {
@@ -329,7 +329,7 @@ class AgentCompletions extends Disposable {
329
329
}
330
330
331
331
const agents = this . chatAgentService . getAgents ( )
332
- . filter ( a => a . locations . includes ( widget . location ) && a . modes . includes ( widget . input . currentMode ) ) ;
332
+ . filter ( a => a . locations . includes ( widget . location ) ) ;
333
333
334
334
// When the input is only `/`, items are sorted by sortText.
335
335
// When typing, filterText is used to score and sort.
@@ -527,6 +527,10 @@ class AssignSelectedAgentAction extends Action2 {
527
527
return ;
528
528
}
529
529
530
+ if ( ! arg . agent . modes . includes ( arg . widget . input . currentMode ) ) {
531
+ arg . widget . input . setChatMode ( arg . agent . modes [ 0 ] ) ;
532
+ }
533
+
530
534
arg . widget . lastSelectedAgent = arg . agent ;
531
535
}
532
536
}
0 commit comments