cespare / goclj

Clojure parsing in Go
MIT License
37 stars 6 forks source link

Handle the :let modifier for doseq and for #73

Closed tao-liu-liftoff closed 3 years ago

tao-liu-liftoff commented 4 years ago

When using the :let modifier for macros such as for and doseq, cljfmt does not format indentation correctly.

Example:

(for [x (range 10)
      :let [y
            (+ x 1)
            z
            (+ x 2)]]
  (println x y z))

(doseq [x (range 10)
        :let [y
              (+ x 1)
              z
              (+ x 2)]]
  (println x y z))

Expected:

(for [x (range 10)
      :let [y
              (+ x 1)
            z
              (+ x 2)]]
  (println x y z))
cespare commented 4 years ago

This is similar to #69.

mrkam2 commented 3 years ago

Had the same issue. How can I help with the fix? I added a branch with the failing testcase: https://github.com/cespare/goclj/compare/master...liftoffio:alexk.doseq-let?expand=1

cespare commented 3 years ago

How can I help with the fix?

You can write it and send a PR.

mrkam2 commented 3 years ago

Makes sense. I'm not familiar with this project yet. Could you please share your initial thoughts on how this feature could be implemented assuming the shape of the existing codebase?

mrkam2 commented 3 years ago

Added a PR https://github.com/cespare/goclj/pull/78. Can't assign you as a reviewer for some reason. @cespare