提交 d01b6c4a 编写于 作者: I isidor

debug start actions disable when there is already a debug session running and...

debug start actions disable when there is already a debug session running and we do not have any launch configuration selected

fixes #66047
上级 acdfe2bd
......@@ -156,13 +156,14 @@ export class StartAction extends AbstractDebugAction {
return false;
}
public static isEnabled(debugService: IDebugService, contextService: IWorkspaceContextService, configName: string) {
public static isEnabled(debugService: IDebugService) {
const sessions = debugService.getModel().getSessions();
if (debugService.state === State.Initializing) {
return false;
}
if (contextService && contextService.getWorkbenchState() === WorkbenchState.EMPTY && sessions.length > 0) {
if ((sessions.length > 0) && debugService.getConfigurationManager().getLaunches().every(l => l.getConfigurationNames().length === 0)) {
// There is already a debug session running and we do not have any launch configuration selected
return false;
}
......@@ -170,8 +171,8 @@ export class StartAction extends AbstractDebugAction {
}
// Disabled if the launch drop down shows the launch config that is already running.
protected isEnabled(state: State): boolean {
return StartAction.isEnabled(this.debugService, this.contextService, this.debugService.getConfigurationManager().selectedConfiguration.name);
protected isEnabled(): boolean {
return StartAction.isEnabled(this.debugService);
}
}
......@@ -246,7 +247,7 @@ export class RestartAction extends AbstractDebugAction {
return super.isEnabled(state) && (
state === State.Running ||
state === State.Stopped ||
StartAction.isEnabled(this.debugService, this.contextService, this.debugService.getConfigurationManager().selectedConfiguration.name)
StartAction.isEnabled(this.debugService)
);
}
}
......
......@@ -62,7 +62,7 @@ class StartDebugEntry extends Model.QuickOpenEntry {
}
public run(mode: QuickOpen.Mode, context: Model.IContext): boolean {
if (mode === QuickOpen.Mode.PREVIEW || !StartAction.isEnabled(this.debugService, this.contextService, this.configurationName)) {
if (mode === QuickOpen.Mode.PREVIEW || !StartAction.isEnabled(this.debugService)) {
return false;
}
// Run selected debug configuration
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册