Skip to content

Commit

Permalink
Rebase against the upstream dfe27a1
Browse files Browse the repository at this point in the history
vscode-upstream-sha1: dfe27a1
  • Loading branch information
Eclipse Che Sync committed Aug 4, 2023
2 parents 7d82717 + dfe27a1 commit 518a265
Show file tree
Hide file tree
Showing 22 changed files with 364 additions and 72 deletions.
19 changes: 15 additions & 4 deletions code/src/vs/workbench/api/browser/mainThreadChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
import { DeferredPromise } from 'vs/base/common/async';
import { Emitter } from 'vs/base/common/event';
import { Disposable, DisposableMap } from 'vs/base/common/lifecycle';
import { revive } from 'vs/base/common/marshalling';
import { URI, UriComponents } from 'vs/base/common/uri';
import { ExtHostChatShape, ExtHostContext, IChatRequestDto, IChatResponseProgressDto, MainContext, MainThreadChatShape } from 'vs/workbench/api/common/extHost.protocol';
import { IChatWidgetService } from 'vs/workbench/contrib/chat/browser/chat';
import { IChatContributionService } from 'vs/workbench/contrib/chat/common/chatContributionService';
import { IChat, IChatDynamicRequest, IChatProgress, IChatRequest, IChatResponse, IChatService } from 'vs/workbench/contrib/chat/common/chatService';
import { IChat, IChatDynamicRequest, IChatProgress, IChatRequest, IChatResponse, IChatResponseProgressFileTreeData, IChatService } from 'vs/workbench/contrib/chat/common/chatService';
import { IExtHostContext, extHostNamedCustomer } from 'vs/workbench/services/extensions/common/extHostCustomers';

@extHostNamedCustomer(MainContext.MainThreadChat)
Expand All @@ -23,7 +24,7 @@ export class MainThreadChat extends Disposable implements MainThreadChatShape {
private readonly _proxy: ExtHostChatShape;

private _responsePartHandlePool = 0;
private readonly _activeResponsePartPromises = new Map<string, DeferredPromise<string>>();
private readonly _activeResponsePartPromises = new Map<string, DeferredPromise<string | { treeData: IChatResponseProgressFileTreeData }>>();

constructor(
extHostContext: IExtHostContext,
Expand Down Expand Up @@ -149,18 +150,28 @@ export class MainThreadChat extends Disposable implements MainThreadChatShape {

if ('placeholder' in progress) {
const responsePartId = `${id}_${++this._responsePartHandlePool}`;
const deferredContentPromise = new DeferredPromise<string>();
const deferredContentPromise = new DeferredPromise<string | { treeData: IChatResponseProgressFileTreeData }>();
this._activeResponsePartPromises.set(responsePartId, deferredContentPromise);
this._activeRequestProgressCallbacks.get(id)?.({ ...progress, resolvedContent: deferredContentPromise.p });
return this._responsePartHandlePool;
} else if (responsePartHandle) {
// Complete an existing deferred promise with resolved content
const responsePartId = `${id}_${responsePartHandle}`;
const deferredContentPromise = this._activeResponsePartPromises.get(responsePartId);
if (deferredContentPromise && 'content' in progress) {
if (deferredContentPromise && 'treeData' in progress) {
const withRevivedUris = revive<{ treeData: IChatResponseProgressFileTreeData }>(progress);
deferredContentPromise.complete(withRevivedUris);
this._activeResponsePartPromises.delete(responsePartId);
} else if (deferredContentPromise && 'content' in progress) {
deferredContentPromise.complete(progress.content);
this._activeResponsePartPromises.delete(responsePartId);
}
return;
}

// No need to support standalone tree data that's not attached to a placeholder
if ('treeData' in progress) {
return;
}

this._activeRequestProgressCallbacks.get(id)?.(progress);
Expand Down
8 changes: 7 additions & 1 deletion code/src/vs/workbench/api/common/extHost.protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,13 @@ export interface IChatResponseDto {
};
}

export type IChatResponseProgressDto = { content: string } | { requestId: string } | { placeholder: string };
export interface IChatResponseProgressFileTreeData {
label: string;
uri: URI;
children?: IChatResponseProgressFileTreeData[];
}

export type IChatResponseProgressDto = { content: string } | { requestId: string } | { placeholder: string } | { treeData: IChatResponseProgressFileTreeData };

export interface MainThreadChatShape extends IDisposable {
$registerChatProvider(handle: number, id: string): Promise<void>;
Expand Down
6 changes: 3 additions & 3 deletions code/src/vs/workbench/browser/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}
}));

// Title Menu changes
this._register(this.titleService.onDidChangeCommandCenterVisibility(() => this.doUpdateLayoutConfiguration()));

// Fullscreen changes
this._register(onDidChangeFullscreen(() => this.onFullscreenChanged()));

Expand All @@ -301,9 +304,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this._register(this.titleService.onMenubarVisibilityChange(visible => this.onMenubarToggled(visible)));
}

// Title Menu changes
this._register(this.titleService.onDidChangeCommandCenterVisibility(() => this.layout()));

// Theme changes
this._register(this.themeService.onDidColorThemeChange(() => this.updateStyles()));

Expand Down
6 changes: 5 additions & 1 deletion code/src/vs/workbench/browser/parts/panel/panelPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ export abstract class BasePanelPart extends CompositePart<PaneComposite> impleme
readonly minimumHeight: number = 77;
readonly maximumHeight: number = Number.POSITIVE_INFINITY;

readonly snap = true;
get snap(): boolean {
// Always allow snapping closed
// Only allow dragging open if the panel contains view containers
return this.layoutService.isVisible(this.partId) || this.compositeBar.getVisibleComposites().length > 0;
}

get preferredHeight(): number | undefined {
// Don't worry about titlebar or statusbar visibility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class QuickChat extends Disposable {
this.chatService.addCompleteRequest(widget.viewModel.sessionId,
request.message as string,
{
message: request.response.response.value,
message: request.response.response.asString(),
errorDetails: request.response.errorDetails
});
} else if (request.message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export function registerChatTitleActions() {
return;
}

const value = item.response.value;
const value = item.response.asString();
const splitContents = splitMarkdownAndCodeBlocks(value);

const focusRange = notebookEditor.getFocus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class ChatAccessibleViewContribution extends Disposable {

widget.focus(focusedItem);
const isWelcome = focusedItem instanceof ChatWelcomeMessageModel;
let responseContent = isResponseVM(focusedItem) ? focusedItem.response.value : undefined;
let responseContent = isResponseVM(focusedItem) ? focusedItem.response.asString() : undefined;
if (isWelcome) {
const welcomeReplyContents = [];
for (const content of focusedItem.content) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class ChatAccessibilityService extends Disposable implements IChatAccessi
const isPanelChat = typeof response !== 'string';
this._responsePendingAudioCue?.dispose();
this._runOnceScheduler?.cancel();
const responseContent = typeof response === 'string' ? response : response?.response.value;
const responseContent = typeof response === 'string' ? response : response?.response.asString();
if (this._lastResponse === responseContent) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

.interactive-response-progress-tree .monaco-tl-row:hover {
background-color: var(--vscode-list-hoverBackground);
}
Loading

0 comments on commit 518a265

Please sign in to comment.