提交 a5dad7f6 编写于 作者: I isidor

debug: restart and pause fix behavior when no focussed process

上级 b2b465bb
......@@ -152,7 +152,12 @@ export class RestartAction extends AbstractDebugAction {
}
public run(): TPromise<any> {
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 {
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册