提交 c285b440 编写于 作者: I isidor

Improve UI that prevents user from starting debug session multiple times

fixes #39707
上级 64833502
......@@ -156,7 +156,6 @@ export class StartAction extends AbstractDebugAction {
public static isEnabled(debugService: IDebugService, contextService: IWorkspaceContextService, configName: string) {
const sessions = debugService.getModel().getSessions();
const launch = debugService.getConfigurationManager().selectedConfiguration.launch;
if (debugService.state === State.Initializing) {
return false;
......@@ -164,13 +163,6 @@ export class StartAction extends AbstractDebugAction {
if (contextService && contextService.getWorkbenchState() === WorkbenchState.EMPTY && sessions.length > 0) {
return false;
}
if (sessions.some(p => p.getName(false) === configName && (!launch || !launch.workspace || !p.raw.root || p.raw.root.uri.toString() === launch.workspace.uri.toString()))) {
return false;
}
const compound = launch && launch.getCompound(configName);
if (compound && compound.configurations && sessions.some(p => compound.configurations.indexOf(p.getName(false)) !== -1)) {
return false;
}
return true;
}
......
......@@ -721,6 +721,15 @@ export class DebugService implements debug.IDebugService {
if (typeof configOrName === 'string' && launch) {
config = launch.getConfiguration(configOrName);
compound = launch.getCompound(configOrName);
const sessions = this.model.getSessions();
const alreadyRunningMessage = nls.localize('configurationAlreadyRunning', "There is already a debug configuration \"{0}\" running.", configOrName);
if (sessions.some(p => p.getName(false) === configOrName && (!launch || !launch.workspace || !p.raw.root || p.raw.root.uri.toString() === launch.workspace.uri.toString()))) {
return TPromise.wrapError(new Error(alreadyRunningMessage));
}
if (compound && compound.configurations && sessions.some(p => compound.configurations.indexOf(p.getName(false)) !== -1)) {
return TPromise.wrapError(new Error(alreadyRunningMessage));
}
} else if (typeof configOrName !== 'string') {
config = configOrName;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册