From 8236d1e992d2135dea63ed1c8fb9b124bf596e8a Mon Sep 17 00:00:00 2001 From: isidor Date: Fri, 28 Oct 2016 12:02:53 +0200 Subject: [PATCH] debug: simplify transition to running state --- src/vs/workbench/parts/debug/common/debugModel.ts | 2 +- .../parts/debug/electron-browser/debugService.ts | 15 ++------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/vs/workbench/parts/debug/common/debugModel.ts b/src/vs/workbench/parts/debug/common/debugModel.ts index 57b109ce050..87b3ef7ccff 100644 --- a/src/vs/workbench/parts/debug/common/debugModel.ts +++ b/src/vs/workbench/parts/debug/common/debugModel.ts @@ -490,7 +490,7 @@ export class Process implements debug.IProcess { } public getId(): string { - return this._session.getId();; + return this._session.getId(); } public rawUpdate(data: debug.IRawModelUpdate): void { diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index 458df9ad131..1ddf8591d22 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -904,19 +904,8 @@ export class DebugService implements debug.IDebugService { private transitionToRunningState(session: RawDebugSession, threadId?: number): void { this.model.clearThreads(session.getId(), false, threadId); - - // TODO@Isidor remove this mess - // Get a top stack frame of a stopped thread if there is any. - const process = this.model.getProcesses().filter(p => p.getId() === session.getId()).pop(); - const stoppedThread = process && process.getAllThreads().filter(t => t.stopped).pop(); - const callStack = stoppedThread ? stoppedThread.getCachedCallStack() : null; - const stackFrameToFocus = callStack && callStack.length > 0 ? callStack[0] : null; - - if (!stoppedThread && process) { - this.setStateAndEmit(session.getId(), process.session.requestType === debug.SessionRequestType.LAUNCH_NO_DEBUG ? debug.State.RunningNoDebug : debug.State.Running); - } - - this.setFocusedStackFrameAndEvaluate(stackFrameToFocus).done(null, errors.onUnexpectedError); + this.setStateAndEmit(session.getId(), session.requestType === debug.SessionRequestType.LAUNCH_NO_DEBUG ? debug.State.RunningNoDebug : debug.State.Running); + this.setFocusedStackFrameAndEvaluate(null).done(null, errors.onUnexpectedError); } private getDebugStringEditorInput(process: debug.IProcess, source: Source, value: string, mtype: string): DebugStringEditorInput { -- GitLab