Fork me on GitHub
#cursive
<
2022-05-25
>
steveb8n02:05:31

The new “organise imports” feature is so nice. thanks!

cfleming05:05:08

Great, glad it’s helping! I have some more improvements for that on the way, including making it work better for CLJC.

Ivar Refsdal07:05:31

Yeah, that's a great feature, thanks!

imre07:05:16

+1, I use it every day. I only wish I could make it force a newline after :require/:import 🙂

steveb8n08:05:51

funny how some features seem small but have an outsized DX effect

cfleming08:05:27

Definitely. I’m planning inline eval soon which I think will be the same.

👀 1
nottmey08:05:56

How do I use this? is it a keybind? (did not stumble upon it yet)

cfleming08:05:56

@U3ZG4CAF8 Code | Optimise Imports…

cfleming08:05:16

The menu item will show any keys you have bound for it.

nottmey08:05:28

:star-struck:

nottmey08:05:34

ok, works like a charm

nottmey08:05:40

thanks!

👍 1
Ivar Refsdal08:06:58

PS: it's also possible to optimize imports automatically just before committing

🎉 1
Ivar Refsdal08:06:13

(just discovered this myself now)

tony.kay18:06:04

@U0567Q30W how do you detect requires that are used just for side-effects? Some of my systems, for example, use require to pull in multi-methods, but they are never called directly? Do you look for multimethods and deftype/defrecord as a way to prevent accidental cleanup that would affect operation?

imre18:06:56

I think if a require is pulled in without an alias it won't be removed during cleaning

tony.kay18:06:06

Hm…I’m also seeing a bug where it creates duplicates in the require…I just ran it a few times and it did this:

(:require
    [cheshire.core :as cheshire]
    [cheshire.core :as cheshire]
    [cheshire.core :as cheshire]
    [cheshire.core :as cheshire]
    [cheshire.core :as cheshire]
    [cheshire.core :as cheshire]
    [cheshire.core :as cheshire]
    [cljc.java-time.zone-id :as zone-id]
    [cljc.java-time.zone-id :as zone-id]
    [cljc.java-time.zone-id :as zone-id]
    [cljc.java-time.zone-id :as zone-id]
    [cljc.java-time.zone-id :as zone-id]
    [cljc.java-time.zone-id :as zone-id]
    [cljc.java-time.zone-id :as zone-id]
    [clojure.core.async :as async]
    [clojure.core.async :as async]

    [clojure.core.async :as async]

    [clojure.core.async :as async]
    [clojure.core.async :as async]
    [clojure.core.async :as async]

    [clojure.core.async :as async]
    [clojure.data.json :as json]
    [clojure.data.json :as json]
    [clojure.data.json :as json]
    [clojure.data.json :as json]
    [clojure.data.json :as json]
    [clojure.data.json :as json]
...

tony.kay18:06:15

it adds a new copy of those each time I run it

tony.kay18:06:32

I think maybe it is trying to preserve “sections” via the whitespace (which is how this ns was written), but it is getting confused or something. CLJ file.

tony.kay18:06:42

I manually cleaned it up a bit and that made it work right…trying to pinpoint the bug…

tony.kay18:06:20

Found it. There was a comment and that confuses it. I’ll open an issue @U0567Q30W https://github.com/cursive-ide/cursive/issues/2707

cfleming08:06:31

@U0CKQ19AQ Great, thanks, I'll get that fixed.

folcon16:05:54

I've been getting really high cpu spikes and I was speaking to jetbrains support and they were saying that cursive might be to blame. I have a memory snapshot I can share if that helps?

cfleming22:05:30

Yes please! Do you have a YouTrack issue or something?