Skip to content

Releases: kkinnear/zprint

zprint-filter-1.2.9

12 Mar 20:35
Compare
Choose a tag to compare

A good number of significant changes for this release. In many cases, a more complete explanation appears in the CHANGELOG.

  • If you would like to have the namespaces sorted in a (:require ...) in an ns macro, you can use the style :sort-require. You can also select (using regular expressions) namespaces to put first (or last, or both). Search for :sort-require in the reference manual for details. This will also, by default, sort the identifiers in the :refer vector, though you can disable that sorting.

  • If you configure :comment {:min-space-after-semi 1} then a comment like this: ;this is a comment will be changed after formatting into a comment like this: ; this is a comment. The default for :min-space-after-semi is 0, so by default no changes are made. Issue #306.

  • New option map to transform random Java classes into other, more manageable data types: :modify-sexpr-by-type. Issue #307.

  • The style :ns-justify was difficult to change in situations where it wouldn't justify something because the maximum variance was exceeded. It has been restructured using the new style-map approach to allow it to be easily parameterized. If you invoke :ns-justify by using its keyword name, the maximum variance for justification will be 20 for :require and :require-macros and will be 1000 for :import. You can change any or all of these by using a map to invoke the :ns-justify style. See the CHANGELOG for details.

  • zprint will now recognize when a set of pairs is being spliced in using reader-conditionals, and format them as a set of pairs. See the CHANGELOG for more details.

  • Extended the meaning of :one-line-ok? for {:style :rod-config} so that if a particular arity would format successfully onto one line, it will now do so if :one-line-ok? is true. Issue #282.

  • There was a bug where if you specified multiple styles in a vector, if there were any errors detected when applying the styles, the errors were lost unless they occurred in the rightmost (that is, final) style. If you have any configurations that suddenly start showing errors after updating to 1.2.9, see the CHANGELOG for details.

  • The style :minimal-smart-wrap added in 1.2.5 had a problem where it wouldn't properly deal with single lines ending in a period. It also didn't recognize lines ending in a period if it wasn't preceded by two lower-case characters. Both of these problems are now fixed. Issue #297.

zprint-filter-1.2.8

14 Sep 17:20
Compare
Choose a tag to compare

Major changes:

  • New pre-compiled binary for macOS running on Apple Silicon. Install zprintma-1.2.8 from this release to get it. Runs up to 3x the speed of the Intel binary on Apple Silicon! Discussion #302.
  • Now babashka compatible! You can run zprint as a babashka task, install it with bbin, and use the library inside of babashka. See the QuickStart for a link for how to do all of this.
  • See the CHANGELOG.md for additional details.

zprint-filter-1.2.7

07 Jun 19:31
Compare
Choose a tag to compare

Made some small fixes to "smart wrap", and fixed an unfortunate bug in wrapping "top level" comments. It is supposed to wrap the top level comments only when they exceed the :width, but it wrapped them instead when they were was 5 characters short of the :width. The new "smart wrap" has a 5 character border which is used for wrapping internal comments, but that border ended up also being used for top level comments. I would recommend using 1.2.7 over 1.2.6, though the number of comments unnecessarily wrapped with 1.2.6 depends entirely on how wide your top level comments are.

zprint-filter-1.2.6

27 May 16:57
Compare
Choose a tag to compare

A significant release, fixing several reported problems and adding some requested features. The biggest change is the change to comment wrapping -- the creation of "smart" comment wrapping. This is now the default (as comment wrapping has always been the default). It will fix most of the problems created by the previous "not very smart" comment wrapping, while creating fewer problems in the future with respect to comment wrapping. See the CHANGELOG for specific details.

Other changes:

  • You can now specify some keys to come last in a map as well as some keys to appear first in a sorted map. See the CHANGELOG for details.
  • Added function type :list, for when you want a list interpreted as just a list of data, without assuming that the first element of the list is a function of some type.
  • You can pass a string value of an options map to set-options!, and it will read and 'compile' that options map (including any functions) using the Small Clojure Interpreter (sci) built into zprint, the same way that zprint handles reading external configuration files.
  • Configurable Styles: See CHANGELOG for details.
  • The handling of tagged literals (for example, #js) has been enhanced.
  • Upgraded to [org.babashka/sci "0.7.39"] and [rewrite-clj/rewrite-clj "1.1.47"].
  • The style :hiccup was sometimes recognizing destructuring in argument vectors as a hiccup vector.
  • Found and fixed several areas of justification that were slower than they needed to be.

zprint-filter-1.2.5

24 Jan 19:05
Compare
Choose a tag to compare

Lots of minor to moderate changes and fixes in this release.

NOTE: This is the first release where zprintl (the linux pre-built binary) has been taken from the GitHub CI build and test process, instead of built on my aging 2012 Intel MacBook Air. Please let me know if you have any issues using zprintl. Thanks!

  • Added a bunch of changes to justification, which are not on by default. In pairs, if you have a collection as the left-hand-side of a pair, and you would like the right-hand-side of the pair to format on the last line of a multi-line left-hand-side, include :style :multi-lhs-hang. See the CHANGELOG.md for more details.
  • You can now get regular expression matching for function names -> function types. More info in the CHANGELOG too.
  • Formatted files would sometimes change if they were immediately formatted again. Particularly when using :respect-nl. This is now mostly fixed. There are still some issues when comments wrap, which I will be working on, but formatting now appears largely stable. This has led to some changes in the formatting heuristics, which were rather "discontinuous", and didn't blend gracefully together. So the formatting has changed as I have wrestled with the heuristics (by turning some off, and changing the tuning for others to compensate). The changes aren't terrible, but if you prefer the old way, use :style :original-tuning. You will lose the stability, but if it didn't bother you before then I expect it won't bother you now.
  • Lots of fixes for bugs, for example empty vectors were dropped when using :format :off. See the CHANGELOG for details of all of the fixes.

zprint-filter-1.2.5-alpha1

26 Sep 17:42
Compare
Choose a tag to compare
Pre-release

This alpha release is for testing a fix for issue #263. Please do not use it for anything else, and do not put it into production.

zprint-filter-1.2.4

02 Aug 16:37
Compare
Choose a tag to compare

A release with considerable content:

  • Now supports :hiccup and :html output, both in library and prebuilt binaries. #214
  • You can alias one function to the format of another in the :fn-map. #234
  • Support for "consistent cond formatting". :flow-all-if-any? #235
  • Internal {:list {:nl-count <n>}} for newlines #236
  • Supports :max-gap for justification #239
  • Fixed: Namespaced maps don't work with :indent-only #242
  • Fixed: Inconsistent indentation in anon fns with :indent-only #243
  • Fixes: {:meta {:split? true}} doesn't handle multiple ^:stuff #245
  • Fixed: Use newer rewrite-clj and change edn*. #247

See CHANGELOG.md for more details on how to use some of these new things. Of course, they are in the documentation as well.

zprint-filter-1.2.3

12 Apr 21:35
Compare
Choose a tag to compare

A fair number of fixes and changes in this release. See the CHANGELOG.md for details, but notable new things are:

  • New :range configuration options: :use-previous-!zprint? and :continue-after-!zprint-error?. These allow someone doing :range formatting on a file (string) which has ;!zprint formatting directives to have the lines in the range formatted the same when doing just the range or the whole file. :use-previous-!zprint? if true will scan all previous ;!zprint directives prior to formatting the range. :continue-after-!zprint-error? if true will ignore errors in any ;!zprint directives, and output any errors in the map returned by :output {:range? true}.

  • An alternative way to format metadata was created. It is :style :meta-alt. It is presently experiemental. Issue #224.

  • letfn didn't indent its fns like fns. Now it does. And if they are multi-arity, the various arities don't hang, but rather flow. Issue #221.

  • The styles :community and :rod didn't compose, because :guided was not considered a "body" function type. Now they do. Issue #223.

  • zprint-file-str was not thread-safe, for a variety of reasons. Now it is, and configuration is thread-safe as well. Issue #226.

  • Figured out some Figwheel issues. If you use zprint with Figwheel, check out the CHANGELOG.md, or see issue #231.

zprint-filter-1.2.2

11 Feb 23:10
Compare
Choose a tag to compare

Two (relatively small) issues fixed here:

  • Complex :style declarations with a vector of styles didn't work well when some of those styles also had :style keys with vector values. Issue #217.
  • Added "defn-" to :style :rod since it already processed "defn".

The first issue, with :style, is important to upcoming enhancements to the VSCode zprint extension, vscode-clj-zprint.

zprint-filter-1.2.1

25 Jan 22:30
Compare
Choose a tag to compare

Relatively small release. Significant items:

  • Fixed incompatibility with Clojure 1.11.0-alpha4, where it aded a new clojure.core function abs.
  • Added new {:output {:range? true}} capability to recover expanded range and just the formatted string for the range when providing an input range. Designed to aid in editor or IDE integration.
  • Fixed formatting for the are function.
  • Enhanced style :rod to optionally add blank lines between arities of multi-airity functions.