comamitc / pretty-print.net

http://pretty-print.net
MIT License
15 stars 4 forks source link

weird formatting behavior #19

Closed comamitc closed 8 years ago

comamitc commented 9 years ago
{:users [{:name "Dan", :age 23}
                  {:name "Sam", :gender :female}]
          :aliases {"Dan" ["Dante" "Daniel"]
                    "Sam" ["Samantha", "Samoth"]}}

Gets output as

{:users [{:name "Dan", :age 23} {:name "Sam", :gender :female}],
 :aliases {"Dan" ["Dante" "Daniel"], "Sam" ["Samantha" "Samoth"]}}
comamitc commented 9 years ago

This can be fixed by setting "right-margin". This screams that we need "settings" in the UI of pretty-print.net.

By setting it to 40 I got this:

{:users
 [{:name "Dan", :age 23}
  {:name "Sam", :gender :female}],
 :aliases
 {"Dan" ["Dante" "Daniel"],
  "Sam" ["Samantha" "Samoth"]}}
comamitc commented 9 years ago

Open #20 to track enhancement progress.

boxed commented 9 years ago

That later one isn't significantly better. The problem seems to me to be that it doesn't have a concept of map literal elements being alternating keys and values and handling that differently than just if it was a list of stuff.

comamitc commented 9 years ago

I agree with your assessment. While adding the formatter's settings into the UI of pretty-print might help this a little (arguably so) the underlying problem seems to be with the clojure.pprint library in how it deals with these objects. I will open an issue there for this and see if we can get some traction.

comamitc commented 8 years ago

This should be solved in #34

comamitc commented 8 years ago

34 now produces this output for the example input:

{:users [{:name "Dan", :age 23}
         {:name "Sam", :gender :female}]
 :aliases {"Dan" ["Dante" "Daniel"]
           "Sam" ["Samantha", "Samoth"]}}

Based on cljfmt.

comamitc commented 8 years ago

Closing this based on #34 & #44.