calva icon indicating copy to clipboard operation
calva copied to clipboard

The pprint pretty printing engine does not work when JS objects are in the result

Open bpringe opened this issue 3 years ago • 1 comments

With the following pprint settings:

  "calva.prettyPrintingOptions": {
    "printEngine": "pprint",
    "enabled": true,
    "width": 120,
    "maxLength": 50
  }

And the following function defined in .cljs file:

(defn promises [n]
  (repeat n (js/Promise. (fn []))))

And while using jack-in to start a shadow-cljs repl...

Evaluating (promises 10) results in a result that is not pretty printed, but evaluating (cljs.pprint/pprint (promises 10)) results in a pretty printed result.

@PEZ Maybe we can use cljs.pprint/pprint when the repl type is cljs instead of clojure.core/pprint (if that is even what's being used in this case - I haven't looked yet)?

bpringe avatar Jul 04 '22 01:07 bpringe

Not sure cljs.pprint is available as a function that can be used. If this happens in the nrepl server, which is running in Clojure. But we can try, of course.

PEZ avatar Jul 04 '22 14:07 PEZ