@@ -136,15 +136,28 @@ class VariablesSerializer(
136
136
typeName,
137
137
value
138
138
).serializedVariablesState
139
- if (typeName != null && typeName == " Entry " ) {
139
+ if (typeName != null ) {
140
140
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
+ }
148
161
}
149
162
}
150
163
@@ -815,6 +828,16 @@ fun getProperString(value: Any?): String {
815
828
}
816
829
}
817
830
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
+
818
841
value ? : return " null"
819
842
820
843
val kClass = value::class
@@ -825,6 +848,9 @@ fun getProperString(value: Any?): String {
825
848
value as Array <* >
826
849
return buildString {
827
850
val size = value.size
851
+ if (isPrintOnlySize(size, this )) {
852
+ return @buildString
853
+ }
828
854
value.forEachIndexed { index, it ->
829
855
print (this , size, index, it)
830
856
}
@@ -842,6 +868,9 @@ fun getProperString(value: Any?): String {
842
868
value as Collection <* >
843
869
return buildString {
844
870
val size = value.size
871
+ if (isPrintOnlySize(size, this )) {
872
+ return @buildString
873
+ }
845
874
value.forEachIndexed { index, it ->
846
875
print (this , size, index, it)
847
876
}
@@ -853,6 +882,9 @@ fun getProperString(value: Any?): String {
853
882
val size = value.size
854
883
var ind = 0
855
884
return buildString {
885
+ if (isPrintOnlySize(size, this )) {
886
+ return @buildString
887
+ }
856
888
value.forEach {
857
889
print (this , size, ind++ , it, true )
858
890
}
0 commit comments