diff --git a/src/vs/workbench/parts/debug/browser/debugActions.ts b/src/vs/workbench/parts/debug/browser/debugActions.ts index c0685faee2f33b0edcf9d7b24c3ef512771caa9f..baad2319ba647d64ffa3ba801c5e969fe12911bf 100644 --- a/src/vs/workbench/parts/debug/browser/debugActions.ts +++ b/src/vs/workbench/parts/debug/browser/debugActions.ts @@ -152,7 +152,12 @@ export class RestartAction extends AbstractDebugAction { } public run(): TPromise { - const process = this.debugService.getViewModel().focusedProcess; + let process = this.debugService.getViewModel().focusedProcess; + if (!process) { + const processes = this.debugService.getModel().getProcesses(); + process = processes.length > 0 ? processes[0] : null; + } + return this.debugService.restartSession(process ? process.session : null); } @@ -326,7 +331,7 @@ export class PauseAction extends AbstractDebugAction { thread = this.debugService.getViewModel().focusedThread; } - return thread.pause(); + return thread ? thread.pause() : TPromise.as(null); } protected isEnabled(state: debug.State): boolean { diff --git a/src/vs/workbench/parts/debug/common/debug.ts b/src/vs/workbench/parts/debug/common/debug.ts index 8c1b713164041b9fc6c23a365a12dee26385e47f..c3f664c1aba320db3fac089be65465e0f6daf57c 100644 --- a/src/vs/workbench/parts/debug/common/debug.ts +++ b/src/vs/workbench/parts/debug/common/debug.ts @@ -207,17 +207,17 @@ export interface IExceptionBreakpoint extends IEnablement { export interface IViewModel extends ITreeElement { /** - * Returns the focused debug process or null if there are no processes. + * Returns the focused debug process or null if no process is stopped. */ focusedProcess: IProcess; /** - * Returns the focused thread or null if there are no threads. + * Returns the focused thread or null if no thread is stopped. */ focusedThread: IThread; /** - * Returns the focused stack frame or null if there are no stack frames (debug inactive). + * Returns the focused stack frame or null if there are no stack frames. */ focusedStackFrame: IStackFrame; getSelectedExpression(): IExpression;