lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
dharrigan 2021-04-25T19:07:54.141900Z

Would it be too OCD if lsp, when reordering the namespaces, could also sort the :refer [foo bar baz] too?

ericdallo 2021-04-25T19:08:26.142Z

I though this was already working :thinking_face:

dharrigan 2021-04-25T19:08:32.142200Z

oh

dharrigan 2021-04-25T19:08:37.142400Z

I didn't test it tbh 🙂

😅 1
dharrigan 2021-04-25T19:08:47.142700Z

I thought it only did the require's

dharrigan 2021-04-25T19:08:49.142900Z

will test in a bit 🙂

ericdallo 2021-04-25T19:09:21.143100Z

yeah, it doesn't sort 😔

dharrigan 2021-04-25T19:09:24.143300Z

nope, doesn't do

dharrigan 2021-04-25T19:09:28.143500Z

i.e., before:

dharrigan 2021-04-25T19:09:40.143700Z

(:require
   [clojure.tools.logging :as log]
   [honey.sql.helpers :as helpers :refer [select from where]]
   [honey.sql :as sql]

dharrigan 2021-04-25T19:10:07.143900Z

then after a call to "clean-ns"

dharrigan 2021-04-25T19:10:29.144100Z

(:require
   [clojure.tools.logging :as log]
   [honey.sql :as sql]
   [honey.sql.helpers :as helpers :refer [select from where]]

dharrigan 2021-04-25T19:10:43.144300Z

it correctly reorders the require's, but doesn't sort the :refer

ericdallo 2021-04-25T19:10:56.144500Z

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

dharrigan 2021-04-25T19:11:50.144800Z

unused refer's are correctly removed, so that part is good 🙂

dharrigan 2021-04-25T19:12:21.145Z

but it doesn't sort 😞

dharrigan 2021-04-25T19:12:38.145200Z

I wonder if it will sort if I have an unused refer in

dharrigan 2021-04-25T19:12:58.145300Z

yes!

dharrigan 2021-04-25T19:13:07.145500Z

so it sorts if it also detects unused refers

dharrigan 2021-04-25T19:13:19.145700Z

you probably want that to be lifted out, so that sorting always happens on clean-ns

dharrigan 2021-04-25T19:13:55.146100Z

before:

dharrigan 2021-04-25T19:14:09.146300Z

[honey.sql :as sql]
   [honey.sql.helpers :as helpers :refer [select from where insert-into]]

dharrigan 2021-04-25T19:14:14.146500Z

(insert-into is not used)

dharrigan 2021-04-25T19:14:22.146700Z

then calling clean-ns

ericdallo 2021-04-25T19:14:26.146900Z

yes 🙂

dharrigan 2021-04-25T19:14:29.147100Z

[honey.sql :as sql]
   [honey.sql.helpers :as helpers :refer [from select where]]

borkdude 2021-04-25T19:19:26.147300Z

I love that idea btw

dharrigan 2021-04-25T19:19:47.147600Z

🙂

ericdallo 2021-04-25T19:38:13.147800Z

Found the issue, fixing it!

dharrigan 2021-04-25T19:39:56.148Z

:partywombat:

1