Skip to content

Commit c76b15a

Browse files
authored
Merge pull request microsoft#260533 from microsoft/isidorn/wicked-carp
remove pause action from chat view
2 parents e734d26 + db467a8 commit c76b15a

15 files changed

Lines changed: 72 additions & 249 deletions

File tree

src/vs/workbench/api/browser/mainThreadChatAgents2.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,6 @@ export class MainThreadChatAgents2 extends Disposable implements MainThreadChatA
177177
setRequestTools: (requestId, tools) => {
178178
this._proxy.$setRequestTools(requestId, tools);
179179
},
180-
setRequestPaused: (requestId, isPaused) => {
181-
this._proxy.$setRequestPaused(handle, requestId, isPaused);
182-
},
183180
provideFollowups: async (request, result, history, token): Promise<IChatFollowup[]> => {
184181
if (!this._agents.get(handle)?.hasFollowups) {
185182
return [];

src/vs/workbench/api/common/extHost.protocol.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,6 @@ export type IChatAgentHistoryEntryDto = {
13651365

13661366
export interface ExtHostChatAgentsShape2 {
13671367
$invokeAgent(handle: number, request: Dto<IChatAgentRequest>, context: { history: IChatAgentHistoryEntryDto[] }, token: CancellationToken): Promise<IChatAgentResult | undefined>;
1368-
$setRequestPaused(handle: number, requestId: string, isPaused: boolean): void;
13691368
$provideFollowups(request: Dto<IChatAgentRequest>, handle: number, result: IChatAgentResult, context: { history: IChatAgentHistoryEntryDto[] }, token: CancellationToken): Promise<IChatFollowup[]>;
13701369
$acceptFeedback(handle: number, result: IChatAgentResult, voteAction: IChatVoteAction): void;
13711370
$acceptAction(handle: number, result: IChatAgentResult, action: IChatUserActionEvent): void;

src/vs/workbench/api/common/extHostChatAgents2.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -527,19 +527,6 @@ export class ExtHostChatAgents2 extends Disposable implements ExtHostChatAgentsS
527527
return model;
528528
}
529529

530-
async $setRequestPaused(handle: number, requestId: string, isPaused: boolean) {
531-
const agent = this._agents.get(handle);
532-
if (!agent) {
533-
return;
534-
}
535-
536-
const inFlight = Iterable.find(this._inFlightRequests, r => r.requestId === requestId);
537-
if (!inFlight) {
538-
return;
539-
}
540-
541-
agent.setChatRequestPauseState({ request: inFlight.extRequest, isPaused });
542-
}
543530

544531
async $setRequestTools(requestId: string, tools: Pick<IChatAgentRequest, 'userSelectedTools'>) {
545532
const request = [...this._inFlightRequests].find(r => r.requestId === requestId);

src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts

Lines changed: 8 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ abstract class SubmitAction extends Action2 {
150150
}
151151
}
152152

153-
const whenNotInProgressOrPaused = ContextKeyExpr.or(ChatContextKeys.isRequestPaused, ChatContextKeys.requestInProgress.negate());
153+
const whenNotInProgress = ChatContextKeys.requestInProgress.negate();
154154

155155
export class ChatSubmitAction extends SubmitAction {
156156
static readonly ID = 'workbench.action.chat.submit';
@@ -185,7 +185,7 @@ export class ChatSubmitAction extends SubmitAction {
185185
id: MenuId.ChatExecute,
186186
order: 4,
187187
when: ContextKeyExpr.and(
188-
whenNotInProgressOrPaused,
188+
whenNotInProgress,
189189
menuCondition,
190190
),
191191
group: 'navigation',
@@ -277,45 +277,6 @@ class ToggleChatModeAction extends Action2 {
277277
}
278278
}
279279

280-
export const ToggleRequestPausedActionId = 'workbench.action.chat.toggleRequestPaused';
281-
export class ToggleRequestPausedAction extends Action2 {
282-
static readonly ID = ToggleRequestPausedActionId;
283-
284-
constructor() {
285-
super({
286-
id: ToggleRequestPausedAction.ID,
287-
title: localize2('interactive.toggleRequestPausd.label', "Toggle Request Paused"),
288-
category: CHAT_CATEGORY,
289-
icon: Codicon.debugPause,
290-
toggled: {
291-
condition: ChatContextKeys.isRequestPaused,
292-
icon: Codicon.play,
293-
tooltip: localize('requestIsPaused', "Resume Request"),
294-
},
295-
tooltip: localize('requestNotPaused', "Pause Request"),
296-
menu: [
297-
{
298-
id: MenuId.ChatExecute,
299-
order: 3.5,
300-
when: ContextKeyExpr.and(
301-
ChatContextKeys.canRequestBePaused,
302-
ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Agent),
303-
ChatContextKeys.location.isEqualTo(ChatAgentLocation.Panel),
304-
ContextKeyExpr.or(ChatContextKeys.isRequestPaused.negate(), ChatContextKeys.inputHasText.negate()),
305-
),
306-
group: 'navigation',
307-
}]
308-
});
309-
}
310-
311-
override run(accessor: ServicesAccessor, ...args: any[]): void {
312-
const context: IChatExecuteActionContext | undefined = args[0];
313-
const widgetService = accessor.get(IChatWidgetService);
314-
const widget = context?.widget ?? widgetService.lastFocusedWidget;
315-
widget?.togglePaused();
316-
}
317-
}
318-
319280
class SwitchToNextModelAction extends Action2 {
320281
static readonly ID = 'workbench.action.chat.switchToNextModel';
321282

@@ -450,17 +411,14 @@ export class ChatEditingSessionSubmitAction extends SubmitAction {
450411
{
451412
id: MenuId.ChatExecuteSecondary,
452413
group: 'group_1',
453-
when: ContextKeyExpr.and(whenNotInProgressOrPaused, menuCondition),
414+
when: ContextKeyExpr.and(whenNotInProgress, menuCondition),
454415
order: 1
455416
},
456417
{
457418
id: MenuId.ChatExecute,
458419
order: 4,
459420
when: ContextKeyExpr.and(
460-
ContextKeyExpr.or(
461-
ContextKeyExpr.and(ChatContextKeys.isRequestPaused, ChatContextKeys.inputHasText),
462-
ChatContextKeys.requestInProgress.negate(),
463-
),
421+
ChatContextKeys.requestInProgress.negate(),
464422
menuCondition),
465423
group: 'navigation',
466424
}]
@@ -476,7 +434,7 @@ class SubmitWithoutDispatchingAction extends Action2 {
476434
// if the input has prompt instructions attached, allow submitting requests even
477435
// without text present - having instructions is enough context for a request
478436
ContextKeyExpr.or(ChatContextKeys.inputHasText, ChatContextKeys.hasPromptFile),
479-
whenNotInProgressOrPaused,
437+
whenNotInProgress,
480438
ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Ask),
481439
);
482440

@@ -522,7 +480,7 @@ export class CreateRemoteAgentJobAction extends Action2 {
522480
constructor() {
523481
const precondition = ContextKeyExpr.and(
524482
ContextKeyExpr.or(ChatContextKeys.inputHasText, ChatContextKeys.hasPromptFile),
525-
whenNotInProgressOrPaused,
483+
whenNotInProgress,
526484
ChatContextKeys.remoteJobCreating.negate(),
527485
);
528486

@@ -725,7 +683,7 @@ export class ChatSubmitWithCodebaseAction extends Action2 {
725683
// if the input has prompt instructions attached, allow submitting requests even
726684
// without text present - having instructions is enough context for a request
727685
ContextKeyExpr.or(ChatContextKeys.inputHasText, ChatContextKeys.hasPromptFile),
728-
whenNotInProgressOrPaused,
686+
whenNotInProgress,
729687
);
730688

731689
super({
@@ -782,7 +740,7 @@ class SendToNewChatAction extends Action2 {
782740
// if the input has prompt instructions attached, allow submitting requests even
783741
// without text present - having instructions is enough context for a request
784742
ContextKeyExpr.or(ChatContextKeys.inputHasText, ChatContextKeys.hasPromptFile),
785-
whenNotInProgressOrPaused,
743+
whenNotInProgress,
786744
);
787745

788746
super({
@@ -843,7 +801,6 @@ export class CancelAction extends Action2 {
843801
menu: [{
844802
id: MenuId.ChatExecute,
845803
when: ContextKeyExpr.and(
846-
ChatContextKeys.isRequestPaused.negate(),
847804
ChatContextKeys.requestInProgress,
848805
ChatContextKeys.remoteJobCreating.negate()
849806
),
@@ -926,7 +883,6 @@ export function registerChatExecuteActions() {
926883
registerAction2(ChatSubmitWithCodebaseAction);
927884
registerAction2(CreateRemoteAgentJobAction);
928885
registerAction2(ToggleChatModeAction);
929-
registerAction2(ToggleRequestPausedAction);
930886
registerAction2(SwitchToNextModelAction);
931887
registerAction2(OpenModelPickerAction);
932888
registerAction2(OpenModePickerAction);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ export interface IChatWidget {
226226
*/
227227
waitForReady(): Promise<void>;
228228
getViewState(): IChatViewState;
229-
togglePaused(): void;
230229
lockToCodingAgent(name: string, displayName: string): void;
231230

232231
delegateScrollFromMouseWheelEvent(event: IMouseWheelEvent): void;

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

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { $, addDisposableListener, append, EventType } from '../../../../../base/browser/dom.js';
6+
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';
99
import { MarkdownString } from '../../../../../base/common/htmlContent.js';
1010
import { Disposable } from '../../../../../base/common/lifecycle.js';
1111
import { ThemeIcon } from '../../../../../base/common/themables.js';
1212
import { MarkdownRenderer } from '../../../../../editor/browser/widget/markdownRenderer/browser/markdownRenderer.js';
13-
import { localize } from '../../../../../nls.js';
1413
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
14+
import { localize } from '../../../../../nls.js';
1515
import { IChatProgressMessage, IChatTask, IChatTaskSerialized } from '../../common/chatService.js';
16-
import { IChatRendererContent, IChatWorkingProgress, isResponseVM } from '../../common/chatViewModel.js';
16+
import { IChatRendererContent, isResponseVM } from '../../common/chatViewModel.js';
1717
import { ChatTreeItem } from '../chat.js';
1818
import { renderFileWidgets } from '../chatInlineAnchorWidget.js';
1919
import { IChatContentPart, IChatContentPartRenderContext } from './chatContentParts.js';
@@ -80,35 +80,6 @@ function shouldShowSpinner(followingContent: IChatRendererContent[], element: Ch
8080
return isResponseVM(element) && !element.isComplete && followingContent.length === 0;
8181
}
8282

83-
export class ChatWorkingProgressContentPart extends ChatProgressContentPart implements IChatContentPart {
84-
constructor(
85-
private readonly workingProgress: IChatWorkingProgress,
86-
renderer: MarkdownRenderer,
87-
context: IChatContentPartRenderContext,
88-
@IInstantiationService instantiationService: IInstantiationService,
89-
@IChatMarkdownAnchorService chatMarkdownAnchorService: IChatMarkdownAnchorService,
90-
) {
91-
const progressMessage: IChatProgressMessage = {
92-
kind: 'progressMessage',
93-
content: workingProgress.isPaused ?
94-
new MarkdownString().appendText(localize('pausedMessage', "Paused")) :
95-
new MarkdownString().appendText(localize('workingMessage', "Working..."))
96-
};
97-
super(progressMessage, renderer, context, undefined, undefined, workingProgress.isPaused ? Codicon.debugPause : undefined, instantiationService, chatMarkdownAnchorService);
98-
99-
if (workingProgress.isPaused) {
100-
this.domNode.style.cursor = 'pointer';
101-
this.domNode.title = localize('resume', "Click to resume");
102-
this._register(addDisposableListener(this.domNode, EventType.CLICK, () => {
103-
workingProgress.setPaused(false);
104-
}));
105-
}
106-
}
107-
108-
override hasSameContent(other: IChatRendererContent, followingContent: IChatRendererContent[], element: ChatTreeItem): boolean {
109-
return other.kind === 'working' && this.workingProgress.isPaused === other.isPaused;
110-
}
111-
}
11283

11384
export class ChatCustomProgressPart {
11485
public readonly domNode: HTMLElement;
@@ -126,3 +97,19 @@ export class ChatCustomProgressPart {
12697
append(this.domNode, messageElement);
12798
}
12899
}
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/chatEditing/chatEditingEditorOverlay.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ class ChatEditorOverlayWidget extends Disposable {
7676
return { message: localize('working', "Working...") };
7777
}
7878

79-
if (response.isPaused.read(r)) {
80-
return { message: localize('paused', "Paused"), paused: true };
81-
}
82-
8379
const lastPart = observableFromEventOpts({ equalsFn: arrays.equals }, response.onDidChange, () => response.response.value)
8480
.read(r)
8581
.filter(part => part.kind === 'progressMessage' || part.kind === 'toolInvocation')
@@ -105,7 +101,7 @@ class ChatEditorOverlayWidget extends Disposable {
105101

106102
this._store.add(autorun(r => {
107103
const value = requestMessage.read(r);
108-
const busy = this._isBusy.read(r) && !value?.paused;
104+
const busy = this._isBusy.read(r);
109105

110106
this._domNode.classList.toggle('busy', busy);
111107

0 commit comments

Comments
 (0)