cljfmt icon indicating copy to clipboard operation
cljfmt copied to clipboard

README lacks info about `:default`

Open PEZ opened this issue 9 months ago • 1 comments

I don't understand how :default is supposed to work. Tried this, inspired by the tests:

{:remove-surrounding-whitespace? true
 :remove-trailing-whitespace? true
 :remove-consecutive-blank-lines? true
 :insert-missing-whitespace? true
 :extra-indents  {#re "fooa?$" [[:inner 0]]
                  #re "bar" [[:block 0]]
                  #re "^baz" [[:inner 0]]
                  'with-special [[:default]]}

 :test {:fooa (fooa 1
                2
                {:a    a
                 :aa a
                 :bbb bbb})
        :foo (foo 1
               2
               3)
        :foobb (foob 1
                     2
                     3)
        :baz (bazzo 1
               :x)
        :with (with-something 1
                :x)
        :with-special (with-special 1
                        :x)
        :let (let []
               hello)
        :-> (-> foo/bar
                1
                2)}
 :test-2 (defn f [x]
           x)}
~/Projects/calva/test-data  2743-cljfmt-0-13-0[$✘!?] 
❯ cljfmt --version        
cljfmt 0.13.0

~/Projects/calva/test-data  2743-cljfmt-0-13-0[$✘!?] 
❯ cljfmt check .cljfmt.edn
All source files formatted correctly

I was expecting the with-special call to be indented like:

(with-special 1
              :x)

PEZ avatar Mar 09 '25 10:03 PEZ

OK. So I found my error. Using a quoted symbol in a .edn config. But I still think that README (or probably INDENT.md) should mention this :default more explicitly as the override mechanism that it provides.

PEZ avatar Mar 09 '25 11:03 PEZ

I'm not sure what I can add to the current documentation to make it clearer. Could you explain a little further about what specifically you found confusing?

weavejester avatar Oct 21 '25 16:10 weavejester

It's been a while so I am not sure what I meant by this. Reading the docs today I think they are very clear. 😄

PEZ avatar Oct 21 '25 19:10 PEZ

Sorry it took so long to get back to you. I've been going through old cljfmt issues and trying to catch up. Perhaps you just missed the section, or it was updated after you posted the original request.

In any case, looks like this issue can be closed.

weavejester avatar Oct 21 '25 20:10 weavejester