cursive

Issues at: https://git.io/cursive-issues
dazld 2020-09-07T20:23:33.032700Z

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.

dazld 2020-09-08T21:15:06.052600Z

when cursive imports the protocol, it looks like:

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

dazld 2020-09-08T21:15:14.052800Z

as if it was a java interface

dazld 2020-09-08T21:16:46.053Z

eg:

dazld 2020-09-08T21:18:24.053800Z

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

dazld 2020-09-08T21:20:31.054200Z

etc.

cfleming 2020-09-09T00:17:08.054800Z

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.

👍 1
kenny 2020-09-07T20:23:49.032800Z

I've seen this too.

👍 1
dazld 2020-09-07T20:26:00.033Z

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

dazld 2020-09-07T20:29:57.033300Z

going to downgrade to 1.9.3

dazld 2020-09-07T20:40:26.033600Z

this is valid, right?

dazld 2020-09-07T20:40:56.034Z

the :or clause, specifically

kenny 2020-09-07T20:42:15.034200Z

Yes

dazld 2020-09-07T20:42:52.034400Z

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

dazld 2020-09-07T20:43:04.034600Z

thank for sanity check @kenny

cfleming 2020-09-07T20:54:19.034800Z

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

👍 1
cfleming 2020-09-07T21:41:42.035200Z

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

cfleming 2020-09-07T21:43:14.035400Z

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.

kenny 2020-09-07T21:45:38.035600Z

kenny 2020-09-07T21:46:02.036Z

It seems to only happen in some namespaces.

kenny 2020-09-07T21:46:30.036200Z

That namespace is .clj

kenny 2020-09-07T21:47:45.036400Z

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

cfleming 2020-09-07T21:47:57.036600Z

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.

cfleming 2020-09-07T21:48:28.036800Z

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.

cfleming 2020-09-07T21:48:47.037Z

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

kenny 2020-09-07T21:48:55.037200Z

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

cfleming 2020-09-07T21:49:17.037400Z

I’ll fix that one now.

2
kenny 2020-09-07T22:27:30.037700Z

Just noticed this one too @cfleming

cfleming 2020-09-07T22:28:14.038100Z

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.

2