Skip to content

Commit

Permalink
debug: restart frame on hover
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed Nov 21, 2019
1 parent f4f0062 commit 8f02213
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/vs/workbench/contrib/debug/browser/callStackView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ interface IStackFrameTemplateData {
fileName: HTMLElement;
lineNumber: HTMLElement;
label: HighlightedLabel;
actionBar: ActionBar;
}

class SessionsRenderer implements ITreeRenderer<IDebugSession, FuzzyScore, ISessionTemplateData> {
Expand Down Expand Up @@ -481,15 +482,18 @@ class StackFramesRenderer implements ITreeRenderer<IStackFrame, FuzzyScore, ISta
const wrapper = dom.append(file, $('span.line-number-wrapper'));
const lineNumber = dom.append(wrapper, $('span.line-number'));
const label = new HighlightedLabel(labelDiv, false);
const actionBar = new ActionBar(stackFrame);

return { file, fileName, label, lineNumber, stackFrame };
return { file, fileName, label, lineNumber, stackFrame, actionBar };
}

renderElement(element: ITreeNode<IStackFrame, FuzzyScore>, index: number, data: IStackFrameTemplateData): void {
const stackFrame = element.element;
dom.toggleClass(data.stackFrame, 'disabled', !stackFrame.source || !stackFrame.source.available || isDeemphasized(stackFrame));
dom.toggleClass(data.stackFrame, 'label', stackFrame.presentationHint === 'label');
dom.toggleClass(data.stackFrame, 'subtle', stackFrame.presentationHint === 'subtle');
const hasActions = stackFrame.thread.session.capabilities.supportsRestartFrame;
dom.toggleClass(data.stackFrame, 'has-actions', hasActions);

data.file.title = stackFrame.source.inMemory ? stackFrame.source.uri.path : this.labelService.getUriLabel(stackFrame.source.uri);
if (stackFrame.source.raw.origin) {
Expand All @@ -506,10 +510,18 @@ class StackFramesRenderer implements ITreeRenderer<IStackFrame, FuzzyScore, ISta
} else {
dom.addClass(data.lineNumber, 'unavailable');
}

data.actionBar.clear();
if (hasActions) {
const action = new Action('debug.callStack.restartFrame', nls.localize('restartFrame', "Restart Frame"), 'codicon-debug-restart', true, () => {
return stackFrame.restart();
});
data.actionBar.push(action, { icon: true, label: false });
}
}

disposeTemplate(templateData: IStackFrameTemplateData): void {
// noop
templateData.actionBar.dispose();
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/debug/browser/media/debugViewlet.css
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@
display: none;
}

.debug-viewlet .debug-call-stack .monaco-list-row:hover .stack-frame.has-actions .file,
.debug-viewlet .debug-call-stack .monaco-list-row.focused .stack-frame.has-actions .file {
display: none;
}

.debug-viewlet .debug-call-stack .monaco-list-row .monaco-action-bar {
display: none;
}
Expand Down

0 comments on commit 8f02213

Please sign in to comment.