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 { Emitter , Event } from 'vs/base/common/event' ;
8
9
import { MarkdownString } from 'vs/base/common/htmlContent' ;
@@ -12,10 +13,11 @@ import { revive } from 'vs/base/common/marshalling';
12
13
import { StopWatch } from 'vs/base/common/stopwatch' ;
13
14
import { URI , UriComponents } from 'vs/base/common/uri' ;
14
15
import { localize } from 'vs/nls' ;
15
- import { CommandsRegistry } from 'vs/platform/commands/common/commands' ;
16
+ import { CommandsRegistry , ICommandService } from 'vs/platform/commands/common/commands' ;
16
17
import { IContextKey , IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
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' ;
@@ -167,7 +169,9 @@ export class ChatService extends Disposable implements IChatService {
167
169
@IWorkspaceContextService private readonly workspaceContextService : IWorkspaceContextService ,
168
170
@IChatSlashCommandService private readonly chatSlashCommandService : IChatSlashCommandService ,
169
171
@IChatVariablesService private readonly chatVariablesService : IChatVariablesService ,
170
- @IChatAgentService private readonly chatAgentService : IChatAgentService
172
+ @IChatAgentService private readonly chatAgentService : IChatAgentService ,
173
+ @INotificationService private readonly notificationService : INotificationService ,
174
+ @ICommandService private readonly commandService : ICommandService ,
171
175
) {
172
176
super ( ) ;
173
177
@@ -396,6 +400,17 @@ export class ChatService extends Disposable implements IChatService {
396
400
397
401
const defaultAgent = this . chatAgentService . getDefaultAgent ( ) ;
398
402
if ( ! defaultAgent ) {
403
+ this . notificationService . notify ( {
404
+ severity : Severity . Error ,
405
+ message : localize ( 'chatFailErrorMessage' , "Chat failed to load. Please ensure that the GitHub Copilot Chat extension is up to date." ) ,
406
+ actions : {
407
+ primary : [
408
+ new Action ( 'showExtension' , localize ( 'action.showExtension' , "Show Extension" ) , undefined , true , ( ) => {
409
+ return this . commandService . executeCommand ( 'workbench.extensions.action.showExtensionsWithIds' , [ 'GitHub.copilot-chat' ] ) ;
410
+ } )
411
+ ]
412
+ }
413
+ } ) ;
399
414
throw new Error ( 'No default agent' ) ;
400
415
}
401
416
0 commit comments