mirror of
https://github.com/Microsoft/vscode
synced 2024-10-04 02:14:06 +00:00
Show proper warning for outdated Copilot Chat in the next build (#213852)
This commit is contained in:
parent
721441c98a
commit
c47a1d835d
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue