提交 d9e331fa 编写于 作者: I isidor

debug: minor refactoring when fetching thread data from adapter

上级 4209d9a0
...@@ -242,16 +242,13 @@ export class DebugService implements debug.IDebugService { ...@@ -242,16 +242,13 @@ export class DebugService implements debug.IDebugService {
const threadId = event.body.threadId; const threadId = event.body.threadId;
this.getThreadData(threadId).done(() => { this.getThreadData(threadId).done(() => {
let thread = this.model.getThreads()[threadId];
this.model.rawUpdate({ this.model.rawUpdate({
threadId: threadId, threadId: threadId,
stoppedDetails: event.body, stoppedDetails: event.body,
allThreadsStopped: event.body.allThreadsStopped allThreadsStopped: event.body.allThreadsStopped
}); });
thread.getCallStack(this).then(callStack => { this.model.getThreads()[threadId].getCallStack(this).then(callStack => {
this.windowService.getWindow().focus();
if (callStack.length > 0) { if (callStack.length > 0) {
// focus first stack frame from top that has source location // focus first stack frame from top that has source location
const stackFrameToFocus = arrays.first(callStack, sf => sf.source && sf.source.available, callStack[0]); const stackFrameToFocus = arrays.first(callStack, sf => sf.source && sf.source.available, callStack[0]);
...@@ -275,15 +272,7 @@ export class DebugService implements debug.IDebugService { ...@@ -275,15 +272,7 @@ export class DebugService implements debug.IDebugService {
this.toDisposeOnSessionEnd.push(this.session.onDidThread(event => { this.toDisposeOnSessionEnd.push(this.session.onDidThread(event => {
if (event.body.reason === 'started') { if (event.body.reason === 'started') {
this.session.threads().done((result) => { this.getThreadData(event.body.threadId).done(null, errors.onUnexpectedError);
const thread = result.body.threads.filter(thread => thread.id === event.body.threadId).pop();
if (thread) {
this.model.rawUpdate({
threadId: thread.id,
thread: thread
});
}
}, errors.onUnexpectedError);
} else if (event.body.reason === 'exited') { } else if (event.body.reason === 'exited') {
this.model.clearThreads(true, event.body.threadId); this.model.clearThreads(true, event.body.threadId);
} }
...@@ -418,6 +407,7 @@ export class DebugService implements debug.IDebugService { ...@@ -418,6 +407,7 @@ export class DebugService implements debug.IDebugService {
public setFocusedStackFrameAndEvaluate(focusedStackFrame: debug.IStackFrame): TPromise<void> { public setFocusedStackFrameAndEvaluate(focusedStackFrame: debug.IStackFrame): TPromise<void> {
this.viewModel.setFocusedStackFrame(focusedStackFrame); this.viewModel.setFocusedStackFrame(focusedStackFrame);
this.windowService.getWindow().focus();
if (focusedStackFrame) { if (focusedStackFrame) {
return this.model.evaluateWatchExpressions(this.session, focusedStackFrame); return this.model.evaluateWatchExpressions(this.session, focusedStackFrame);
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册