Skip to content

Commit eceab56

Browse files
committed
bring back some things that were too aggresively removed
1 parent 792a6c1 commit eceab56

3 files changed

Lines changed: 46 additions & 2 deletions

File tree

src/vs/workbench/contrib/chat/browser/chatContentParts/chatProgressContentPart.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
import { $, append } from '../../../../../base/browser/dom.js';
77
import { alert } from '../../../../../base/browser/ui/aria/aria.js';
88
import { Codicon } from '../../../../../base/common/codicons.js';
9+
import { MarkdownString } from '../../../../../base/common/htmlContent.js';
910
import { Disposable } from '../../../../../base/common/lifecycle.js';
1011
import { ThemeIcon } from '../../../../../base/common/themables.js';
1112
import { MarkdownRenderer } from '../../../../../editor/browser/widget/markdownRenderer/browser/markdownRenderer.js';
1213
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
14+
import { localize } from '../../../../../nls.js';
1315
import { IChatProgressMessage, IChatTask, IChatTaskSerialized } from '../../common/chatService.js';
1416
import { IChatRendererContent, isResponseVM } from '../../common/chatViewModel.js';
1517
import { ChatTreeItem } from '../chat.js';
@@ -95,3 +97,19 @@ export class ChatCustomProgressPart {
9597
append(this.domNode, messageElement);
9698
}
9799
}
100+
101+
export class ChatWorkingProgressContentPart extends ChatProgressContentPart implements IChatContentPart {
102+
constructor(
103+
_workingProgress: { kind: 'working' },
104+
renderer: MarkdownRenderer,
105+
context: IChatContentPartRenderContext,
106+
@IInstantiationService instantiationService: IInstantiationService,
107+
@IChatMarkdownAnchorService chatMarkdownAnchorService: IChatMarkdownAnchorService,
108+
) {
109+
const progressMessage: IChatProgressMessage = {
110+
kind: 'progressMessage',
111+
content: new MarkdownString().appendText(localize('workingMessage', "Working..."))
112+
};
113+
super(progressMessage, renderer, context, undefined, undefined, undefined, instantiationService, chatMarkdownAnchorService);
114+
}
115+
}

src/vs/workbench/contrib/chat/browser/chatListRenderer.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ import { IChatContentPart, IChatContentPartRenderContext } from './chatContentPa
6565
import { ChatErrorConfirmationContentPart } from './chatContentParts/chatErrorConfirmationPart.js';
6666
import { ChatExtensionsContentPart } from './chatContentParts/chatExtensionsContentPart.js';
6767
import { ChatMarkdownContentPart, EditorPool } from './chatContentParts/chatMarkdownContentPart.js';
68-
import { ChatProgressContentPart } from './chatContentParts/chatProgressContentPart.js';
68+
import { ChatProgressContentPart, ChatWorkingProgressContentPart } from './chatContentParts/chatProgressContentPart.js';
6969
import { ChatQuotaExceededPart } from './chatContentParts/chatQuotaExceededPart.js';
7070
import { ChatCollapsibleListContentPart, ChatUsedReferencesListContentPart, CollapsibleListPool } from './chatContentParts/chatReferencesContentPart.js';
7171
import { ChatTaskContentPart } from './chatContentParts/chatTaskContentPart.js';
@@ -698,6 +698,10 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
698698
if (element.model.response === element.model.entireResponse && element.errorDetails?.message && element.errorDetails.message !== canceledName) {
699699
content.push({ kind: 'errorDetails', errorDetails: element.errorDetails, isLast: index === this.delegate.getListLength() - 1 });
700700
}
701+
702+
if (!element.isComplete && this.shouldShowWorkingProgress(element, content)) {
703+
content.push({ kind: 'working' });
704+
}
701705
const fileChangesSummaryPart = this.getChatFileChangesSummaryPart(element);
702706
if (fileChangesSummaryPart) {
703707
content.push(fileChangesSummaryPart);
@@ -709,6 +713,23 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
709713
this.updateItemHeightOnRender(element, templateData);
710714
}
711715

716+
private shouldShowWorkingProgress(element: IChatResponseViewModel, partsToRender: IChatRendererContent[]): boolean {
717+
if (!isResponseVM(element) || element.isComplete) {
718+
return false;
719+
}
720+
721+
if (!partsToRender.length) {
722+
return true;
723+
}
724+
725+
const lastPart = partsToRender.at(-1)!;
726+
return !(
727+
lastPart.kind === 'markdownContent' ||
728+
lastPart.kind === 'references' ||
729+
lastPart.kind === 'codeCitations'
730+
);
731+
}
732+
712733
private getChatFileChangesSummaryPart(element: IChatResponseViewModel): IChatChangesSummaryPart | undefined {
713734
if (!this.shouldShowFileChangesSummary(element)) {
714735
return undefined;
@@ -1087,6 +1108,8 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
10871108
return this.renderMultiDiffData(content, templateData, context);
10881109
} else if (content.kind === 'progressMessage') {
10891110
return this.instantiationService.createInstance(ChatProgressContentPart, content, this.renderer, context, undefined, undefined, undefined);
1111+
} else if (content.kind === 'working') {
1112+
return this.instantiationService.createInstance(ChatWorkingProgressContentPart, content, this.renderer, context);
10901113
} else if (content.kind === 'progressTask' || content.kind === 'progressTaskSerialized') {
10911114
return this.renderProgressTask(content, templateData, context);
10921115
} else if (content.kind === 'command') {

src/vs/workbench/contrib/chat/common/chatViewModel.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ export interface IChatReferences {
153153
/**
154154
* Content type for the "Working" progress message
155155
*/
156+
export interface IChatWorkingProgress {
157+
kind: 'working';
158+
}
156159

157160

158161
/**
@@ -177,7 +180,7 @@ export interface IChatChangesSummaryPart {
177180
/**
178181
* Type for content parts rendered by IChatListRenderer (not necessarily in the model)
179182
*/
180-
export type IChatRendererContent = IChatProgressRenderableResponseContent | IChatReferences | IChatCodeCitations | IChatErrorDetailsPart | IChatChangesSummaryPart;
183+
export type IChatRendererContent = IChatProgressRenderableResponseContent | IChatReferences | IChatCodeCitations | IChatErrorDetailsPart | IChatChangesSummaryPart | IChatWorkingProgress;
181184

182185
export interface IChatLiveUpdateData {
183186
totalTime: number;

0 commit comments

Comments
 (0)