Skip to content

Commit

Permalink
chat - welcome tweaks (#234949)
Browse files Browse the repository at this point in the history
* chat - welcome tweaks

* perf
  • Loading branch information
bpasero authored Dec 1, 2024
1 parent 30b132d commit 2ed1e9b
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 69 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.96.0",
"distro": "5814e58fabdf061dc9c88b153d775a37ac261fc7",
"distro": "eee4ba8554f216a6fb025cf4705b8da2c6d21a49",
"author": {
"name": "Microsoft Corporation"
},
Expand Down
1 change: 0 additions & 1 deletion src/vs/base/common/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,4 @@ export interface IDefaultChatAgent {
readonly providerScopes: string[][];
readonly entitlementUrl: string;
readonly entitlementSignupLimitedUrl: string;
readonly entitlementSkuTypeLimitedName: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ export class ChatCommandCenterRendering implements IWorkbenchContribution {

const primaryAction = instantiationService.createInstance(MenuItemAction, {
id: chatExtensionInstalled ? CHAT_OPEN_ACTION_ID : 'workbench.action.chat.triggerSetup',
title: chatExtensionInstalled ? OpenChatGlobalAction.TITLE : localize2('triggerChatSetup', "Use AI Features with Copilot"),
title: chatExtensionInstalled ? OpenChatGlobalAction.TITLE : localize2('triggerChatSetup', "Use AI Features with Copilot for Free"),
icon: Codicon.copilot,
}, undefined, undefined, undefined, undefined);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import { CHAT_OPEN_ACTION_ID } from './chatActions.js';
import { IExtensionManagementService, InstallOperation } from '../../../../../platform/extensionManagement/common/extensionManagement.js';
import { IStorageService, StorageScope, StorageTarget } from '../../../../../platform/storage/common/storage.js';
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';


export class ChatGettingStartedContribution extends Disposable implements IWorkbenchContribution {
Expand All @@ -27,6 +30,8 @@ export class ChatGettingStartedContribution extends Disposable implements IWorkb
@ICommandService private readonly commandService: ICommandService,
@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,
@IStorageService private readonly storageService: IStorageService,
@IViewDescriptorService private readonly viewDescriptorService: IViewDescriptorService,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
) {
super();

Expand Down Expand Up @@ -56,6 +61,7 @@ export class ChatGettingStartedContribution extends Disposable implements IWorkb
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;
return;
Expand Down
15 changes: 15 additions & 0 deletions src/vs/workbench/contrib/chat/browser/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { Selection } from '../../../../editor/common/core/selection.js';
import { MenuId } from '../../../../platform/actions/common/actions.js';
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
import { IViewDescriptorService, ViewContainerLocation } from '../../../common/views.js';
import { IWorkbenchLayoutService, Parts } from '../../../services/layout/browser/layoutService.js';
import { IViewsService } from '../../../services/views/common/viewsService.js';
import { ChatAgentLocation, IChatAgentCommand, IChatAgentData } from '../common/chatAgents.js';
import { IChatResponseModel } from '../common/chatModel.js';
Expand Down Expand Up @@ -50,6 +52,19 @@ export async function showEditsView(viewsService: IViewsService): Promise<IChatW
return (await viewsService.openView<ChatViewPane>(EditsViewId))?.widget;
}

export function ensureSideBarChatViewSize(width: number, viewDescriptorService: IViewDescriptorService, layoutService: IWorkbenchLayoutService): void {
const location = viewDescriptorService.getViewLocationById(ChatViewId);
if (location === ViewContainerLocation.Panel) {
return; // panel is typically very wide
}

const viewPart = location === ViewContainerLocation.Sidebar ? Parts.SIDEBAR_PART : Parts.AUXILIARYBAR_PART;
const partSize = layoutService.getSize(viewPart);
if (partSize.width < width) {
layoutService.setSize(viewPart, { width: width, height: partSize.height });
}
}

export const IQuickChatService = createDecorator<IQuickChatService>('quickChatService');
export interface IQuickChatService {
readonly _serviceBrand: undefined;
Expand Down
Loading

0 comments on commit 2ed1e9b

Please sign in to comment.