BetterThanTomorrow / calva

Clojure & ClojureScript Interactive Programming for VS Code
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva
Other
1.68k stars 217 forks source link

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

Open bpringe opened 2 years ago

bpringe commented 2 years ago

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)?

PEZ commented 2 years ago

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.