-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug Protocol: Include display hints on evaluation results #123
Comments
LGTM |
The Currently 'kind' is of type 'string' because we could not agree on a better type. I've reviewed @andrewcrawley's proposal and here is my feedback/proposal: "open" enums
The resulting typescript looks like: /** Response to 'evaluate' request. */
export interface EvaluateResponse extends Response {
body: {
// ...
/** Properties of a evaluate result that can be used to determine how to render the result in the UI. */
presentationHint?: VariablePresentationHint;
// ...
};
}
export interface Variable {
// ...
/** Properties of a variable that can be used to determine how to render the variable in the UI. */
presentationHint?: VariablePresentationHint;
// ...
}
/** Optional properties of a variable that can be used to determine how to render the variable in the UI. */
export interface VariablePresentationHint {
/** The kind of variable. Before introducing additional values, try to use the listed values.
Values: 'property', 'method', 'class', 'data', 'event', 'baseClass', 'innerClass', 'interface', 'mostDerivedClass', etc.
*/
kind?: string;
/** Set of attributes represented as an array of strings. Before introducing additional values, try to use the listed values.
Values:
'static': Indicates that the object is static.
'constant': Indicates that the object is a constant.
'readOnly': Indicates that the object is read only.
'rawString': Indicates that the object is a raw string.
'hasObjectId': Indicates that the object can have an Object ID created for it.
'canHaveObjectId': Indicates that the object has an Object ID associated with it.
'hasSideEffects': Indicates that the evaluation had side effects.
etc.
*/
attributes?: string[];
/** Visibility of variable. Before introducing additional values, try to use the listed values.
Values: 'public', 'private', 'protected', 'internal', 'final', etc.
*/
visibility?: string;
} and here is the JSON schema: "VariablePresentationHint": {
"type": "object",
"description": "Optional properties of a variable that can be used to determine how to render the variable in the UI.",
"properties": {
"kind": {
"description": "The kind of variable. Before introducing additional values, try to use the listed values.",
"type": "string",
"_enum": [ "property", "method", "class", "data", "event", "baseClass", "innerClass", "interface", "mostDerivedClass" ]
},
"attributes": {
"description": "Set of attributes represented as an array of strings. Before introducing additional values, try to use the listed values.",
"type": "array",
"items": {
"type": "string",
"_enum": [ "static", "constant", "readOnly", "rawString", "hasObjectId", "canHaveObjectId", "hasSideEffects" ],
"enumDescriptions": [
"Indicates that the object is static.",
"Indicates that the object is a constant.",
"Indicates that the object is read only.",
"Indicates that the object is a raw string.",
"Indicates that the object can have an Object ID created for it.",
"Indicates that the object has an Object ID associated with it.",
"Indicates that the evaluation had side effects."
]
}
},
"visibility": {
"description": "Visibility of variable. Before introducing additional values, try to use the listed values.",
"type": "string",
"_enum": [ "public", "private", "protected", "internal", "final" ]
}
}
} @richardstanton @gregg-miskelly @pieandcakes @digeff @andrewcrawley what do you think? |
I'm OK with merging the bool fields into an array like you propose. I'm not sure what the objection is to using actual enums instead of strings? As you noted in #30, VSCode doesn't show icons, so it probably doesn't care about these values, and VS only assigns meaning to the listed values (which are not C++ / C# specific, btw - dozens of debuggers in VS use these values). If I'm writing a Java debug adapter and I specify a |
We do not want to hardcode a very specific value set into this specification. If one (not yet known) debugger frontend decides to support a specific visibility value in its UI for their Simula-67 DA, we want to support that without requiring them to have to ask us for a protocol addition. So it would be ideal if we could directly express an "open" enum in the schema and all target languages would support that. Please note that you are free to transform the JSON-schema into C# by using real enums! All the information is there. You don't have to use strings. But you need to fail gracefully when receiving an unknown enum value from the Simula-67 DA. |
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):
We considered implementing this via the
Kind
field onVariable
(and adding that field toEvaluateResult
), e.g."kind"="public;property;static;readonly"
, but we didn't like that for two reasons:public;private
Namedrops: @weinand @richardstanton @gregg-miskelly @pieandcakes @digeff
The text was updated successfully, but these errors were encountered: