Skip to content

Commit aa25485

Browse files
authored
Add error message for chat loading (microsoft#208929)
1 parent 62f69a3 commit aa25485

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-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 { ErrorNoTelemetry } from 'vs/base/common/errors';
89
import { Emitter, Event } from 'vs/base/common/event';
@@ -13,10 +14,11 @@ import { revive } from 'vs/base/common/marshalling';
1314
import { StopWatch } from 'vs/base/common/stopwatch';
1415
import { URI, UriComponents } from 'vs/base/common/uri';
1516
import { localize } from 'vs/nls';
16-
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
17+
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
1718
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
1819
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
1920
import { ILogService } from 'vs/platform/log/common/log';
21+
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
2022
import { Progress } from 'vs/platform/progress/common/progress';
2123
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
2224
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@@ -168,7 +170,9 @@ export class ChatService extends Disposable implements IChatService {
168170
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
169171
@IChatSlashCommandService private readonly chatSlashCommandService: IChatSlashCommandService,
170172
@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,
172176
) {
173177
super();
174178

@@ -385,6 +389,17 @@ export class ChatService extends Disposable implements IChatService {
385389

386390
const defaultAgent = this.chatAgentService.getDefaultAgent(ChatAgentLocation.Panel);
387391
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+
});
388403
throw new ErrorNoTelemetry('No default agent');
389404
}
390405

src/vs/workbench/contrib/inlineChat/test/browser/inlineChatController.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ import { IViewsService } from 'vs/workbench/services/views/common/viewsService';
5858
import { ChatSlashCommandService, IChatSlashCommandService } from 'vs/workbench/contrib/chat/common/chatSlashCommands';
5959
import { ChatWidgetService } from 'vs/workbench/contrib/chat/browser/chatWidget';
6060
import { ChatWidgetHistoryService, IChatWidgetHistoryService } from 'vs/workbench/contrib/chat/common/chatWidgetHistoryService';
61+
import { ICommandService } from 'vs/platform/commands/common/commands';
62+
import { TestCommandService } from 'vs/editor/test/browser/editorTestServices';
6163

6264
suite('InteractiveChatController', function () {
6365
class TestController extends InlineChatController {
@@ -136,6 +138,7 @@ suite('InteractiveChatController', function () {
136138
[IInlineChatService, new SyncDescriptor(InlineChatServiceImpl)],
137139
[IDiffProviderFactoryService, new SyncDescriptor(TestDiffProviderFactoryService)],
138140
[IInlineChatSessionService, new SyncDescriptor(InlineChatSessionServiceImpl)],
141+
[ICommandService, new SyncDescriptor(TestCommandService)],
139142
[IInlineChatSavingService, new class extends mock<IInlineChatSavingService>() {
140143
override markChanged(session: Session): void {
141144
// noop

src/vs/workbench/contrib/inlineChat/test/browser/inlineChatSession.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ import { IViewsService } from 'vs/workbench/services/views/common/viewsService';
6060
import { TestExtensionService, TestContextService } from 'vs/workbench/test/common/workbenchTestServices';
6161
import { IChatAgentService, ChatAgentService, ChatAgentLocation } from 'vs/workbench/contrib/chat/common/chatAgents';
6262
import { MockChatContributionService } from 'vs/workbench/contrib/chat/test/common/mockChatContributionService';
63+
import { ICommandService } from 'vs/platform/commands/common/commands';
64+
import { TestCommandService } from 'vs/editor/test/browser/editorTestServices';
6365

6466

6567
suite('ReplyResponse', function () {
@@ -134,6 +136,7 @@ suite('InlineChatSession', function () {
134136
[IContextKeyService, contextKeyService],
135137
[IDiffProviderFactoryService, new SyncDescriptor(TestDiffProviderFactoryService)],
136138
[IInlineChatSessionService, new SyncDescriptor(InlineChatSessionServiceImpl)],
139+
[ICommandService, new SyncDescriptor(TestCommandService)],
137140
[IInlineChatSavingService, new class extends mock<IInlineChatSavingService>() {
138141
override markChanged(session: Session): void {
139142
// noop

0 commit comments

Comments
 (0)