From 8f9a2b0f4f21fd4f2b514453dbb1e830cb1fe405 Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 19 Oct 2016 18:04:19 +0200 Subject: [PATCH] move restart frame to StackFrame --- src/vs/workbench/parts/debug/browser/debugActions.ts | 9 ++++----- src/vs/workbench/parts/debug/common/debug.ts | 4 ++-- src/vs/workbench/parts/debug/common/debugModel.ts | 8 ++++++++ .../parts/debug/electron-browser/debugService.ts | 8 -------- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/vs/workbench/parts/debug/browser/debugActions.ts b/src/vs/workbench/parts/debug/browser/debugActions.ts index 0e2c1552f14..ba0b14a1254 100644 --- a/src/vs/workbench/parts/debug/browser/debugActions.ts +++ b/src/vs/workbench/parts/debug/browser/debugActions.ts @@ -333,12 +333,11 @@ export class RestartFrameAction extends AbstractDebugAction { } public run(frame: debug.IStackFrame): TPromise { + if (!frame) { + frame = this.debugService.getViewModel().focusedStackFrame; + } - const frameId = (frame && frame instanceof model.StackFrame) - ? frame.frameId - : this.debugService.getViewModel().focusedStackFrame.frameId; - - return this.debugService.restartFrame(frameId); + return frame.restart(); } } diff --git a/src/vs/workbench/parts/debug/common/debug.ts b/src/vs/workbench/parts/debug/common/debug.ts index d1b4eef6a8d..ccc4c492c76 100644 --- a/src/vs/workbench/parts/debug/common/debug.ts +++ b/src/vs/workbench/parts/debug/common/debug.ts @@ -75,6 +75,7 @@ export interface IBaseSession { disconnect(restart?: boolean, force?: boolean): TPromise; custom(request: string, args: any): TPromise; onDidEvent: Event; + restartFrame(args: DebugProtocol.RestartFrameArguments): TPromise; } export interface ISession extends IBaseSession, ITreeElement { @@ -93,7 +94,6 @@ export interface ISession extends IBaseSession, ITreeElement { continue(args: DebugProtocol.ContinueArguments): TPromise; pause(args: DebugProtocol.PauseArguments): TPromise; setVariable(args: DebugProtocol.SetVariableArguments): TPromise; - restartFrame(args: DebugProtocol.RestartFrameArguments): TPromise; completions(args: DebugProtocol.CompletionsArguments): TPromise; next(args: DebugProtocol.NextArguments): TPromise; source(args: DebugProtocol.SourceArguments): TPromise; @@ -166,6 +166,7 @@ export interface IStackFrame extends ITreeElement { frameId: number; source: Source; getScopes(): TPromise; + restart(): TPromise; } export interface IEnablement extends ITreeElement { @@ -461,7 +462,6 @@ export interface IDebugService { stepBack(threadId: number): TPromise; continue(threadId: number): TPromise; pause(threadId: number): TPromise; - restartFrame(frameId: number): TPromise; completions(text: string, position: Position): TPromise; } diff --git a/src/vs/workbench/parts/debug/common/debugModel.ts b/src/vs/workbench/parts/debug/common/debugModel.ts index b8015e774d9..d4d9260ae8b 100644 --- a/src/vs/workbench/parts/debug/common/debugModel.ts +++ b/src/vs/workbench/parts/debug/common/debugModel.ts @@ -330,6 +330,10 @@ export class StackFrame implements debug.IStackFrame { return this.scopes; } + + public restart(): TPromise { + return this.thread.process.restartFrame({ frameId: this.frameId }); + } } export class Thread implements debug.IThread { @@ -515,6 +519,10 @@ export class Process implements debug.IProcess { public get onDidEvent(): Event { return this.session.onDidEvent; } + + public restartFrame(args: DebugProtocol.RestartFrameArguments): TPromise { + return this.session.restartFrame(args); + } } export class Breakpoint implements debug.IBreakpoint { diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index 62c540886e3..6ecaffdc9d7 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -942,14 +942,6 @@ export class DebugService implements debug.IDebugService { return this.session.pause({ threadId }); } - public restartFrame(frameId: number): TPromise { - if (!this.session) { - return TPromise.as(null); - } - - return this.session.restartFrame({ frameId }); - } - public completions(text: string, position: Position): TPromise { if (!this.session || !this.session.configuration.capabilities.supportsCompletionsRequest) { return TPromise.as([]); -- GitLab