提交 bf4a478f 编写于 作者: I isidor

debug: do not surface expression.reference

上级 2634a491
......@@ -53,8 +53,8 @@ export interface ITreeElement {
}
export interface IExpressionContainer extends ITreeElement {
reference: number;
stackFrame: IStackFrame;
hasChildren: boolean;
getChildren(debugService: IDebugService): TPromise<IExpression[]>;
}
......
......@@ -168,6 +168,10 @@ export abstract class ExpressionContainer implements debug.IExpressionContainer
return this._value;
}
public get hasChildren(): boolean {
return this.reference > 0;
}
private fetchVariables(start: number, count: number, filter: 'indexed' | 'named'): TPromise<Variable[]> {
return this.stackFrame.thread.process.session.variables({
variablesReference: this.reference,
......@@ -296,7 +300,7 @@ export class Variable extends ExpressionContainer implements debug.IExpression {
return this.stackFrame.thread.process.session.setVariable({
name: this.name,
value,
variablesReference: this.parent.reference
variablesReference: (<ExpressionContainer>this.parent).reference
}).then(response => {
if (response && response.body) {
this.value = response.body.value;
......@@ -919,7 +923,6 @@ export class Model implements debug.IModel {
this.watchExpressions.forEach(we => {
we.value = Expression.DEFAULT_VALUE;
we.available = false;
we.reference = 0;
});
this._onDidChangeWatchExpressions.fire();
......
......@@ -215,7 +215,7 @@ export class DebugHoverWidget implements editorbrowser.IContentWidget {
this.isVisible = true;
this.stoleFocus = focus;
if (expression.reference === 0 || forceValueHover) {
if (!expression.hasChildren || forceValueHover) {
this.complexValueContainer.hidden = true;
this.valueContainer.hidden = false;
viewer.renderExpressionValue(expression, this.valueContainer, false, MAX_VALUE_RENDER_LENGTH_IN_HOVER);
......
......@@ -582,7 +582,7 @@ export class VariablesActionProvider implements IActionProvider {
public getSecondaryActions(tree: ITree, element: any): TPromise<IAction[]> {
let actions: IAction[] = [];
const variable = <Variable>element;
if (variable.reference === 0) {
if (!variable.hasChildren) {
actions.push(this.instantiationService.createInstance(SetValueAction, SetValueAction.ID, SetValueAction.LABEL, variable));
actions.push(this.instantiationService.createInstance(CopyValueAction, CopyValueAction.ID, CopyValueAction.LABEL, variable));
actions.push(new Separator());
......@@ -609,7 +609,7 @@ export class VariablesDataSource implements IDataSource {
}
let variable = <Variable>element;
return variable.reference !== 0 && !equalsIgnoreCase(variable.value, 'null');
return variable.hasChildren && !equalsIgnoreCase(variable.value, 'null');
}
public getChildren(tree: ITree, element: any): TPromise<any> {
......@@ -733,7 +733,7 @@ export class VariablesController extends BaseDebugController {
// double click on primitive value: open input box to be able to set the value
if (element instanceof Variable && event.detail === 2) {
const expression = <debug.IExpression>element;
if (expression.reference === 0) {
if (!expression.hasChildren) {
this.debugService.getViewModel().setSelectedExpression(expression);
}
return true;
......@@ -744,7 +744,7 @@ export class VariablesController extends BaseDebugController {
protected setSelectedExpression(tree: ITree, event: KeyboardEvent): boolean {
const element = tree.getFocus();
if (element instanceof Variable && element.reference === 0) {
if (element instanceof Variable && !element.hasChildren) {
this.debugService.getViewModel().setSelectedExpression(element);
return true;
}
......@@ -785,7 +785,7 @@ export class WatchExpressionsActionProvider implements IActionProvider {
const expression = <Expression>element;
actions.push(this.instantiationService.createInstance(AddWatchExpressionAction, AddWatchExpressionAction.ID, AddWatchExpressionAction.LABEL));
actions.push(this.instantiationService.createInstance(EditWatchExpressionAction, EditWatchExpressionAction.ID, EditWatchExpressionAction.LABEL, expression));
if (expression.reference === 0) {
if (!expression.hasChildren) {
actions.push(this.instantiationService.createInstance(CopyValueAction, CopyValueAction.ID, CopyValueAction.LABEL, expression.value));
}
actions.push(new Separator());
......@@ -796,7 +796,7 @@ export class WatchExpressionsActionProvider implements IActionProvider {
actions.push(this.instantiationService.createInstance(AddWatchExpressionAction, AddWatchExpressionAction.ID, AddWatchExpressionAction.LABEL));
if (element instanceof Variable) {
const variable = <Variable>element;
if (variable.reference === 0) {
if (!variable.hasChildren) {
actions.push(this.instantiationService.createInstance(CopyValueAction, CopyValueAction.ID, CopyValueAction.LABEL, variable.value));
}
actions.push(new Separator());
......@@ -824,7 +824,7 @@ export class WatchExpressionsDataSource implements IDataSource {
}
const watchExpression = <Expression>element;
return watchExpression.reference !== 0 && !equalsIgnoreCase(watchExpression.value, 'null');
return watchExpression.hasChildren && !equalsIgnoreCase(watchExpression.value, 'null');
}
public getChildren(tree: ITree, element: any): TPromise<any> {
......@@ -956,7 +956,7 @@ export class WatchExpressionsController extends BaseDebugController {
// double click on primitive value: open input box to be able to select and copy value.
if (element instanceof Expression && event.detail === 2) {
const expression = <debug.IExpression>element;
if (expression.reference === 0) {
if (!expression.hasChildren) {
this.debugService.getViewModel().setSelectedExpression(expression);
}
return true;
......@@ -969,7 +969,7 @@ export class WatchExpressionsController extends BaseDebugController {
const element = tree.getFocus();
if (element instanceof Expression) {
const watchExpression = <Expression>element;
if (watchExpression.reference === 0) {
if (!watchExpression.hasChildren) {
this.debugService.getViewModel().setSelectedExpression(watchExpression);
}
return true;
......
......@@ -218,7 +218,7 @@ export class ReplExpressionsRenderer implements tree.IRenderer {
private renderInputOutputPair(tree: tree.ITree, expression: debug.IExpression, templateData: IInputOutputPairTemplateData): void {
templateData.input.textContent = expression.name;
debugviewer.renderExpressionValue(expression, templateData.value, false);
if (expression.reference > 0) {
if (expression.hasChildren) {
templateData.annotation.className = 'annotation octicon octicon-info';
templateData.annotation.title = nls.localize('stateCapture', "Object state is captured from first evaluation");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册