kkinnear/zprint

Problem with comment ;; and key-value-options both present

arichiardi opened this issue ยท 3 comments

Hey Kim,
I really struggled to find a good title for this one ๐Ÿ˜„

I have a bb.edn that I want to format:

;;!zprint {:map {:sort? true :key-value-options {:tasks {:map {:sort? true :justify? true}}} :key-order [:min-bb-version :paths :deps :tasks] :respect-bl? false}}
{:min-bb-version "0.10.0"
 :paths ["src/bb"]
 :deps {local/deps {:local/root "."}}
 :tasks {
         ;; Check
         fmt-check
         {:doc     "Check code for formatting errors"
          :task (shell "make" "-C" ".." "clj-format-check")}
         fmt-fix
         {:doc     "Fix code formatting errors"
          :task (shell "make" "-C" ".." "clj-format-fix")}
         }
 :pods {org.babashka/postgresql {:version "0.1.1"}}}

Zprint spits out

Failed to format file: /home/cokap/git/cohesic/acuity/scripting/bb.edn because java.lang.Exception: Unable to parse the string ';; Check' because of 'clojure.lang.ExceptionInfo: unsupported operation {}'.  Consider adding any unallowed elements to {:parse {:ignore-if-parse-fails #{ <string> }}}

If I remove :key-value-options (or the comments) it seems to succeed.

Thank you so much for reporting this! You did just about all of the debugging for me as well!! I have found and fixed the problem, and it will be in the next release 1.2.5. There were related bugs with two other advanced map options, so you actually caused three bugs to be fixed. Unfortunately there isn't any workaround. Removing the comment is about the only thing you can do at this point, I'm sorry to say. Thanks again for taking the time to report this so clearly!

My pleasure!

This is fixed in 1.2.5.