Skip to content

Commit

Permalink
Merge pull request #2631 from BetterThanTomorrow/2621-pretty-printfn-…
Browse files Browse the repository at this point in the history
…terminal-output

Delete `printFn` from options sent to zprint
  • Loading branch information
PEZ authored Sep 22, 2024
2 parents 423dfc7 + 9404193 commit eb46f35
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changes to Calva.
## [Unreleased]

- [Synchronize the file extensions for Calva and Calva Spritz](https://github.com/BetterThanTomorrow/calva/issues/2629)
- [Terminal output pretty printing fails when using `printerFn` pretty print option](https://github.com/BetterThanTomorrow/calva/issues/2630)

## [2.0.473] - 2024-09-21

Expand Down
9 changes: 7 additions & 2 deletions src/nrepl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 3 additions & 1 deletion src/printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit eb46f35

Please sign in to comment.