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

:IcedCleanNs doesn't add a newline after :require #453

Closed
noahmoss opened this issue Dec 26, 2022 · 5 comments
Closed

:IcedCleanNs doesn't add a newline after :require #453

noahmoss opened this issue Dec 26, 2022 · 5 comments

Comments

@noahmoss
Copy link

Hey @liquidz! I've noticed that :IcedCleanNs won't add a newline after the :require form if the namespace is otherwise correct. However, it will if there's anything that needs to be cleaned. Is this the intended behavior? If so is there any other command that can be used to add the newline to the ns form?

For example, in this namespace:

(ns test
  (:require [clojure.string :as str]))

(str/replace "foo" "o" "a")

running :IcedCleanNs will not make any changes. However, in this ns:

(ns test
  (:require [clojure.string :as str]
            [clojure.java.io :as io]))

(str/replace "foo" "o" "a")

running :IcedCleanNs will result in

(ns test
  (:require
   [clojure.string :as str]))

(str/replace "foo" "o" "a")
@liquidz
Copy link
Owner

liquidz commented Dec 26, 2022

@noahmoss Thanks for your reporting!

The behavior inserting new line after :require is due to the following option.
(This option is a refactor-nrepl's option)
https://liquidz.github.io/vim-iced/vim-iced.html#g%3Aiced%23refactor%23insert_newline_after_require

And when refactor-nrepl responses that there are no changes, vim-iced does not update ns form, so the newline is not added.

If so is there any other command that can be used to add the newline to the ns form?

No commands for now, but the behavior is not unified, so I'll find some solution.

@noahmoss
Copy link
Author

@liquidz That makes sense. In my case I am trying to update a large number of existing namespaces to use the formatting with the newline, so having the behavior be consistent would be great if possible. Thanks for taking a look!

@liquidz
Copy link
Owner

liquidz commented Dec 27, 2022

@noahmoss I tried to fix the behavior.
Could you try next_release branch?

@noahmoss
Copy link
Author

Seems to work, thanks!

@liquidz
Copy link
Owner

liquidz commented Dec 28, 2022

Thanks for your confirmation!
Just released v3.14.3196

@liquidz liquidz closed this as completed Dec 28, 2022
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