diff --git a/src/nrepl/index.ts b/src/nrepl/index.ts index 43c49c0e2..b665d5382 100644 --- a/src/nrepl/index.ts +++ b/src/nrepl/index.ts @@ -3,14 +3,19 @@ import { BEncoderStream, BDecoderStream } from './bencode'; import * as cider from './cider'; import * as state from './../state'; import * as util from '../utilities'; -import { PrettyPrintingOptions, disabledPrettyPrinter, getServerSidePrinter } from '../printer'; +import { + PrettyPrintingOptions, + disabledPrettyPrinter, + getServerSidePrinter, + prettyPrint, +} from '../printer'; import * as debug from '../debugger/calva-debug'; import * as vscode from 'vscode'; import debugDecorations from '../debugger/decorations'; import * as outputWindow from '../repl-window/repl-doc'; import { formatAsLineComments } from '../results-output/util'; import type { ReplSessionType } from '../config'; -import { getStateValue, prettyPrint } from '../../out/cljs-lib/cljs-lib'; +import { getStateValue } from '../../out/cljs-lib/cljs-lib'; import { getConfig } from '../config'; import { log, Direction } from './logging'; import * as string from '../util/string'; diff --git a/src/printer.ts b/src/printer.ts index eb1b9f7e0..7464e4b3c 100644 --- a/src/printer.ts +++ b/src/printer.ts @@ -129,5 +129,7 @@ export function getServerSidePrinterDependencies() { } export function prettyPrint(value: any, options: any = prettyPrintingOptions()) { - return calvaLib.prettyPrint(value, options); + const optionsClone = JSON.parse(JSON.stringify(options)); + delete optionsClone['printFn']; // Zprint croaks on options it doesn't understand + return calvaLib.prettyPrint(value, optionsClone); } diff --git a/src/results-output/output.ts b/src/results-output/output.ts index 262157691..a6441f312 100644 --- a/src/results-output/output.ts +++ b/src/results-output/output.ts @@ -221,7 +221,6 @@ function appendClojure( } } else if (destination === 'terminal') { const printerOptions = { ...printer.prettyPrintingOptions(), 'color?': true }; - delete printerOptions.printFn; // Zprint croaks on options it doesn't understand const prettyMessage = printer.prettyPrint(message, printerOptions)?.value || message; // TODO: Figure if it's worth a setting to opt-in on an ns info line getOutputPTY().write(`${didLastTerminateLine ? '' : '\n'}${nsInfoLine(destination, options)}`);