Skip to content

Commit

Permalink
fixes #49548
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed May 10, 2018
1 parent 509a683 commit 6a1833f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions src/vs/workbench/parts/debug/browser/debugActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { CollapseAction } from 'vs/workbench/browser/viewlet';
import { ITree } from 'vs/base/parts/tree/browser/tree';
import { first } from 'vs/base/common/arrays';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { memoize } from 'vs/base/common/decorators';

export abstract class AbstractDebugAction extends Action {

Expand All @@ -32,7 +33,7 @@ export abstract class AbstractDebugAction extends Action {
constructor(
id: string, label: string, cssClass: string,
@IDebugService protected debugService: IDebugService,
@IKeybindingService private keybindingService: IKeybindingService,
@IKeybindingService protected keybindingService: IKeybindingService,
public weight?: number
) {
super(id, label, cssClass, false);
Expand Down Expand Up @@ -215,21 +216,20 @@ export class RestartAction extends AbstractDebugAction {
static LABEL = nls.localize('restartDebug', "Restart");
static RECONNECT_LABEL = nls.localize('reconnectDebug', "Reconnect");

private startAction: StartAction;

constructor(id: string, label: string,
@IDebugService debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
@IWorkspaceContextService private contextService?: IWorkspaceContextService,
@IHistoryService historyService?: IHistoryService
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IHistoryService private historyService: IHistoryService
) {
super(id, label, 'debug-action restart', debugService, keybindingService, 70);
this.setLabel(this.debugService.getViewModel().focusedSession);
this.toDispose.push(this.debugService.getViewModel().onDidFocusStackFrame(() => this.setLabel(this.debugService.getViewModel().focusedSession)));
}

if (contextService !== undefined && historyService !== undefined) {
this.startAction = new StartAction(id, label, debugService, keybindingService, contextService, historyService);
}
@memoize
private get startAction(): StartAction {
return new StartAction(StartAction.ID, StartAction.LABEL, this.debugService, this.keybindingService, this.contextService, this.historyService);
}

private setLabel(session: ISession): void {
Expand Down
10 changes: 5 additions & 5 deletions src/vs/workbench/parts/debug/browser/debugActionsWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import { registerColor, contrastBorder, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
import { localize } from 'vs/nls';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { RunOnceScheduler } from 'vs/base/common/async';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';

const DEBUG_ACTIONS_WIDGET_POSITION_KEY = 'debug.actionswidgetposition';

Expand Down Expand Up @@ -65,8 +65,8 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
@IConfigurationService private configurationService: IConfigurationService,
@IThemeService themeService: IThemeService,
@IKeybindingService private keybindingService: IKeybindingService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IContextViewService contextViewService: IContextViewService
@IContextViewService contextViewService: IContextViewService,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(themeService);

Expand Down Expand Up @@ -250,10 +250,10 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
this.allActions.push(new StepOverAction(StepOverAction.ID, StepOverAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new StepIntoAction(StepIntoAction.ID, StepIntoAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new StepOutAction(StepOutAction.ID, StepOutAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new RestartAction(RestartAction.ID, RestartAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(this.instantiationService.createInstance(RestartAction, RestartAction.ID, RestartAction.LABEL));
this.allActions.push(new StepBackAction(StepBackAction.ID, StepBackAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new ReverseContinueAction(ReverseContinueAction.ID, ReverseContinueAction.LABEL, this.debugService, this.keybindingService));
this.allActions.push(new FocusSessionAction(FocusSessionAction.ID, FocusSessionAction.LABEL, this.debugService, this.keybindingService, this.editorService));
this.allActions.push(this.instantiationService.createInstance(FocusSessionAction, FocusSessionAction.ID, FocusSessionAction.LABEL));
this.allActions.forEach(a => {
this.toUnbind.push(a);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class CallStackView extends TreeViewsViewletPanel {
public renderBody(container: HTMLElement): void {
dom.addClass(container, 'debug-call-stack');
this.treeContainer = renderViewTree(container);
const actionProvider = new CallStackActionProvider(this.debugService, this.keybindingService);
const actionProvider = new CallStackActionProvider(this.debugService, this.keybindingService, this.instantiationService);
const controller = this.instantiationService.createInstance(CallStackController, actionProvider, MenuId.DebugCallStackContext, {});

this.tree = this.instantiationService.createInstance(WorkbenchTree, this.treeContainer, {
Expand Down Expand Up @@ -238,7 +238,7 @@ class CallStackController extends BaseDebugController {

class CallStackActionProvider implements IActionProvider {

constructor(private debugService: IDebugService, private keybindingService: IKeybindingService) {
constructor(private debugService: IDebugService, private keybindingService: IKeybindingService, private instantiationService: IInstantiationService) {
// noop
}

Expand All @@ -257,7 +257,7 @@ class CallStackActionProvider implements IActionProvider {
public getSecondaryActions(tree: ITree, element: any): TPromise<IAction[]> {
const actions: IAction[] = [];
if (element instanceof Session) {
actions.push(new RestartAction(RestartAction.ID, RestartAction.LABEL, this.debugService, this.keybindingService));
actions.push(this.instantiationService.createInstance(RestartAction, RestartAction.ID, RestartAction.LABEL));
actions.push(new StopAction(StopAction.ID, StopAction.LABEL, this.debugService, this.keybindingService));
} else if (element instanceof Thread) {
const thread = <Thread>element;
Expand Down

0 comments on commit 6a1833f

Please sign in to comment.