Skip to content

Commit

Permalink
Only include StepBack in the DebugActionsWidget when supported
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Jun 15, 2016
1 parent fe9e6b1 commit fd1eed2
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/vs/workbench/parts/debug/browser/debugActionsWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class DebugActionsWidget implements wbext.IWorkbenchContribution {
private actions: actions.IAction[];
private pauseAction: dbgactions.PauseAction;
private continueAction: dbgactions.ContinueAction;
private stepBackAction: dbgactions.StepBackDebugAction;
private isVisible: boolean;
private isBuilt: boolean;

Expand Down Expand Up @@ -112,7 +113,6 @@ export class DebugActionsWidget implements wbext.IWorkbenchContribution {
instantiationService.createInstance(dbgactions.StepOverDebugAction, dbgactions.StepOverDebugAction.ID, dbgactions.StepOverDebugAction.LABEL),
instantiationService.createInstance(dbgactions.StepIntoDebugAction, dbgactions.StepIntoDebugAction.ID, dbgactions.StepIntoDebugAction.LABEL),
instantiationService.createInstance(dbgactions.StepOutDebugAction, dbgactions.StepOutDebugAction.ID, dbgactions.StepOutDebugAction.LABEL),
instantiationService.createInstance(dbgactions.StepBackDebugAction, dbgactions.StepBackDebugAction.ID, dbgactions.StepBackDebugAction.LABEL),
instantiationService.createInstance(dbgactions.RestartDebugAction, dbgactions.RestartDebugAction.ID, dbgactions.RestartDebugAction.LABEL),
instantiationService.createInstance(dbgactions.StopDebugAction, dbgactions.StopDebugAction.ID, dbgactions.StopDebugAction.LABEL)
];
Expand All @@ -121,10 +121,22 @@ export class DebugActionsWidget implements wbext.IWorkbenchContribution {
this.toDispose.push(a);
});
this.toDispose.push(this.pauseAction);
this.toDispose.push(this.continueAction);
}
this.actions[0] = state === debug.State.Running ? this.pauseAction : this.continueAction;

return this.actions;
const activeSession = this.debugService.getActiveSession();
if (activeSession && activeSession.configuration.capabilities.supportsStepBack) {
if (!this.stepBackAction) {
this.stepBackAction = instantiationService.createInstance(dbgactions.StepBackDebugAction, dbgactions.StepBackDebugAction.ID, dbgactions.StepBackDebugAction.LABEL);
this.toDispose.push(this.stepBackAction);
}

// Return a copy of this.actions containing stepBackAction
return [...this.actions.slice(0, 4), this.stepBackAction, ...this.actions.slice(4)];
} else {
return this.actions;
}
}

public dispose(): void {
Expand Down

0 comments on commit fd1eed2

Please sign in to comment.