@@ -666,6 +666,33 @@ export class PropertyGetNameResponse extends Response {
666666 }
667667}
668668
669+ /** The response to a property_value command */
670+ export class PropertyValueResponse extends Response {
671+ /** the size of the value */
672+ size : number
673+ /** the data type of the variable. Can be string, int, float, bool, array, object, uninitialized, null or resource */
674+ type : string
675+ /** the value of the property for primitive types */
676+ value : string
677+ constructor ( document : XMLDocument , connection : Connection ) {
678+ super ( document , connection )
679+ if ( document . documentElement . hasAttribute ( 'size' ) ) {
680+ this . size = parseInt ( document . documentElement . getAttribute ( 'size' ) ?? '0' )
681+ }
682+ this . type = document . documentElement . getAttribute ( 'type' ) ?? ''
683+ if ( document . documentElement . getElementsByTagName ( 'value' ) . length > 0 ) {
684+ this . value = decodeTag ( document . documentElement , 'value' )
685+ } else {
686+ const encoding = document . documentElement . getAttribute ( 'encoding' )
687+ if ( encoding ) {
688+ this . value = iconv . encode ( document . documentElement . textContent ! , encoding ) . toString ( )
689+ } else {
690+ this . value = document . documentElement . textContent !
691+ }
692+ }
693+ }
694+ }
695+
669696/** class for properties returned from eval commands. These don't have a full name or an ID, but have all children already inlined. */
670697export class EvalResultProperty extends BaseProperty {
671698 children : EvalResultProperty [ ]
@@ -1091,6 +1118,18 @@ export class Connection extends DbgpConnection {
10911118 )
10921119 }
10931120
1121+ /** Sends a property_value by name command */
1122+ public async sendPropertyValueNameCommand ( name : string , context : Context ) : Promise < PropertyValueResponse > {
1123+ const escapedFullName = '"' + name . replace ( / ( " | \\ ) / g, '\\$1' ) + '"'
1124+ return new PropertyValueResponse (
1125+ await this . _enqueueCommand (
1126+ 'property_value' ,
1127+ `-d ${ context . stackFrame . level } -c ${ context . id } -n ${ escapedFullName } `
1128+ ) ,
1129+ context . stackFrame . connection
1130+ )
1131+ }
1132+
10941133 /** Sends a property_set command */
10951134 public async sendPropertySetCommand ( property : Property , value : string ) : Promise < Response > {
10961135 return new Response (
0 commit comments