diff --git a/package.json b/package.json index 50810341a3c..b0fdae1627b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.108.0", - "distro": "ac62b183885af851634b215f084a75e84d439948", + "distro": "30bf5c1b117940f64d2dc13a89612f14618f1c77", "author": { "name": "Microsoft Corporation" }, diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.ts index ad5763c80b3..9ea4da64dbc 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.ts @@ -18,6 +18,8 @@ import { IWorkbenchExtensionManagementService } from '../../../../services/exten import { CHAT_CATEGORY } from './chatActions.js'; import { IChatSessionRecommendation } from '../../../../../base/common/product.js'; import { ExtensionIdentifier } from '../../../../../platform/extensions/common/extensions.js'; +import { ChatAgentLocation } from '../../common/constants.js'; +import { IChatService } from '../../common/chatService.js'; const INSTALL_CONTEXT_PREFIX = 'chat.installRecommendationAvailable'; @@ -34,7 +36,6 @@ export class ChatAgentRecommendation extends Disposable implements IWorkbenchCon @IContextKeyService private readonly contextKeyService: IContextKeyService, ) { super(); - const recommendations = this.productService.chatSessionRecommendations; if (!recommendations?.length || !this.extensionGalleryService.isEnabled()) { return; @@ -44,17 +45,17 @@ export class ChatAgentRecommendation extends Disposable implements IWorkbenchCon this.registerRecommendation(recommendation); } - this.refreshInstallAvailability(); - const refresh = () => this.refreshInstallAvailability(); this._register(this.extensionManagementService.onProfileAwareDidInstallExtensions(refresh)); this._register(this.extensionManagementService.onProfileAwareDidUninstallExtension(refresh)); this._register(this.extensionManagementService.onDidChangeProfile(refresh)); + + this.refreshInstallAvailability(); } private registerRecommendation(recommendation: IChatSessionRecommendation): void { const extensionKey = ExtensionIdentifier.toKey(recommendation.extensionId); - const commandId = `chat.installRecommendation.${extensionKey}`; + const commandId = `chat.installRecommendation.${extensionKey}.${recommendation.name}`; const availabilityContextId = `${INSTALL_CONTEXT_PREFIX}.${extensionKey}`; const availabilityContext = new RawContextKey(availabilityContextId, false).bindTo(this.contextKeyService); this.availabilityContextKeys.set(extensionKey, availabilityContext); @@ -70,7 +71,6 @@ export class ChatAgentRecommendation extends Disposable implements IWorkbenchCon f1: false, category: CHAT_CATEGORY, icon: Codicon.extensions, - precondition: ContextKeyExpr.equals(availabilityContextId, true), menu: [ { id: MenuId.ChatNewMenu, @@ -84,13 +84,13 @@ export class ChatAgentRecommendation extends Disposable implements IWorkbenchCon override async run(accessor: ServicesAccessor): Promise { const commandService = accessor.get(ICommandService); const productService = accessor.get(IProductService); + const chatService = accessor.get(IChatService); const installPreReleaseVersion = productService.quality !== 'stable'; await commandService.executeCommand('workbench.extensions.installExtension', recommendation.extensionId, { installPreReleaseVersion }); - - await runPostInstallCommand(commandService, recommendation.postInstallCommand); + await runPostInstallCommand(commandService, chatService, recommendation.postInstallCommand); } })); } @@ -122,13 +122,12 @@ export class ChatAgentRecommendation extends Disposable implements IWorkbenchCon } } -async function runPostInstallCommand(commandService: ICommandService, commandId: string | undefined): Promise { +async function runPostInstallCommand(commandService: ICommandService, chatService: IChatService, commandId: string | undefined): Promise { if (!commandId) { return; } - await waitForCommandRegistration(commandId); - + await chatService.activateDefaultAgent(ChatAgentLocation.Chat); try { await commandService.executeCommand(commandId); } catch {