Show proper warning for outdated Copilot Chat in the next build (#213852)

This commit is contained in:
Rob Lourens 2024-05-29 15:18:17 -07:00 committed by GitHub
parent 721441c98a
commit c47a1d835d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,6 +23,9 @@ import { ChatAgentLocation, IChatAgentData, IChatAgentService } from 'vs/workben
import { IRawChatParticipantContribution } from 'vs/workbench/contrib/chat/common/chatParticipantContribTypes';
import { isProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
import * as extensionsRegistry from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { Action } from 'vs/base/common/actions';
import { ICommandService } from 'vs/platform/commands/common/commands';
const chatParticipantExtensionPoint = extensionsRegistry.ExtensionsRegistry.registerExtensionPoint<IRawChatParticipantContribution[]>({
extensionPoint: 'chatParticipants',
@ -116,6 +119,8 @@ export class ChatExtensionPointHandler implements IWorkbenchContribution {
@IProductService private readonly productService: IProductService,
@IContextKeyService private readonly contextService: IContextKeyService,
@ILogService private readonly logService: ILogService,
@INotificationService private readonly notificationService: INotificationService,
@ICommandService private readonly commandService: ICommandService,
) {
this._viewContainer = this.registerViewContainer();
this.registerListeners();
@ -159,6 +164,23 @@ export class ChatExtensionPointHandler implements IWorkbenchContribution {
private handleAndRegisterChatExtensions(): void {
chatParticipantExtensionPoint.setHandler((extensions, delta) => {
for (const extension of delta.added) {
// Detect old version of Copilot Chat extension.
// TODO@roblourens remove after one release, after this we will rely on things like the API version
if (extension.value.some(participant => participant.id === 'github.copilot.default' && !participant.fullName)) {
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']);
})
]
}
});
continue;
}
if (this.productService.quality === 'stable' && !isProposedApiEnabled(extension.description, 'chatParticipantPrivate')) {
this.logService.warn(`Chat participants are not yet enabled in VS Code Stable (${extension.description.identifier.value})`);
continue;