From 4e2ba23aed553047bd7b5726f1b92520adeda749 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 6 Jan 2025 16:59:10 +0100 Subject: [PATCH] chat setup - restore copilot menu on extension install (#237348) --- .../browser/actions/chatGettingStarted.ts | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.ts b/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.ts index 8dc7d4dee91..ea35e44e016 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.ts @@ -16,6 +16,7 @@ import { IDefaultChatAgent } from '../../../../../base/common/product.js'; import { IViewDescriptorService } from '../../../../common/views.js'; import { IWorkbenchLayoutService } from '../../../../services/layout/browser/layoutService.js'; import { ensureSideBarChatViewSize } from '../chat.js'; +import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js'; export class ChatGettingStartedContribution extends Disposable implements IWorkbenchContribution { @@ -32,6 +33,7 @@ export class ChatGettingStartedContribution extends Disposable implements IWorkb @IStorageService private readonly storageService: IStorageService, @IViewDescriptorService private readonly viewDescriptorService: IViewDescriptorService, @IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService, + @IConfigurationService private readonly configurationService: IConfigurationService, ) { super(); @@ -60,14 +62,25 @@ export class ChatGettingStartedContribution extends Disposable implements IWorkb if (ExtensionIdentifier.equals(defaultChatAgent.extensionId, ext.value)) { const extensionStatus = this.extensionService.getExtensionsStatus(); if (extensionStatus[ext.value].activationTimes && this.recentlyInstalled) { - await this.commandService.executeCommand(CHAT_OPEN_ACTION_ID); - ensureSideBarChatViewSize(400, this.viewDescriptorService, this.layoutService); - this.storageService.store(ChatGettingStartedContribution.hideWelcomeView, true, StorageScope.APPLICATION, StorageTarget.MACHINE); - this.recentlyInstalled = false; + this.onDidInstallChat(); return; } } } })); } + + private async onDidInstallChat() { + + // Enable chat command center if previously disabled + this.configurationService.updateValue('chat.commandCenter.enabled', true); + + // Open and configure chat view + await this.commandService.executeCommand(CHAT_OPEN_ACTION_ID); + ensureSideBarChatViewSize(400, this.viewDescriptorService, this.layoutService); + + // Only do this once + this.storageService.store(ChatGettingStartedContribution.hideWelcomeView, true, StorageScope.APPLICATION, StorageTarget.MACHINE); + this.recentlyInstalled = false; + } }