Would it be too OCD if lsp, when reordering the namespaces, could also sort the :refer [foo bar baz]
too?
I though this was already working :thinking_face:
oh
I didn't test it tbh 🙂
I thought it only did the require's
will test in a bit 🙂
yeah, it doesn't sort 😔
nope, doesn't do
i.e., before:
(:require
[clojure.tools.logging :as log]
[honey.sql.helpers :as helpers :refer [select from where]]
[honey.sql :as sql]
then after a call to "clean-ns"
(:require
[clojure.tools.logging :as log]
[honey.sql :as sql]
[honey.sql.helpers :as helpers :refer [select from where]]
it correctly reorders the require's, but doesn't sort the :refer
hum we indeed sort it but for some reason it's not working: https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/refactor/transform.clj#L331
unused refer's are correctly removed, so that part is good 🙂
but it doesn't sort 😞
I wonder if it will sort if I have an unused refer in
yes!
so it sorts if it also detects unused refers
you probably want that to be lifted out, so that sorting always happens on clean-ns
before:
[honey.sql :as sql]
[honey.sql.helpers :as helpers :refer [select from where insert-into]]
(insert-into is not used)
then calling clean-ns
yes 🙂
[honey.sql :as sql]
[honey.sql.helpers :as helpers :refer [from select where]]
I love that idea btw
🙂
Found the issue, fixing it!
:partywombat: