| 1073 | } |
| 1074 | |
| 1075 | private async callToString(isolate: VMIsolateRef, instanceRef: VMInstanceRef, getFullString = false, suppressQuotesAroundStrings = false): Promise<string | undefined> { |
| 1076 | if (!this.vmService) |
| 1077 | return; |
| 1078 | |
| 1079 | try { |
| 1080 | const result = this.vmServiceCapabilities.hasInvoke |
| 1081 | ? await this.vmService.invoke(isolate.id, instanceRef.id, "toString", [], true) |
| 1082 | : await this.vmService.evaluate(isolate.id, instanceRef.id, "toString()", true); |
| 1083 | if (result.result.type === "@Error") { |
| 1084 | return undefined; |
| 1085 | } else { |
| 1086 | let evalResult: VMInstanceRef = result.result as VMInstanceRef; |
| 1087 | |
| 1088 | if (evalResult.valueAsStringIsTruncated && getFullString) { |
| 1089 | const result = await this.vmService.getObject(isolate.id, evalResult.id); |
| 1090 | evalResult = result.result as VMInstanceRef; |
| 1091 | } |
| 1092 | |
| 1093 | return this.valueAsString(evalResult, undefined, suppressQuotesAroundStrings); |
| 1094 | } |
| 1095 | } catch (e) { |
| 1096 | this.logger.error(e); |
| 1097 | return undefined; |
| 1098 | } |
| 1099 | } |
| 1100 | |
| 1101 | protected setVariableRequest(response: DebugProtocol.SetVariableResponse, args: DebugProtocol.SetVariableArguments): void { |
| 1102 | this.errorResponse(response, "not supported"); |