3
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
+ import { Action } from 'vs/base/common/actions' ;
6
7
import { CancellationToken , CancellationTokenSource } from 'vs/base/common/cancellation' ;
7
8
import { ErrorNoTelemetry } from 'vs/base/common/errors' ;
8
9
import { Emitter , Event } from 'vs/base/common/event' ;
@@ -13,9 +14,10 @@ import { revive } from 'vs/base/common/marshalling';
13
14
import { StopWatch } from 'vs/base/common/stopwatch' ;
14
15
import { URI , UriComponents } from 'vs/base/common/uri' ;
15
16
import { localize } from 'vs/nls' ;
16
- import { CommandsRegistry } from 'vs/platform/commands/common/commands' ;
17
+ import { CommandsRegistry , ICommandService } from 'vs/platform/commands/common/commands' ;
17
18
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
18
19
import { ILogService } from 'vs/platform/log/common/log' ;
20
+ import { INotificationService , Severity } from 'vs/platform/notification/common/notification' ;
19
21
import { Progress } from 'vs/platform/progress/common/progress' ;
20
22
import { IStorageService , StorageScope , StorageTarget } from 'vs/platform/storage/common/storage' ;
21
23
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
@@ -145,7 +147,9 @@ export class ChatService extends Disposable implements IChatService {
145
147
@IWorkspaceContextService private readonly workspaceContextService : IWorkspaceContextService ,
146
148
@IChatSlashCommandService private readonly chatSlashCommandService : IChatSlashCommandService ,
147
149
@IChatVariablesService private readonly chatVariablesService : IChatVariablesService ,
148
- @IChatAgentService private readonly chatAgentService : IChatAgentService
150
+ @IChatAgentService private readonly chatAgentService : IChatAgentService ,
151
+ @INotificationService private readonly notificationService : INotificationService ,
152
+ @ICommandService private readonly commandService : ICommandService ,
149
153
) {
150
154
super ( ) ;
151
155
@@ -349,6 +353,17 @@ export class ChatService extends Disposable implements IChatService {
349
353
const defaultAgent = this . chatAgentService . getActivatedAgents ( ) . find ( agent => agent . id === defaultAgentData . id ) ;
350
354
if ( ! defaultAgent ) {
351
355
// Should have been registered during activation above!
356
+ this . notificationService . notify ( {
357
+ severity : Severity . Error ,
358
+ message : localize ( 'chatFailErrorMessage' , "Chat failed to load. Please ensure that the GitHub Copilot Chat extension is up to date." ) ,
359
+ actions : {
360
+ primary : [
361
+ new Action ( 'showExtension' , localize ( 'action.showExtension' , "Show Extension" ) , undefined , true , ( ) => {
362
+ return this . commandService . executeCommand ( 'workbench.extensions.action.showExtensionsWithIds' , [ 'GitHub.copilot-chat' ] ) ;
363
+ } )
364
+ ]
365
+ }
366
+ } ) ;
352
367
throw new ErrorNoTelemetry ( 'No default agent registered' ) ;
353
368
}
354
369
const welcomeMessage = model . welcomeMessage ? undefined : await defaultAgent . provideWelcomeMessage ?.( model . initialLocation , token ) ?? undefined ;
0 commit comments