@@ -136,15 +136,28 @@ class VariablesSerializer(
136136 typeName,
137137 value
138138 ).serializedVariablesState
139- if (typeName != null && typeName == " Entry " ) {
139+ if (typeName != null ) {
140140 val descriptor = this [name]
141- value as Map .Entry <* , * >
142- val valueType = if (value.value != null ) value.value!! ::class .simpleName else " null"
143- descriptor!! .fieldDescriptor[value.key.toString()] = createSerializeVariableState(
144- value.key.toString(),
145- valueType,
146- value.value
147- ).serializedVariablesState
141+ if (typeName == " Entry" ) {
142+ value as Map .Entry <* , * >
143+ val valueType = if (value.value != null ) value.value!! ::class .simpleName else " null"
144+ val strName = getProperString(value.key)
145+ descriptor!! .fieldDescriptor[strName] = createSerializeVariableState(
146+ strName,
147+ valueType,
148+ value.value
149+ ).serializedVariablesState
150+ } else if (typeName == " SingletonList" ) {
151+ value as List <* >
152+ val toStore = value.firstOrNull()
153+ val valueType = if (toStore != null ) toStore::class .simpleName else " null"
154+ val strName = getProperString(toStore)
155+ descriptor!! .fieldDescriptor[strName] = createSerializeVariableState(
156+ strName,
157+ valueType,
158+ toStore
159+ ).serializedVariablesState
160+ }
148161 }
149162 }
150163
@@ -815,6 +828,16 @@ fun getProperString(value: Any?): String {
815828 }
816829 }
817830
831+ // todo: this might better be on the plugin side
832+ fun isPrintOnlySize (size : Int , builder : StringBuilder ): Boolean {
833+ return if (size >= 15 ) {
834+ builder.append(" size: $size " )
835+ true
836+ } else {
837+ false
838+ }
839+ }
840+
818841 value ? : return " null"
819842
820843 val kClass = value::class
@@ -825,6 +848,9 @@ fun getProperString(value: Any?): String {
825848 value as Array <* >
826849 return buildString {
827850 val size = value.size
851+ if (isPrintOnlySize(size, this )) {
852+ return @buildString
853+ }
828854 value.forEachIndexed { index, it ->
829855 print (this , size, index, it)
830856 }
@@ -842,6 +868,9 @@ fun getProperString(value: Any?): String {
842868 value as Collection <* >
843869 return buildString {
844870 val size = value.size
871+ if (isPrintOnlySize(size, this )) {
872+ return @buildString
873+ }
845874 value.forEachIndexed { index, it ->
846875 print (this , size, index, it)
847876 }
@@ -853,6 +882,9 @@ fun getProperString(value: Any?): String {
853882 val size = value.size
854883 var ind = 0
855884 return buildString {
885+ if (isPrintOnlySize(size, this )) {
886+ return @buildString
887+ }
856888 value.forEach {
857889 print (this , size, ind++ , it, true )
858890 }
0 commit comments