Fork me on GitHub
#cursive
<
2019-05-22
>
cfleming00:05:40

I actually didn’t even know that ::keys and ::a/keys in destructuring was a thing - https://clojure.org/guides/destructuring makes no mention of it.

cfleming00:05:23

@tony.kay Actually… those cases should already be handled, and there are even tests for them. I’ll check what’s going on there.

cfleming00:05:01

@tony.kay Right, so I have a test that:

(let [{::keys [foo bar]} item] ...)
When ::foo is renamed to :other/baz, is changed to:
(let [{:keys [:other/baz ::bar]} item] ...)

cfleming00:05:16

Which is not exactly the transformation you wanted, but is correct.

cfleming00:05:39

Are you not seeing anything like that happening?

cfleming00:05:32

That does work, I just tested it. Also:

(ns cursive-2178.core
  (:require [clojure.string :as str]))

(let [{::str/keys [a b]} nil])
is correctly transformed to:
(let [{:keys [:other/baz ::str/b]} nil])

cfleming00:05:48

If I rename ::str/a to :other/baz

tony.kay00:05:20

have there been recent fixes?

tony.kay00:05:23

I just got an update notice

cfleming00:05:24

(I had forgotten those destructuring options even existed, but I did fix them back in the day)

cfleming00:05:51

That hasn’t changed since my memory fade-off point, since I had forgotten they were supported 🙂

tony.kay00:05:04

so you cannot repro?

tony.kay00:05:10

I can make failing cases for you if you want

cfleming00:05:17

Yes please!

tony.kay00:05:22

ok, just a few

tony.kay00:05:56

OH…these are CLJC files, if that matters

cfleming00:05:31

Hmm, I wonder

cfleming00:05:36

Let me check

tony.kay00:05:36

(ns com.fulcrologic.fulcro.b
  (:require
    [clojure.spec.alpha :as s]))

(s/def ::y number?)

-----

(ns com.fulcrologic.fulcro.a
  (:require
    [com.fulcrologic.fulcro.b :as b]
    [clojure.spec.alpha :as s]))

(s/def ::x int)

(defn f [{::keys   [x]
          ::b/keys [y]}])

tony.kay00:05:39

both cljc files

tony.kay00:05:44

try renaming ::y in b

tony.kay00:05:27

Also, while we’re talking CLJC…doc string lookup fails in IDE if you’re in a CLJS file that uses a func from a CLJC file

tony.kay00:05:39

even though the function is obviously available

cfleming00:05:03

Yeah, I can see that rename failing.

cfleming00:05:07

I’ll debug that, thanks.

tony.kay00:05:14

welcome…thanks for looking into it

cfleming00:05:02

I see what the problem is.

cfleming00:05:39

That keyword is used with s/def, which means that they get treated as if they were definitions.

cfleming00:05:55

But the destructuring should still work.

cfleming00:05:20

Ugh, that’s tricky.

tony.kay00:05:44

destructuring works, but renaming does not

tony.kay00:05:22

I see…so treating them like definitions is sort of like the problem of moving functions among nses

cfleming00:05:22

Yeah, I mean the renaming should update destructurings.

cfleming00:05:36

Find usages is also affected I think.

tony.kay00:05:48

Yes, it is, now that you say it

cfleming00:05:59

In fact, there’s an issue about that one - https://github.com/cursive-ide/cursive/issues/1908

cfleming00:05:50

These frankenkeywords are getting tricky.

Lennart Buit06:05:21

Also, if you c/p some code around, Cursive isn’t smart enough to find that ::alias/keyword can be required. So the only real way to check whether you missed a require for a aliased keyword is trying to load into the repl

Matthew Davidson (kingmob)20:05:39

Is anyone else having an issue where IntelliJ/Cursive keeps recategorizing resource directories as source directories? I’m trying to isolate the problem, and thought I’d ask.

cfleming21:05:43

@lennart.buit Yes, it would be nice if Cursive auto-prompted in that case, you’re right.

cfleming21:05:25

@kingmob No-one else has reported that, no. Are you manually categorising them as resource dirs? i.e. by right clicking in the project view?

Matthew Davidson (kingmob)21:05:26

@cfleming Yes, but it never lasts. It didn’t use to be a problem, but I can’t figure out what change caused it.

cfleming21:05:04

So when you sync your lein/deps project, Cursive will re-mark all the directories to what the project file specifies them as. Clojure doesn’t really make the distinction between source and resource folders, there was an issue about this ages ago, I’ll see if I can dig it up.

cfleming21:05:14

Why do you need it marked as a resource folder?

Matthew Davidson (kingmob)21:05:49

…because miscategorized dirs offend my librarian ancestors? 😄

Matthew Davidson (kingmob)22:05:08

It’s not that big a deal, it’s more like an itch that won’t go away.

cfleming22:05:39

Basically, Lein and IntelliJ treat resource folders in different ways. The tl;dr is you should just leave it as Cursive sets it 🙂

cfleming22:05:04

Your librarian ancestors will just have to turn in their graves.

Matthew Davidson (kingmob)22:05:27

I must now slit my wrists with a sharp bookmark.

Matthew Davidson (kingmob)22:05:39

In all seriousness, thanks for checking, @cfleming!

cfleming22:05:43

That is as it should be, yes.