Skip to content

Commit

Permalink
add 'Restart Frame'; fixes #9145
Browse files Browse the repository at this point in the history
  • Loading branch information
weinand committed Jul 12, 2016
1 parent 40602c3 commit 70cba8b
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 10 deletions.
2 changes: 1 addition & 1 deletion extensions/node-debug/node-debug.azure.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"account": "monacobuild",
"container": "debuggers",
"zip": "e37a047/node-debug.zip",
"zip": "3030249/node-debug.zip",
"output": ""
}
18 changes: 18 additions & 0 deletions src/vs/workbench/parts/debug/browser/debugActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,24 @@ export class PauseAction extends AbstractDebugAction {
}
}

export class RestartFrameAction extends AbstractDebugAction {
static ID = 'workbench.action.debug.restartFrame';
static LABEL = nls.localize('restartFrame', "Restart Frame");

constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action restart-frame', debugService, keybindingService);
}

public run(frame: debug.IStackFrame): TPromise<any> {

const frameId = (frame && frame instanceof model.StackFrame)
? frame.frameId
: this.debugService.getViewModel().getFocusedStackFrame().frameId;

return this.debugService.restartFrame(frameId);
}
}

export class RemoveBreakpointAction extends AbstractDebugAction {
static ID = 'workbench.debug.viewlet.action.removeBreakpoint';
static LABEL = nls.localize('removeBreakpoint', "Remove Breakpoint");
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/parts/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ export interface IDebugService {
stepBack(threadId: number): TPromise<void>;
continue(threadId: number): TPromise<void>;
pause(threadId: number): TPromise<any>;
restartFrame(frameId: number): TPromise<any>;
}

// Editor interfaces
Expand Down
8 changes: 8 additions & 0 deletions src/vs/workbench/parts/debug/electron-browser/debugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,14 @@ export class DebugService implements debug.IDebugService {
return this.session.pause({ threadId });
}

public restartFrame(frameId: number): TPromise<any> {
if (!this.session) {
return TPromise.as(null);
}

return this.session.restartFrame({ frameId });
}

private lazyTransitionToRunningState(threadId?: number): void {
let setNewFocusedStackFrameScheduler: RunOnceScheduler;
const toDispose = this.session.onDidStop(e => {
Expand Down
22 changes: 13 additions & 9 deletions src/vs/workbench/parts/debug/electron-browser/debugViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,19 +294,23 @@ export class CallStackActionProvider implements renderer.IActionProvider {
}

public hasSecondaryActions(tree: tree.ITree, element: any): boolean {
return element instanceof model.Thread;
return element instanceof model.Thread || element instanceof model.StackFrame;
}

public getSecondaryActions(tree: tree.ITree, element: any): TPromise<actions.IAction[]> {
const actions: actions.Action[] = [];
const thread = <model.Thread>element;
if (thread.stopped) {
actions.push(this.instantiationService.createInstance(debugactions.ContinueAction, debugactions.ContinueAction.ID, debugactions.ContinueAction.LABEL));
actions.push(this.instantiationService.createInstance(debugactions.StepOverDebugAction, debugactions.StepOverDebugAction.ID, debugactions.StepOverDebugAction.LABEL));
actions.push(this.instantiationService.createInstance(debugactions.StepIntoDebugAction, debugactions.StepIntoDebugAction.ID, debugactions.StepIntoDebugAction.LABEL));
actions.push(this.instantiationService.createInstance(debugactions.StepOutDebugAction, debugactions.StepOutDebugAction.ID, debugactions.StepOutDebugAction.LABEL));
} else {
actions.push(this.instantiationService.createInstance(debugactions.PauseAction, debugactions.PauseAction.ID, debugactions.PauseAction.LABEL));
if (element instanceof model.Thread) {
const thread = <model.Thread>element;
if (thread.stopped) {
actions.push(this.instantiationService.createInstance(debugactions.ContinueAction, debugactions.ContinueAction.ID, debugactions.ContinueAction.LABEL));
actions.push(this.instantiationService.createInstance(debugactions.StepOverDebugAction, debugactions.StepOverDebugAction.ID, debugactions.StepOverDebugAction.LABEL));
actions.push(this.instantiationService.createInstance(debugactions.StepIntoDebugAction, debugactions.StepIntoDebugAction.ID, debugactions.StepIntoDebugAction.LABEL));
actions.push(this.instantiationService.createInstance(debugactions.StepOutDebugAction, debugactions.StepOutDebugAction.ID, debugactions.StepOutDebugAction.LABEL));
} else {
actions.push(this.instantiationService.createInstance(debugactions.PauseAction, debugactions.PauseAction.ID, debugactions.PauseAction.LABEL));
}
} else if (element instanceof model.StackFrame) {
actions.push(this.instantiationService.createInstance(debugactions.RestartFrameAction, debugactions.RestartFrameAction.ID, debugactions.RestartFrameAction.LABEL));
}

return TPromise.as(actions);
Expand Down
4 changes: 4 additions & 0 deletions src/vs/workbench/parts/debug/node/rawDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
return this.send('setVariable', args);
}

public restartFrame(args: DebugProtocol.RestartFrameArguments): TPromise<DebugProtocol.RestartFrameResponse> {
return this.send('restartFrame', args);
}

public disconnect(restart = false, force = false): TPromise<DebugProtocol.DisconnectResponse> {
if (this.stopServerPending && force) {
return this.stopServer();
Expand Down
4 changes: 4 additions & 0 deletions src/vs/workbench/parts/debug/test/common/mockDebugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ export class MockDebugService implements debug.IDebugService {
public setVariable(variable: debug.IExpression, value: string): TPromise<any> {
return TPromise.as(null);
}

public restartFrame(frameId: number): TPromise<any> {
return TPromise.as(null);
}
}


Expand Down

0 comments on commit 70cba8b

Please sign in to comment.