bpsm / edn-java

a reader for extensible data notation
Eclipse Public License 1.0
100 stars 24 forks source link

Fixes a problem with softspaces around maps/sequences/strings #37

Closed talios closed 10 years ago

talios commented 10 years ago

When writing out some Java structures to EDN I found that not everything was correctly adding in softspaces, such that the following output was being generated:

{:operation :search :options{:timeout-ms 2000 :max-index-scans 2}:scopes[:cust-ref "xxx"]}

Whilst this parses, it doesn't look very nice when trying to diagnose other problems.

bpsm commented 10 years ago

The default (and currently only) formatting is designed to be as compact as possible while still being possible to parse, but it sure isn't pretty.

I'm considering your patch.

Would it help you if I finished up my work on a simple pretty-printer for edn-java (see https://github.com/bpsm/edn-java/commits/feature/pp)? It would produce output like this:

{
    key1 value
    key2 [
        value
        value
    ]
}
bpsm commented 10 years ago

I've incorporated your suggested formatting experimentally as LooseFormatter. https://github.com/bpsm/edn-java/commit/a9e1f48c613bd6d9f3856df7528eaa8ce91824e3

I've also added the option to pretty-print edn output. https://github.com/bpsm/edn-java/commit/428da6508b2601669ad12a7afaa90580824c7362

These changes will both be included in the next release. (0.4.4).

talios commented 10 years ago

+1 cheers - sorry I didn't get back to you earlier about this. Look forward to the release.