KEMBAR78
Debug Protocol: Include display hints on evaluation results · Issue #123 · microsoft/vscode-debugadapter-node · GitHub
Skip to content

Debug Protocol: Include display hints on evaluation results #123

@andrewcrawley

Description

@andrewcrawley

The VS UI shows icons for locals, watches, etc to indicate the type of the evaluated value. We need to plumb this information through the protocol so debug adapters can indicate to the UI which icons and other visual states to apply.

Our proposal (implemented and verified in the VS Debug Adapter Host and VsDbg):

export interface EvaluateResponse extends Response {
    body: {
        // ...

        /** Optional attributes describing the type to help with display.*/
        evaluationAttribute?: EvaluationAttributes;

        // ...
    };
}

export interface Variable {
    // ...

    /** Optional attributes describing the type to help with display.*/
    evaluationAttribute?: EvaluationAttributes;

    // ...
}

export interface EvaluationAttributes {
    /** Evaluation of the expression failed. Allows additional information to be passed during an evaluation failure.*/
    isFailedEvaluation?: boolean;
    /** Indicates that the object is read only.*/
    isReadOnly?: boolean;
    /** Indicates that the object is a raw string.*/
    isRawString?: boolean;
    /** Indicates that the object can have an Object ID created for it.*/
    hasObjectId?: boolean;
    /** Indicates that the object has an Object ID associated with it.*/
    canHaveObjectId?: boolean;
    /** Indicates that the evaluation had side effects.*/
    hasSideEffects?: boolean;
    /** Indicates that the object is static.*/
    isStatic?: boolean;
    /** Indicates that the object is a constant.*/
    isConstant?: boolean;
    /** Type of the expression: property, method, etc.*/
    expressionType?: 'property' | 'method' | 'class' | 'data' | 'event' | 'baseClass' | 'innerClass' | 'interface' | 'mostDerivedClass';
    /** Access type of the expression: public, private, etc.*/
    accessLevel?: 'public' | 'private' | 'protected' | 'internal' | 'final';
}

We considered implementing this via the Kind field on Variable (and adding that field to EvaluateResult), e.g. "kind"="public;property;static;readonly", but we didn't like that for two reasons:

  1. It allows you to specify "impossible" combinations, e.g. public;private
  2. It requires a bunch of extra logic to generate and parse these strings, and we felt that it was more appropriate to use JSON.

Namedrops: @weinand @richardstanton @gregg-miskelly @pieandcakes @digeff

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions