Skip to content

Commit

Permalink
debug: show variables changed in red in viewlet.
Browse files Browse the repository at this point in the history
fixes #866
  • Loading branch information
isidorn committed Dec 22, 2015
1 parent af9bc1f commit aa00bb9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/vs/workbench/parts/debug/browser/debugViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ export function renderExpressionValue(tree: tree.ITree, arg2: debug.IExpression|
container.title = value;
}

export function renderVariable(tree: tree.ITree, variable: model.Variable, data: IVariableTemplateData, debugInactive: boolean): void {
export function renderVariable(tree: tree.ITree, variable: model.Variable, data: IVariableTemplateData, debugInactive: boolean, showChanged: boolean): void {
data.name.textContent = `${variable.name}:`;
if (variable.value) {
renderExpressionValue(tree, variable, debugInactive, data.value);
if (variable.valueChanged && showChanged) {
// Value changed color has priority over other colors.
data.value.className = 'value changed';
}
} else {
data.value.textContent = '';
data.value.title = '';
Expand Down Expand Up @@ -435,7 +439,7 @@ export class VariablesRenderer implements tree.IRenderer {
if (templateId === VariablesRenderer.SCOPE_TEMPLATE_ID) {
this.renderScope(element, templateData);
} else {
renderVariable(tree, element, templateData, this.debugService.getState() === debug.State.Inactive);
renderVariable(tree, element, templateData, this.debugService.getState() === debug.State.Inactive, true);
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/vs/workbench/parts/debug/browser/media/debugViewlet.css
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@
font-size: 11px;
}

.debug-viewlet .monaco-tree-row .expression .value.changed {
color: #E51400;
}

.debug-viewlet .monaco-inputbox {
width: 100%;
line-height: normal;
Expand Down Expand Up @@ -152,6 +156,10 @@
background: url('add-inverse.svg') center center no-repeat;
}

.vs-dark .debug-viewlet .monaco-tree-row .expression .value.changed {
color: #c10;
}

/* Breakpoints */

.debug-viewlet .debug-breakpoints .breakpoint {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/parts/debug/browser/replViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export class ReplExpressionsRenderer implements tree.IRenderer {

public renderElement(tree: tree.ITree, element: any, templateId: string, templateData: any): void {
if (templateId === ReplExpressionsRenderer.VARIABLE_TEMPLATE_ID) {
debugviewer.renderVariable(tree, element, templateData, this.debugService.getState() === debug.State.Inactive);
debugviewer.renderVariable(tree, element, templateData, this.debugService.getState() === debug.State.Inactive, false);
} else if (templateId === ReplExpressionsRenderer.INPUT_OUTPUT_PAIR_TEMPLATE_ID) {
this.renderInputOutputPair(tree, element, templateData);
} else if (templateId === ReplExpressionsRenderer.VALUE_OUTPUT_TEMPLATE_ID) {
Expand Down
5 changes: 5 additions & 0 deletions src/vs/workbench/parts/debug/common/debugModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,17 @@ export class Expression implements debug.IExpression {

export class Variable implements debug.IExpression {

public static allValues: { [id: string]: string } = {};
// Cache children to optimize debug hover behaviour.
private children: TPromise<debug.IExpression[]>;
public value: string;
public valueChanged: boolean;

constructor(public parent: debug.IExpressionContainer, public reference: number, public name: string, value: string) {
this.children = null;
this.value = massageValue(value);
this.valueChanged = Variable.allValues[this.getId()] && Variable.allValues[this.getId()] !== value;
Variable.allValues[this.getId()] = value;
}

public getId(): string {
Expand Down Expand Up @@ -336,6 +340,7 @@ export class Model extends ee.EventEmitter implements debug.IModel {
} else {
if (removeThreads) {
this.threads = {};
Variable.allValues = {};
} else {
for (var ref in this.threads) {
if (this.threads.hasOwnProperty(ref)) {
Expand Down

0 comments on commit aa00bb9

Please sign in to comment.