Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstring/comment after defn name changes indentation of the body #241

Open
holyjak opened this issue Sep 6, 2021 · 1 comment
Open

Comments

@holyjak
Copy link

holyjak commented Sep 6, 2021

Hello! I have a mystery. With :indents ^:replace {#"^\w" [[:inner 0]]} this is aligned as I want:

      (defn X
        ([args] 
         (doit)))

but if I put any line (normally I would have there a docstring) after the X, it changes and the body of the fn is indented by 1 space too many:

      (defn X
        ;; comment
        ([args]
          (doit)))
@or
Copy link
Contributor

or commented May 10, 2022

I haven't tried it with the Leiningen plugin, but I can't reproduce it with tests:

    (is (reformats-to?
         ["(defn X"
          "([args]"
          "(doit)))"]
         ["(defn X"
          "  ([args]"
          "   (doit)))"]
         {:indents {#"^\w" [[:inner 0]]}}))
    (is (reformats-to?
         ["(defn X"
          "  ;; comment"
          "([args]"
          "(doit)))"]
         ["(defn X"
          "  ;; comment"
          "  ([args]"
          "   (doit)))"]
         {:indents {#"^\w" [[:inner 0]]}}))

Both of those pass. Strange.

@holyjak: is this still an issue for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants