未验证 提交 4b74bb08 编写于 作者: I Isidor Nikolic 提交者: GitHub

Merge pull request #47219 from ivorhuang/restart-starts-debugger-if-not-started

implemented start debugger on restart debugger if debugger isn't started
......@@ -215,10 +215,21 @@ export class RestartAction extends AbstractDebugAction {
static LABEL = nls.localize('restartDebug', "Restart");
static RECONNECT_LABEL = nls.localize('reconnectDebug', "Reconnect");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
private startAction: StartAction;
constructor(id: string, label: string,
@IDebugService debugService: IDebugService,
@IKeybindingService keybindingService: IKeybindingService,
@IWorkspaceContextService private contextService?: IWorkspaceContextService,
@IHistoryService historyService?: IHistoryService
) {
super(id, label, 'debug-action restart', debugService, keybindingService, 70);
this.setLabel(this.debugService.getViewModel().focusedProcess);
this.toDispose.push(this.debugService.getViewModel().onDidFocusStackFrame(() => this.setLabel(this.debugService.getViewModel().focusedProcess)));
if (contextService !== undefined && historyService !== undefined) {
this.startAction = new StartAction(id, label, debugService, keybindingService, contextService, historyService);
}
}
private setLabel(process: IProcess): void {
......@@ -229,8 +240,9 @@ export class RestartAction extends AbstractDebugAction {
if (!(process instanceof Process)) {
process = this.debugService.getViewModel().focusedProcess;
}
if (!process) {
return TPromise.as(null);
return this.startAction.run();
}
if (this.debugService.getModel().getProcesses().length <= 1) {
......@@ -240,7 +252,11 @@ export class RestartAction extends AbstractDebugAction {
}
protected isEnabled(state: State): boolean {
return super.isEnabled(state) && (state === State.Running || state === State.Stopped);
return super.isEnabled(state) && (
state === State.Running ||
state === State.Stopped ||
StartAction.isEnabled(this.debugService, this.contextService, this.debugService.getConfigurationManager().selectedConfiguration.name)
);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册