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,10 +14,11 @@ 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 { IContextKey , IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
18
19
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
19
20
import { ILogService } from 'vs/platform/log/common/log' ;
21
+ import { INotificationService , Severity } from 'vs/platform/notification/common/notification' ;
20
22
import { Progress } from 'vs/platform/progress/common/progress' ;
21
23
import { IStorageService , StorageScope , StorageTarget } from 'vs/platform/storage/common/storage' ;
22
24
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
@@ -168,7 +170,9 @@ export class ChatService extends Disposable implements IChatService {
168
170
@IWorkspaceContextService private readonly workspaceContextService : IWorkspaceContextService ,
169
171
@IChatSlashCommandService private readonly chatSlashCommandService : IChatSlashCommandService ,
170
172
@IChatVariablesService private readonly chatVariablesService : IChatVariablesService ,
171
- @IChatAgentService private readonly chatAgentService : IChatAgentService
173
+ @IChatAgentService private readonly chatAgentService : IChatAgentService ,
174
+ @INotificationService private readonly notificationService : INotificationService ,
175
+ @ICommandService private readonly commandService : ICommandService ,
172
176
) {
173
177
super ( ) ;
174
178
@@ -385,6 +389,17 @@ export class ChatService extends Disposable implements IChatService {
385
389
386
390
const defaultAgent = this . chatAgentService . getDefaultAgent ( ChatAgentLocation . Panel ) ;
387
391
if ( ! defaultAgent ) {
392
+ this . notificationService . notify ( {
393
+ severity : Severity . Error ,
394
+ message : localize ( 'chatFailErrorMessage' , "Chat failed to load. Please ensure that the GitHub Copilot Chat extension is up to date." ) ,
395
+ actions : {
396
+ primary : [
397
+ new Action ( 'showExtension' , localize ( 'action.showExtension' , "Show Extension" ) , undefined , true , ( ) => {
398
+ return this . commandService . executeCommand ( 'workbench.extensions.action.showExtensionsWithIds' , [ 'GitHub.copilot-chat' ] ) ;
399
+ } )
400
+ ]
401
+ }
402
+ } ) ;
388
403
throw new ErrorNoTelemetry ( 'No default agent' ) ;
389
404
}
390
405
0 commit comments