@@ -525,6 +525,8 @@ export abstract class BaseProperty {
525525 hasChildren : boolean
526526 /** the number of children this property has, if any. Useful for showing array length. */
527527 numberOfChildren : number
528+ /** the size of the value */
529+ size : number
528530 /** the value of the property for primitive types */
529531 value : string
530532 /** children that were already included in the response */
@@ -550,6 +552,9 @@ export abstract class BaseProperty {
550552 if ( propertyNode . hasAttribute ( 'facet' ) ) {
551553 this . facets = propertyNode . getAttribute ( 'facet' ) ! . split ( ' ' )
552554 }
555+ if ( propertyNode . hasAttribute ( 'size' ) ) {
556+ this . size = parseInt ( propertyNode . getAttribute ( 'size' ) ?? '0' )
557+ }
553558 this . hasChildren = ! ! parseInt ( propertyNode . getAttribute ( 'children' ) ! )
554559 if ( this . hasChildren ) {
555560 this . numberOfChildren = parseInt ( propertyNode . getAttribute ( 'numchildren' ) ! )
@@ -684,6 +689,33 @@ export class PropertyGetNameResponse extends Response {
684689 }
685690}
686691
692+ /** The response to a property_value command */
693+ export class PropertyValueResponse extends Response {
694+ /** the size of the value */
695+ size : number
696+ /** the data type of the variable. Can be string, int, float, bool, array, object, uninitialized, null or resource */
697+ type : string
698+ /** the value of the property for primitive types */
699+ value : string
700+ constructor ( document : XMLDocument , connection : Connection ) {
701+ super ( document , connection )
702+ if ( document . documentElement . hasAttribute ( 'size' ) ) {
703+ this . size = parseInt ( document . documentElement . getAttribute ( 'size' ) ?? '0' )
704+ }
705+ this . type = document . documentElement . getAttribute ( 'type' ) ?? ''
706+ if ( document . documentElement . getElementsByTagName ( 'value' ) . length > 0 ) {
707+ this . value = decodeTag ( document . documentElement , 'value' )
708+ } else {
709+ const encoding = document . documentElement . getAttribute ( 'encoding' )
710+ if ( encoding ) {
711+ this . value = iconv . encode ( document . documentElement . textContent ! , encoding ) . toString ( )
712+ } else {
713+ this . value = document . documentElement . textContent !
714+ }
715+ }
716+ }
717+ }
718+
687719/** class for properties returned from eval commands. These don't have a full name or an ID, but have all children already inlined. */
688720export class EvalResultProperty extends BaseProperty {
689721 children : EvalResultProperty [ ]
@@ -1119,6 +1151,18 @@ export class Connection extends DbgpConnection {
11191151 )
11201152 }
11211153
1154+ /** Sends a property_value by name command and request full data */
1155+ public async sendPropertyValueNameCommand ( name : string , context : Context ) : Promise < PropertyValueResponse > {
1156+ const escapedFullName = '"' + name . replace ( / ( " | \\ ) / g, '\\$1' ) + '"'
1157+ return new PropertyValueResponse (
1158+ await this . _enqueueCommand (
1159+ 'property_value' ,
1160+ `-m 0 -d ${ context . stackFrame . level } -c ${ context . id } -n ${ escapedFullName } `
1161+ ) ,
1162+ context . stackFrame . connection
1163+ )
1164+ }
1165+
11221166 /** Sends a property_set command */
11231167 public async sendPropertySetCommand ( property : Property , value : string ) : Promise < Response > {
11241168 return new Response (
0 commit comments