metosin / malli

High-performance data-driven data specification library for Clojure/Script.
Eclipse Public License 2.0
1.44k stars 204 forks source link

Default pretty printer not compatible with cider (and more?) #977

Open samhedin opened 6 months ago

samhedin commented 6 months ago

After running (dev/start! {:report (thrower)}) from function schemas I saw this in my emacs *cider-error* buffer: output From my understanding, this is because it's using extended ANSI codes. I'm really... not familiar with ANSI codes so I could definitely be wrong here.

I tried to give dev/start! a different -printer with other options for the :colors key, but that didn't help.

Is it because of the hardcoded 5 here?

If so, could it be made an option to only use standard/restricted/whateveryoucallthem ANSI codes?

dzhus commented 4 months ago

A workaround for this that simply disables ANSI colour codes is something like

(md/start!
 {:report
  (let [thrower (mdp/thrower)]
    (fn [type data]
      (with-redefs
       [mdv/-color
        (fn [_color body _printer] [:span body])]
        (thrower type data))))})