@@ -105,7 +105,7 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
105
105
...response . body ,
106
106
supportsConfigurationDoneRequest : true ,
107
107
supportsEvaluateForHovers : true ,
108
- supportsSetVariable : false , // TODO
108
+ supportsSetVariable : true ,
109
109
supportsConditionalBreakpoints : false , // TODO
110
110
supportsStepBack : false ,
111
111
} ;
@@ -505,4 +505,29 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
505
505
}
506
506
this . sendResponse ( response ) ;
507
507
}
508
+
509
+ protected async setVariableRequest (
510
+ response : DebugProtocol . SetVariableResponse ,
511
+ args : DebugProtocol . SetVariableArguments
512
+ ) : Promise < void > {
513
+ const { value, name, variablesReference } = args ;
514
+ let property = null ;
515
+ if ( this . _contexts . has ( variablesReference ) ) {
516
+ // VS Code is requesting the variables for a SCOPE, so we have to do a context_get
517
+ const context = this . _contexts . get ( variablesReference ) ;
518
+ const properties = await context . getProperties ( ) ;
519
+ property = properties . find ( el => el . name === name ) ;
520
+ } else if ( this . _properties . has ( variablesReference ) ) {
521
+ // VS Code is requesting the subelements for a variable, so we have to do a property_get
522
+ property = this . _properties . get ( variablesReference ) ;
523
+ }
524
+ property . value = value ;
525
+ await this . _connection . sendPropertySetCommand ( property ) ;
526
+
527
+ response . body = {
528
+ value : args . value ,
529
+ variablesReference : args . variablesReference ,
530
+ } ;
531
+ this . sendResponse ( response ) ;
532
+ }
508
533
}
0 commit comments