Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete printFn from options sent to zprint #2631

Merged
merged 2 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}