A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nedap/formatting-stack/wiki/Indentation-examples below:

Indentation examples · nedap/formatting-stack Wiki · GitHub

For most macros/functions, adding :style/indent n as usual will suffice. formatting-stack will understand it (translating it for cljfmt, provided the spec is simply a number, or the special value :defn), and any spec-compliant editor will understand it too.

(defmacro render
  {:style/indent 1} ;; CIDER will use `1`, cljfmt will receive the translated value of [[:block 1]]
  [options & body]
  ...)

By default, :block indentation is assumed for cljfmt (see its README or these examples for a primer on :format / :inner). You can use :inner via :style.cljfmt/type:

(defmacro render
  {:style/indent 1 ;; CIDER will use `1`
   :style.cljfmt/type :inner} ;; cljfmt will receive the translated value of [[:inner 1]]
  [options & body]
  ...)

As said, formatting-stack can only translate (from CIDER format to cljfmt format):

If you need anything more complex, use :style.cljfmt/indent. The values will be passed verbatim to cljfmt.

(defmacro render
  {:style/indent 1 ;; CIDER will use `1`
   :style.cljfmt/indent [[:block 2] [:inner 1]]} ;; cljfmt will use `[[:block 2] [:inner 1]]`
  [...]
  ...)

If you want to avoid the situation where you have to author complex indentation specs in two formats, I'd recommend:

As mentioned, you should favor metadata over config. Anyway, the config format is simply a map of symbols to specs:

'{fulcro-spec.core/assertions {:style/indent 0
                               :style.cljfmt/type :inner}}

The specs have the same semantics described in the previous section.

This config is passed to formatting-stack.core/format!, either via Component/Integrant or by direct invocation.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4