Skip to content

Commit c47a1d8

Browse files
authored
Show proper warning for outdated Copilot Chat in the next build (microsoft#213852)
1 parent 721441c commit c47a1d8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/vs/workbench/contrib/chat/browser/chatParticipantContributions.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ import { ChatAgentLocation, IChatAgentData, IChatAgentService } from 'vs/workben
2323
import { IRawChatParticipantContribution } from 'vs/workbench/contrib/chat/common/chatParticipantContribTypes';
2424
import { isProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
2525
import * as extensionsRegistry from 'vs/workbench/services/extensions/common/extensionsRegistry';
26+
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
27+
import { Action } from 'vs/base/common/actions';
28+
import { ICommandService } from 'vs/platform/commands/common/commands';
2629

2730
const chatParticipantExtensionPoint = extensionsRegistry.ExtensionsRegistry.registerExtensionPoint<IRawChatParticipantContribution[]>({
2831
extensionPoint: 'chatParticipants',
@@ -116,6 +119,8 @@ export class ChatExtensionPointHandler implements IWorkbenchContribution {
116119
@IProductService private readonly productService: IProductService,
117120
@IContextKeyService private readonly contextService: IContextKeyService,
118121
@ILogService private readonly logService: ILogService,
122+
@INotificationService private readonly notificationService: INotificationService,
123+
@ICommandService private readonly commandService: ICommandService,
119124
) {
120125
this._viewContainer = this.registerViewContainer();
121126
this.registerListeners();
@@ -159,6 +164,23 @@ export class ChatExtensionPointHandler implements IWorkbenchContribution {
159164
private handleAndRegisterChatExtensions(): void {
160165
chatParticipantExtensionPoint.setHandler((extensions, delta) => {
161166
for (const extension of delta.added) {
167+
// Detect old version of Copilot Chat extension.
168+
// TODO@roblourens remove after one release, after this we will rely on things like the API version
169+
if (extension.value.some(participant => participant.id === 'github.copilot.default' && !participant.fullName)) {
170+
this.notificationService.notify({
171+
severity: Severity.Error,
172+
message: localize('chatFailErrorMessage', "Chat failed to load. Please ensure that the GitHub Copilot Chat extension is up to date."),
173+
actions: {
174+
primary: [
175+
new Action('showExtension', localize('action.showExtension', "Show Extension"), undefined, true, () => {
176+
return this.commandService.executeCommand('workbench.extensions.action.showExtensionsWithIds', ['GitHub.copilot-chat']);
177+
})
178+
]
179+
}
180+
});
181+
continue;
182+
}
183+
162184
if (this.productService.quality === 'stable' && !isProposedApiEnabled(extension.description, 'chatParticipantPrivate')) {
163185
this.logService.warn(`Chat participants are not yet enabled in VS Code Stable (${extension.description.identifier.value})`);
164186
continue;

0 commit comments

Comments
 (0)