-
Notifications
You must be signed in to change notification settings - Fork 20
Editable 'Watch' Window Values
Unlike Visual Studio Code, the values of items added to the "Watch" window in Visual Studio can be modified.
To support editable watch values, a debug adapter must:
- Implement a handler for the custom
setExpression
request - Return
true
for thesupportsSetExpression
field in theCapabilities
object returned in response to theinitialize
request.
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. |
The response to the setExpression
request should contain the following fields:
Name | Type | Description |
---|---|---|
value |
string | The new value of the expression. |
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.