Skip to content

Commit

Permalink
Add error message for chat loading (#208929)
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens authored Mar 28, 2024
1 parent 62f69a3 commit aa25485
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/vs/workbench/contrib/chat/common/chatServiceImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { Action } from 'vs/base/common/actions';
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
import { ErrorNoTelemetry } from 'vs/base/common/errors';
import { Emitter, Event } from 'vs/base/common/event';
Expand All @@ -13,10 +14,11 @@ import { revive } from 'vs/base/common/marshalling';
import { StopWatch } from 'vs/base/common/stopwatch';
import { URI, UriComponents } from 'vs/base/common/uri';
import { localize } from 'vs/nls';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ILogService } from 'vs/platform/log/common/log';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { Progress } from 'vs/platform/progress/common/progress';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
Expand Down Expand Up @@ -168,7 +170,9 @@ export class ChatService extends Disposable implements IChatService {
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@IChatSlashCommandService private readonly chatSlashCommandService: IChatSlashCommandService,
@IChatVariablesService private readonly chatVariablesService: IChatVariablesService,
@IChatAgentService private readonly chatAgentService: IChatAgentService
@IChatAgentService private readonly chatAgentService: IChatAgentService,
@INotificationService private readonly notificationService: INotificationService,
@ICommandService private readonly commandService: ICommandService,
) {
super();

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

const defaultAgent = this.chatAgentService.getDefaultAgent(ChatAgentLocation.Panel);
if (!defaultAgent) {
this.notificationService.notify({
severity: Severity.Error,
message: localize('chatFailErrorMessage', "Chat failed to load. Please ensure that the GitHub Copilot Chat extension is up to date."),
actions: {
primary: [
new Action('showExtension', localize('action.showExtension', "Show Extension"), undefined, true, () => {
return this.commandService.executeCommand('workbench.extensions.action.showExtensionsWithIds', ['GitHub.copilot-chat']);
})
]
}
});
throw new ErrorNoTelemetry('No default agent');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ import { IViewsService } from 'vs/workbench/services/views/common/viewsService';
import { ChatSlashCommandService, IChatSlashCommandService } from 'vs/workbench/contrib/chat/common/chatSlashCommands';
import { ChatWidgetService } from 'vs/workbench/contrib/chat/browser/chatWidget';
import { ChatWidgetHistoryService, IChatWidgetHistoryService } from 'vs/workbench/contrib/chat/common/chatWidgetHistoryService';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { TestCommandService } from 'vs/editor/test/browser/editorTestServices';

suite('InteractiveChatController', function () {
class TestController extends InlineChatController {
Expand Down Expand Up @@ -136,6 +138,7 @@ suite('InteractiveChatController', function () {
[IInlineChatService, new SyncDescriptor(InlineChatServiceImpl)],
[IDiffProviderFactoryService, new SyncDescriptor(TestDiffProviderFactoryService)],
[IInlineChatSessionService, new SyncDescriptor(InlineChatSessionServiceImpl)],
[ICommandService, new SyncDescriptor(TestCommandService)],
[IInlineChatSavingService, new class extends mock<IInlineChatSavingService>() {
override markChanged(session: Session): void {
// noop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ import { IViewsService } from 'vs/workbench/services/views/common/viewsService';
import { TestExtensionService, TestContextService } from 'vs/workbench/test/common/workbenchTestServices';
import { IChatAgentService, ChatAgentService, ChatAgentLocation } from 'vs/workbench/contrib/chat/common/chatAgents';
import { MockChatContributionService } from 'vs/workbench/contrib/chat/test/common/mockChatContributionService';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { TestCommandService } from 'vs/editor/test/browser/editorTestServices';


suite('ReplyResponse', function () {
Expand Down Expand Up @@ -134,6 +136,7 @@ suite('InlineChatSession', function () {
[IContextKeyService, contextKeyService],
[IDiffProviderFactoryService, new SyncDescriptor(TestDiffProviderFactoryService)],
[IInlineChatSessionService, new SyncDescriptor(InlineChatSessionServiceImpl)],
[ICommandService, new SyncDescriptor(TestCommandService)],
[IInlineChatSavingService, new class extends mock<IInlineChatSavingService>() {
override markChanged(session: Session): void {
// noop
Expand Down

0 comments on commit aa25485

Please sign in to comment.