Fix double quotes in console.log messages

This commit is contained in:
Ashcon Partovi
2023-08-25 11:53:21 -07:00
parent 0731dfa0a4
commit 2c68e26d8d
2 changed files with 5 additions and 5 deletions

View File

@@ -965,8 +965,7 @@ export class DebugAdapter implements IDebugAdapter, InspectorListener {
const variables = parameters.map((parameter, i) => {
const variable = this.#addVariable(parameter, { name: `${i}` });
const { value } = variable;
output += value + " ";
output += remoteObjectToString(parameter, true) + " ";
return variable;
});
@@ -1704,8 +1703,6 @@ function consoleLevelToAnsiColor(level: JSC.Console.ConsoleMessage["level"]): st
return "\u001b[33m";
case "error":
return "\u001b[31m";
case "debug":
return "\u001b[36m";
}
return undefined;
}

View File

@@ -1,6 +1,6 @@
import type { JSC } from "../protocol";
export function remoteObjectToString(remoteObject: JSC.Runtime.RemoteObject): string {
export function remoteObjectToString(remoteObject: JSC.Runtime.RemoteObject, topLevel?: boolean): string {
const { type, subtype, value, description, className, preview } = remoteObject;
switch (type) {
case "undefined":
@@ -9,6 +9,9 @@ export function remoteObjectToString(remoteObject: JSC.Runtime.RemoteObject): st
case "number":
return description ?? JSON.stringify(value);
case "string":
if (topLevel) {
return String(value ?? description);
}
return JSON.stringify(value ?? description);
case "symbol":
case "bigint":