Skip to content

Commit 019f4d1

Browse files
authored
Show notification when chat fails to load (microsoft#206377)
* Show notification when chat fails to load Fix microsoft#206378 * Update error message
1 parent 41e6018 commit 019f4d1

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/vs/workbench/contrib/chat/common/chatServiceImpl.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import { Action } from 'vs/base/common/actions';
67
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
78
import { Emitter, Event } from 'vs/base/common/event';
89
import { MarkdownString } from 'vs/base/common/htmlContent';
@@ -12,10 +13,11 @@ import { revive } from 'vs/base/common/marshalling';
1213
import { StopWatch } from 'vs/base/common/stopwatch';
1314
import { URI, UriComponents } from 'vs/base/common/uri';
1415
import { localize } from 'vs/nls';
15-
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
16+
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
1617
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
1718
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
1819
import { ILogService } from 'vs/platform/log/common/log';
20+
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
1921
import { Progress } from 'vs/platform/progress/common/progress';
2022
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
2123
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@@ -167,7 +169,9 @@ export class ChatService extends Disposable implements IChatService {
167169
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
168170
@IChatSlashCommandService private readonly chatSlashCommandService: IChatSlashCommandService,
169171
@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,
171175
) {
172176
super();
173177

@@ -396,6 +400,17 @@ export class ChatService extends Disposable implements IChatService {
396400

397401
const defaultAgent = this.chatAgentService.getDefaultAgent();
398402
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+
});
399414
throw new Error('No default agent');
400415
}
401416

0 commit comments

Comments
 (0)