Use the remoteExtensionsScannerService

candidate/sbatten/1
Rob Lourens 2024-12-18 16:41:28 -08:00
parent 78a71a337d
commit bd1558c4c9
1 changed files with 4 additions and 12 deletions

View File

@ -60,6 +60,7 @@ import { IOpenerService } from '../../../../platform/opener/common/opener.js';
import { URI } from '../../../../base/common/uri.js';
import { IHostService } from '../../../services/host/browser/host.js';
import Severity from '../../../../base/common/severity.js';
import { IRemoteExtensionsScannerService } from '../../../../platform/remote/common/remoteExtensionsScanner.js';
const defaultChat = {
extensionId: product.defaultChatAgent?.extensionId ?? '',
@ -1044,7 +1045,8 @@ class ChatSetupContext extends Disposable {
@IExtensionService private readonly extensionService: IExtensionService,
@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,
@IWorkbenchExtensionEnablementService private readonly extensionEnablementService: IWorkbenchExtensionEnablementService,
@ILogService private readonly logService: ILogService
@ILogService private readonly logService: ILogService,
@IRemoteExtensionsScannerService private readonly remoteExtensionsScannerService: IRemoteExtensionsScannerService,
) {
super();
@ -1053,17 +1055,6 @@ class ChatSetupContext extends Disposable {
}
private async checkExtensionInstallation(): Promise<void> {
this._register(this.extensionService.onDidChangeExtensionsStatus(async (result) => {
for (const identifier of result) {
if (ExtensionIdentifier.equals(defaultChat.extensionId, identifier)) {
const extensions = await this.extensionManagementService.getInstalled();
const defaultChatExtension = extensions.find(value => ExtensionIdentifier.equals(value.identifier.id, defaultChat.extensionId));
this.update({ installed: !!defaultChatExtension && this.extensionEnablementService.isEnabled(defaultChatExtension) });
break;
}
}
}));
this._register(this.extensionService.onDidChangeExtensions(result => {
for (const extension of result.removed) {
if (ExtensionIdentifier.equals(defaultChat.extensionId, extension.identifier)) {
@ -1080,6 +1071,7 @@ class ChatSetupContext extends Disposable {
}
}));
await this.remoteExtensionsScannerService.whenExtensionsReady();
const extensions = await this.extensionManagementService.getInstalled();
const defaultChatExtension = extensions.find(value => ExtensionIdentifier.equals(value.identifier.id, defaultChat.extensionId));
this.update({ installed: !!defaultChatExtension && this.extensionEnablementService.isEnabled(defaultChatExtension) });