MCPcopy Index your code
hub / github.com/microsoft/vscode-js-debug / formatDefaultString

Function formatDefaultString

src/adapter/console/textualMessage.ts:83–100  ·  view source on GitHub ↗

* Default message string formatter. Tries to create a simple string, and * but if it can't it'll return a variable reference. * * Intentionally not async-await as it's a hot path in console logging.

(
    thread: Thread,
    args: ReadonlyArray<Cdp.Runtime.RemoteObject>,
    includeStackInVariables = false,
  )

Source from the content-addressed store, hash-verified

81 * Intentionally not async-await as it's a hot path in console logging.
82 */
83 protected formatDefaultString(
84 thread: Thread,
85 args: ReadonlyArray<Cdp.Runtime.RemoteObject>,
86 includeStackInVariables = false,
87 ) {
88 const useMessageFormat = args.length > 1 && args[0].type === 'string';
89 const formatResult = useMessageFormat
90 ? formatMessage(args[0].value, args.slice(1) as AnyObject[], messageFormatters)
91 : formatMessage('', args as AnyObject[], messageFormatters);
92
93 const output = formatResult.result + '\n';
94
95 if (formatResult.usedAllSubs && !args.some(previewAsObject)) {
96 return { output };
97 } else {
98 return this.formatComplexStringOutput(thread, output, args, includeStackInVariables);
99 }
100 }
101
102 private async formatComplexStringOutput(
103 thread: Thread,

Callers

nothing calls this directly

Calls 1

formatMessageFunction · 0.90

Tested by

no test coverage detected