Skip to content

Commit ccac346

Browse files
authored
Don't restart EH when a chat request is in progress (#260674)
Fix #245215
1 parent 4e195c3 commit ccac346

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export namespace ChatContextKeys {
6262
export const remoteJobCreating = new RawContextKey<boolean>('chatRemoteJobCreating', false, { type: 'boolean', description: localize('chatRemoteJobCreating', "True when a remote coding agent job is being created.") });
6363
export const hasRemoteCodingAgent = new RawContextKey<boolean>('hasRemoteCodingAgent', false, localize('hasRemoteCodingAgent', "Whether any remote coding agent is available"));
6464
export const enableRemoteCodingAgentPromptFileOverlay = new RawContextKey<boolean>('enableRemoteCodingAgentPromptFileOverlay', false, localize('enableRemoteCodingAgentPromptFileOverlay', "Whether the remote coding agent prompt file overlay feature is enabled"));
65+
/** Used by the extension to skip the quit confirmation when #new wants to open a new folder */
6566
export const skipChatRequestInProgressMessage = new RawContextKey<boolean>('chatSkipRequestInProgressMessage', false, { type: 'boolean', description: localize('chatSkipRequestInProgressMessage', "True when the chat request in progress message should be skipped.") });
6667

6768
export const Setup = {

src/vs/workbench/contrib/chat/electron-browser/chat.contribution.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { autorun } from '../../../../base/common/observable.js';
3333
import { ILifecycleService, ShutdownReason } from '../../../services/lifecycle/common/lifecycle.js';
3434
import { IDialogService } from '../../../../platform/dialogs/common/dialogs.js';
3535
import { isMacintosh } from '../../../../base/common/platform.js';
36+
import { IExtensionService } from '../../../services/extensions/common/extensions.js';
3637

3738
class NativeBuiltinToolsContribution extends Disposable implements IWorkbenchContribution {
3839

@@ -142,13 +143,18 @@ class ChatLifecycleHandler extends Disposable {
142143
@IChatService private readonly chatService: IChatService,
143144
@IDialogService private readonly dialogService: IDialogService,
144145
@IViewsService private readonly viewsService: IViewsService,
145-
@IContextKeyService private readonly contextKeyService: IContextKeyService
146+
@IContextKeyService private readonly contextKeyService: IContextKeyService,
147+
@IExtensionService extensionService: IExtensionService,
146148
) {
147149
super();
148150

149151
this._register(lifecycleService.onBeforeShutdown(e => {
150152
e.veto(this.shouldVetoShutdown(e.reason), 'veto.chat');
151153
}));
154+
155+
this._register(extensionService.onWillStop(e => {
156+
e.veto(this.chatService.requestInProgressObs.get(), localize('chatRequestInProgress', "A chat request is in progress."));
157+
}));
152158
}
153159

154160
private shouldVetoShutdown(reason: ShutdownReason): boolean | Promise<boolean> {

0 commit comments

Comments
 (0)