Fork me on GitHub
#cursive
<
2020-09-07
>
dazld20:09:33

Did something break in the latest EAP builds to do with protocols? I’m getting some very weird behaviour now (`1.9.4-eap3-2020.2` ) - namely cursive tries to import protocols instead of requiring them.

kenny20:09:49

I've seen this too.

👍 3
dazld20:09:00

getting some code warnings on valid destructuring of a method arg too

dazld20:09:57

going to downgrade to 1.9.3

dazld20:09:26

this is valid, right?

dazld20:09:56

the :or clause, specifically

dazld20:09:52

well, that’s a bug in 1.9.3 as well then, and the import behaviour happens there too

dazld20:09:04

thank for sanity check @U083D6HK9

cfleming20:09:19

Thanks for the report, I’ll check those cases out.

👍 3
cfleming21:09:42

With the protocol issue, what does the protocol reference look like in your code when Cursive is trying to import it?

cfleming21:09:14

There’s actually an additional problem where Cursive tries to resolve the symbol at the protocol definition itself, I think that’s an IntelliJ 2020 problem.

kenny21:09:02

It seems to only happen in some namespaces.

kenny21:09:30

That namespace is .clj

kenny21:09:45

Doesn't appear to happen in the 3 cljs namespaces I tested (though, they're all from the same IntelliJ module)

cfleming21:09:57

Right, that’s at the definition - that I think is new in IntelliJ 2020, I had to fix a bunch of similar cases for vars.

cfleming21:09:28

Hmm, yeah, protocols are treated differently by Cursive in clj and cljs, since in clj they create an interface and in cljs they’re more like a var.

cfleming21:09:47

I got the impression that @U3ZUC5M0R was talking about referring to them from another namespace, though.

kenny21:09:55

Oh, okay. That's the issue I've had. Not sure if @U3ZUC5M0R's issue is different.

cfleming21:09:17

I’ll fix that one now.

6
kenny22:09:30

Just noticed this one too @U0567Q30W

cfleming22:09:14

Yeah, I think that’s all the same case. I’ve just fixed it, it is indeed new in the new EAP, I can’t blame IntelliJ 2020 for this one.

6
dazld21:09:06

when cursive imports the protocol, it looks like:

(:import (foo.bar.baz ISomething))

dazld21:09:14

as if it was a java interface

dazld21:09:24

however, when imported like this, intelliJ does provide gutter hints, which doesn’t happen with require

cfleming00:09:08

So in that case, you would normally either :require/`:refer` that protocol, or refer to it qualified with an alias, like component/Lifecycle. Protocols are tricky in Clojure because they actually do define an interface, and in this case it’s probably what you want, although there are probably subtleties there that I’m not aware of.

👍 3