Skip to content

Editable 'Watch' Window Values

Andrew Crawley edited this page Feb 1, 2018 · 1 revision

Editable "Watch" Window Values

Unlike Visual Studio Code, the values of items added to the "Watch" window in Visual Studio can be modified.

Required Implementation

To support editable watch values, a debug adapter must:

  • Implement a handler for the custom setExpression request
  • Return true for the supportsSetExpression field in the Capabilities object returned in response to the initialize request.

setExpression Request Arguments:

The setExpression request supports the following arguments:

Name Type Description
expression string The expression to modify.
value string The value to assign to the expression.
format ValueFormat Specifies how the resulting value should be formatted.
frameId integer Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope.

setExpression Response Fields

The response to the setExpression request should contain the following fields:

Name Type Description
value string The new value of the expression.

Remarks

For many languages, a setExpression request is equivalent to an evaluation of {expression} = {value}. A separate request type is necessary because not all languages use the same syntax for assignments - other syntaxes include {expression} := {value} (Pascal), and {expression} <- {value} (R). Visual Studio relies on the debug adapter to do the right thing rather than trying to craft appropriate expressions without knowledge of the application's language.

Clone this wiki locally