From ff7d4095bca5de06b9a8733020471befeedfba7f Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 1 Mar 2016 15:20:07 +0100 Subject: [PATCH] debug: show stoppedEvent.text on hover fixes #3101 --- .../parts/debug/browser/debugEditorModelManager.ts | 2 +- src/vs/workbench/parts/debug/browser/debugViewlet.ts | 10 +++++++--- src/vs/workbench/parts/debug/common/debug.ts | 10 ++++++++-- src/vs/workbench/parts/debug/common/debugModel.ts | 10 +++++----- .../parts/debug/electron-browser/debugService.ts | 2 +- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts b/src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts index a856a908d7f..a51fc716661 100644 --- a/src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts +++ b/src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts @@ -151,7 +151,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution { range: createRange(sf.lineNumber, sf.column, sf.lineNumber, sf.column + 1) }); - if (thread.stoppedReason === 'exception') { + if (thread.stoppedDetails.reason === 'exception') { result.push({ options: DebugEditorModelManager.TOP_STACK_FRAME_EXCEPTION_DECORATION, range: wholeLineRange diff --git a/src/vs/workbench/parts/debug/browser/debugViewlet.ts b/src/vs/workbench/parts/debug/browser/debugViewlet.ts index ce38f1d4a39..91dc762527e 100644 --- a/src/vs/workbench/parts/debug/browser/debugViewlet.ts +++ b/src/vs/workbench/parts/debug/browser/debugViewlet.ts @@ -252,11 +252,15 @@ class CallStackView extends viewlet.CollapsibleViewletView { this.toDispose.push(debugModel.addListener2(debug.ModelEvents.CALLSTACK_UPDATED, () => { this.tree.refresh().done(null, errors.onUnexpectedError); })); + this.toDispose.push(this.debugService.getViewModel().addListener2(debug.ViewModelEvents.FOCUSED_STACK_FRAME_UPDATED, () => { const focussedThread = this.debugService.getModel().getThreads()[this.debugService.getViewModel().getFocusedThreadId()]; - if (focussedThread && focussedThread.stoppedReason && focussedThread.stoppedReason !== 'step') { - this.pauseMessageLabel.text(nls.localize('debugStopped', "Paused on {0}", focussedThread.stoppedReason)); - focussedThread.stoppedReason === 'exception' ? this.pauseMessageLabel.addClass('exception') : this.pauseMessageLabel.removeClass('exception'); + if (focussedThread && focussedThread.stoppedDetails && focussedThread.stoppedDetails.reason !== 'step') { + this.pauseMessageLabel.text(nls.localize('debugStopped', "Paused on {0}", focussedThread.stoppedDetails.reason)); + if (focussedThread.stoppedDetails.text) { + this.pauseMessageLabel.title(focussedThread.stoppedDetails.text); + } + focussedThread.stoppedDetails.reason === 'exception' ? this.pauseMessageLabel.addClass('exception') : this.pauseMessageLabel.removeClass('exception'); this.pauseMessage.show(); } else { this.pauseMessage.hide(); diff --git a/src/vs/workbench/parts/debug/common/debug.ts b/src/vs/workbench/parts/debug/common/debug.ts index c1a22a6db4d..06b760de384 100644 --- a/src/vs/workbench/parts/debug/common/debug.ts +++ b/src/vs/workbench/parts/debug/common/debug.ts @@ -24,7 +24,13 @@ export interface IRawModelUpdate { threadId: number; thread?: DebugProtocol.Thread; callStack?: DebugProtocol.StackFrame[]; - stoppedReason?: string; + stoppedDetails?: IRawStoppedDetails; +} + +export interface IRawStoppedDetails { + reason: string; + threadId?: number; + text?: string; } // model @@ -48,7 +54,7 @@ export interface IThread extends ITreeElement { threadId: number; name: string; callStack: IStackFrame[]; - stoppedReason: string; + stoppedDetails: IRawStoppedDetails; } export interface IScope extends IExpressionContainer { diff --git a/src/vs/workbench/parts/debug/common/debugModel.ts b/src/vs/workbench/parts/debug/common/debugModel.ts index 1aadb34446b..f309abe2d08 100644 --- a/src/vs/workbench/parts/debug/common/debugModel.ts +++ b/src/vs/workbench/parts/debug/common/debugModel.ts @@ -90,10 +90,10 @@ export function getFullExpressionName(expression: debug.IExpression, sessionType export class Thread implements debug.IThread { - public stoppedReason: string; + public stoppedDetails: debug.IRawStoppedDetails; constructor(public name: string, public threadId, public callStack: debug.IStackFrame[]) { - this.stoppedReason = undefined; + this.stoppedDetails = undefined; } public getId(): string { @@ -358,7 +358,7 @@ export class Model extends ee.EventEmitter implements debug.IModel { delete this.threads[reference]; } else { this.threads[reference].callStack = []; - this.threads[reference].stoppedReason = undefined; + this.threads[reference].stoppedDetails = undefined; } } else { if (removeThreads) { @@ -368,7 +368,7 @@ export class Model extends ee.EventEmitter implements debug.IModel { for (let ref in this.threads) { if (this.threads.hasOwnProperty(ref)) { this.threads[ref].callStack = []; - this.threads[ref].stoppedReason = undefined; + this.threads[ref].stoppedDetails = undefined; } } } @@ -636,7 +636,7 @@ export class Model extends ee.EventEmitter implements debug.IModel { return new StackFrame(data.threadId, rsf.id, rsf.source ? new Source(rsf.source) : new Source({ name: 'unknown' }), rsf.name, rsf.line, rsf.column); }); - this.threads[data.threadId].stoppedReason = data.stoppedReason; + this.threads[data.threadId].stoppedDetails = data.stoppedDetails; } this.emit(debug.ModelEvents.CALLSTACK_UPDATED); diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index 6fed490ba46..e5ce45a69bb 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -240,7 +240,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService this.getThreadData(threadId).then(() => { this.session.stackTrace({ threadId: threadId, levels: 20 }).done((result) => { - this.model.rawUpdate({ threadId: threadId, callStack: result.body.stackFrames, stoppedReason: event.body.reason }); + this.model.rawUpdate({ threadId: threadId, callStack: result.body.stackFrames, stoppedDetails: event.body }); this.windowService.getWindow().focus(); const callStack = this.model.getThreads()[threadId].callStack; if (callStack.length > 0) { -- GitLab