Skip to content
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

Allow requests to specify formatting hints. #82

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions debugProtocol.json
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,10 @@
"levels": {
"type": "integer",
"description": "The maximum number of frames to return. If levels is not specified or 0, all frames are returned."
},
"format": {
"$ref": "#/definitions/StackFrameFormat",
"description": "Specifies details on how to format the stack frames."
}
},
"required": [ "threadId" ]
Expand Down Expand Up @@ -1213,6 +1217,10 @@
"count": {
"type": "integer",
"description": "The number of variables to return. If count is missing or 0, all variables are returned."
},
"format": {
"$ref": "#/definitions/ValueFormat",
"description": "Specifies details on how to format the values."
}
},
"required": [ "variablesReference" ]
Expand Down Expand Up @@ -1487,6 +1495,10 @@
"type": "string",
"_enum": [ "watch", "repl", "hover" ],
"description": "The context in which the evaluate request is run. Possible values are 'watch' if evaluate is run in a watch, 'repl' if run from the REPL console, or 'hover' if run from a data hover."
},
"format": {
"$ref": "#/definitions/ValueFormat",
"description": "Specifies details on how to format the result."
}
},
"required": [ "expression" ]
Expand Down Expand Up @@ -2287,6 +2299,51 @@
}
},
"required": [ "algorithm", "checksum" ]
},

"ValueFormat": {
"type": "object",
"description": "Provides formatting information for a value.",
"properties": {
"hex": {
"type": "boolean",
"description": "Displays the value in hex."
}
}
},

"StackFrameFormat": {
"allOf": [ { "$ref": "#/definitions/ValueFormat" }, {
"type": "object",
"description": "Provides formatting information for a stack frame.",
"properties": {
"parameters": {
"type": "boolean",
"description": "Displays parameters for the stack frame."
},
"parameterTypes": {
"type": "boolean",
"description": "Displays the types of parameters for the stack frame."
},
"parameterNames": {
"type": "boolean",
"description": "Displays the names of parameters for the stack frame."
},
"parameterValues": {
"type": "boolean",
"description": "Displays the values of parameters for the stack frame."
},
"line": {
"type": "boolean",
"description": "Displays the line number of the stack frame."
},
"module": {
"type": "boolean",
"description": "Displays the module of the stack frame."
}
}
}]
}

}
}
28 changes: 28 additions & 0 deletions protocol/src/debugProtocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,8 @@ export module DebugProtocol {
startFrame?: number;
/** The maximum number of frames to return. If levels is not specified or 0, all frames are returned. */
levels?: number;
/** Specifies details on how to format the stack frames. */
format?: StackFrameFormat;
}

/** Response to 'stackTrace' request. */
Expand Down Expand Up @@ -625,6 +627,8 @@ export module DebugProtocol {
start?: number;
/** The number of variables to return. If count is missing or 0, all variables are returned. */
count?: number;
/** Specifies details on how to format the values. */
format?: ValueFormat;
}

/** Response to 'variables' request. */
Expand Down Expand Up @@ -753,6 +757,8 @@ export module DebugProtocol {
frameId?: number;
/** The context in which the evaluate request is run. Possible values are 'watch' if evaluate is run in a watch, 'repl' if run from the REPL console, or 'hover' if run from a data hover. */
context?: string;
/** Specifies details on how to format the result. */
format?: ValueFormat;
}

/** Response to 'evaluate' request. */
Expand Down Expand Up @@ -1177,5 +1183,27 @@ export module DebugProtocol {
/** Value of the checksum. */
checksum: string;
}

/** Provides formatting information for a value. */
export interface ValueFormat {
/** Displays the value in hex. */
hex?: boolean;
}

/** Provides formatting information for a stack frame. */
export interface StackFrameFormat extends ValueFormat {
/** Displays parameters for the stack frame. */
parameters?: boolean;
/** Displays the types of parameters for the stack frame. */
parameterTypes?: boolean;
/** Displays the names of parameters for the stack frame. */
parameterNames?: boolean;
/** Displays the values of parameters for the stack frame. */
parameterValues?: boolean;
/** Displays the line number of the stack frame. */
line?: boolean;
/** Displays the module of the stack frame. */
module?: boolean;
}
}