greglook / cljstyle

A tool for formatting Clojure code
Eclipse Public License 1.0
293 stars 39 forks source link

Keep ns :require (and others) linebreaks #35

Closed Deraen closed 3 years ago

Deraen commented 4 years ago

I like to keep the first require at the same line with :require form:

(ns example.foo
  (:require [reagent.core :as r]
            [re-frame.core :as rf]))

Currently cljstyle adds linebreak after :require. I'd like to use the ns formatting, but keeping existing linebreaks.

greglook commented 3 years ago

The way cljstyle formats namespaces is to structurally parse and fully rewrite them, so it's not currently possible for it to "preserve" all line breaks. It seems like what you want may just be to start the libspecs on the same line as the :require keyword - if that's sufficient, I can add a formatting option for that.