Skip to content

Commit 84af918

Browse files
committed
debug: toolbar disable pause action and close quick pick
microsoft#84228
1 parent 312abad commit 84af918

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/vs/workbench/contrib/debug/browser/debug.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ function registerCommandsAndActions(): void {
158158
};
159159

160160
registerDebugToolBarItem(CONTINUE_ID, CONTINUE_LABEL, 10, { id: 'codicon/debug-continue' }, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));
161-
registerDebugToolBarItem(PAUSE_ID, PAUSE_LABEL, 10, { id: 'codicon/debug-pause' }, CONTEXT_DEBUG_STATE.notEqualsTo('stopped'));
161+
registerDebugToolBarItem(PAUSE_ID, PAUSE_LABEL, 10, { id: 'codicon/debug-pause' }, CONTEXT_DEBUG_STATE.notEqualsTo('stopped'), CONTEXT_DEBUG_STATE.isEqualTo('running'));
162162
registerDebugToolBarItem(STOP_ID, STOP_LABEL, 70, { id: 'codicon/debug-stop' }, CONTEXT_FOCUSED_SESSION_IS_ATTACH.toNegated());
163163
registerDebugToolBarItem(DISCONNECT_ID, DISCONNECT_LABEL, 70, { id: 'codicon/debug-disconnect' }, CONTEXT_FOCUSED_SESSION_IS_ATTACH);
164164
registerDebugToolBarItem(STEP_OVER_ID, STEP_OVER_LABEL, 20, { id: 'codicon/debug-step-over' }, undefined, CONTEXT_DEBUG_STATE.isEqualTo('stopped'));

src/vs/workbench/contrib/debug/browser/debugService.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import { DebugStorage } from 'vs/workbench/contrib/debug/common/debugStorage';
4747
import { DebugTelemetry } from 'vs/workbench/contrib/debug/common/debugTelemetry';
4848
import { DebugCompoundRoot } from 'vs/workbench/contrib/debug/common/debugCompoundRoot';
4949
import { ICommandService } from 'vs/platform/commands/common/commands';
50+
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
5051

5152
export class DebugService implements IDebugService {
5253
declare readonly _serviceBrand: undefined;
@@ -90,7 +91,8 @@ export class DebugService implements IDebugService {
9091
@IConfigurationService private readonly configurationService: IConfigurationService,
9192
@IExtensionHostDebugService private readonly extensionHostDebugService: IExtensionHostDebugService,
9293
@IActivityService private readonly activityService: IActivityService,
93-
@ICommandService private readonly commandService: ICommandService
94+
@ICommandService private readonly commandService: ICommandService,
95+
@IQuickInputService private readonly quickInputService: IQuickInputService
9496
) {
9597
this.toDispose = [];
9698

@@ -732,14 +734,16 @@ export class DebugService implements IDebugService {
732734
});
733735
}
734736

735-
stopSession(session: IDebugSession | undefined): Promise<any> {
737+
async stopSession(session: IDebugSession | undefined): Promise<any> {
736738
if (session) {
737739
return session.terminate();
738740
}
739741

740742
const sessions = this.model.getSessions();
741743
if (sessions.length === 0) {
742744
this.taskRunner.cancel();
745+
// User might have cancelled starting of a debug session, and in some cases the quick pick is left open
746+
await this.quickInputService.cancel();
743747
this.endInitializingState();
744748
this.cancelTokens(undefined);
745749
}

0 commit comments

Comments
 (0)