Fork me on GitHub
#lsp
<
2022-06-03
>
lassemaatta05:06:21

when clean-ns sorts the :require form, it seems to always put entries which use reader conditionals (`#?(:clj [some.clj-lib :as foo])`) as last. Is this something that could be configured (I couldn't find an appropriate setting)? Most of the projects I've seen tend to put these kinds of conditional requires first, followed by the regular ones.

lassemaatta06:06:05

actually, it doesn't sort them as last. It seems to sort them somewhere between read*-`reae*`.

lassemaatta06:06:51

(:require [p :as p]
          [q :as q]
          [r :as r]
          [ra :as ra]
          [rb :as rb]
          [rc :as rc]
          [rd :as rd]
          [re :as re]
          [rea :as rea]
          [read :as read]
          #?(:clj [foobar :as f])
          [reader :as reader]
          [reae :as reae]
          [rf :as rf]
          [s :as s]
          [t :as t]))

ericdallo16:06:49

I think you are the first one to complain about that, so not sure if this is a common need. The reader conditional between read and reader makes no sense to me, do you know why that?

lassemaatta16:06:10

No idea. My original plan was to fix all the unsorted namespaces in our project, and while looking at the dry run output I noticed that those reader conditional rows were sorted in a funny way

lassemaatta16:06:48

Then I duplicated it in emacs using the normal clean ns code action

ericdallo16:06:56

Hum, I see, it's clojure-lsp that is moving to that position, I thought you said your project had it in that way on purpose

lassemaatta16:06:38

Nope, we typically have those reader conditional rows first

ericdallo16:06:53

Alright, A issue makes sense, not sure if we should always sort the reader conditionals as last or first, but the current way looks weird indeed

lassemaatta16:06:06

I can test this a bit more and make an issue

Jason Whitlark20:06:05

In the Calva outline view, defmethods don’t show up. Is there a setting to recognize them as symbols for the ns? I’ve seen https://github.com/clojure-lsp/clojure-lsp/issues/662 which seems related, although my usage isn’t for integrant.

ericdallo20:06:41

I think this is a clojure-lsp bug, we only consider var-definitions on the outline

ericdallo20:06:57

Please open an issue on clojure-lsp with detailed report

Jason Whitlark20:06:03

I’m actually not sure what to ask for. There’s both the method and the keyword, (of course, it doesn’t have to be a keyword).