Fork me on GitHub
#cursive
<
2019-04-22
>
cjmurphy05:04:01

Does a recent version of Cursive support mount's defstate macro, at least so that it can be interpreted as def?

cfleming05:04:17

(Cursive should probably support that one natively, since Mount is pretty popular these days, but it looks like it doesn’t out of the box)

cjmurphy05:04:48

I know about that trick from Fulco, get the yellow lightbulb up and it is one of the options, but the only option I'm getting is "Create function 'defstate'".

cfleming05:04:27

That can sometimes happen if the intention gets disabled, check under Preferences | Editor | Intentions | Clojure | Resolution that it’s enabled.

cjmurphy05:04:31

'Preferences' is a Mac thing I believe, searching for same on Linux machine...

cjmurphy05:04:13

Resolution is ticked. Start from File/Settings for non-Mac machines.

cjmurphy05:04:00

My Cursive is version 1.7.0-2017.3. But I think s/be recent enough to have the 'redefine as' stuff.

cfleming05:04:08

Yes, definitely.

cfleming05:04:18

That’s strange, then.

cfleming05:04:47

Can you send a screenshot of what you’re seeing when you alt-enter on the lightbulb?

cfleming05:04:04

By DM if it’s sensitive is fine.

cjmurphy05:04:18

I'm going to Invalidate Caches and Restart. That often fixes strange IDEA things.

cjmurphy05:04:23

Invalidate caches did not help. Nothing sensitive.

cfleming09:04:07

@cjmurphy Oh, so in that case it looks like it can’t actually resolve defstate itself. Is that dep definitely added to your project? You can see that in the dependencies tree in the lein toolwindow on the right.

cjmurphy09:04:50

mount:0.1.6 is indeed there in the dependencies tree on the right. Also, well, mount is doing its thing, so I'm sure that mount is there.

cfleming09:04:48

I suspect that defstate itself is defined using a macro, and I dimly remember something about this. One sec.

cjmurphy09:04:06

The very simple lein project.clj has [mount "0.1.16"] in it as a :dependency.

cjmurphy09:04:11

Yes it is a macro.

cfleming09:04:52

That bugfix actually might be later than the version you’re using, one sec

cfleming09:04:10

Yes, that fix went into Cursive 1.8.0

cfleming09:04:18

That’s why you’re not seeing it.

cjmurphy09:04:07

Okay thanks, I'll upgrade to 1.8.0.

Adrian Smith10:04:28

I've clicked file -> new -> project -> deps in cursive and its generated a file with

{:deps {}}
inside but cursive shows me this error:

Adrian Smith10:04:49

I have clojure up to date with

brew upgrade clojure

Adrian Smith10:04:04

both clj and clojure work on the terminal they start a repl with the latest version

Adrian Smith10:04:23

I can see there is something called Commands that are empty

Adrian Smith10:04:11

reinstalling cursive yields the same result, the commands menu isn't there if cursive is uninstalled

cjmurphy11:04:37

@sfyire What is the project SDK?

Adrian Smith11:04:53

I think I solved it by ticking:

cfleming22:04:27

@sfyire You need to configure deps at Preferences | Build, Execution, Deployment | Build Tools | Clojure Deps. In your case you should select “Use CLI tools”.

cfleming22:04:58

You can also configure that in the project creation/import wizard, but it’s not obvious sometimes.

norbert23:04:25

I already have Use CLI tools selected but when I create a Clojure Application in Run configuration, I get The Clojure jar is not attached to this module. Any idea what I'm doing wrong?

cfleming23:04:08

@norbertpy That means that Clojure isn’t added as a dependency to that module. How did you create the project?

norbert23:04:04

File > New Project > Clojure > Deps.

cfleming23:04:00

If you open the Clojure Deps toolwindow (View | Tool Windows | Clojure Deps), is your project registered there?

cfleming23:04:54

If so, if you open up its dependencies tree, is Clojure in there?

norbert23:04:13

The window opens but there is nothing in there but then if I try to add it, it says It's already registered. I added clojure as a dependency from Alex Miller's hint but I get Sync Failed messages.

norbert23:04:45

I think I have screwed some parts and this is not related to cursive.

norbert23:04:10

But I have hard time figuring it out. Newbie Clojurist, sorry.

cfleming23:04:38

There’s definitely something wonky there.

cfleming23:04:56

Let’s go through creating a new project from scratch.

cfleming23:04:18

Hopefully that will work better.

norbert23:04:37

Let's do it. Should I check auto-import?

cfleming23:04:54

So, File | New | Project…, then Clojure | Deps

cfleming23:04:03

Yeah, that’s generally a good idea.

norbert23:04:20

explicit module or qualified?

cfleming23:04:47

I’m not seeing that - can you send a screenshot?

cfleming23:04:38

Can you send that whole wizard screen?

cfleming23:04:55

Which version of Cursive are you running?

norbert23:04:00

That the entire of it.

cfleming23:04:25

I can’t remember if that changed recently.

cfleming23:04:30

Ok, stick with explicit.

norbert23:04:01

version 1.8.1-2018.1

cfleming23:04:38

Ok, I’m going to ignore that for now, but I’m not sure what’s going on there.

cfleming23:04:01

Anyway, next page, give the project a name and press Finish.

norbert23:04:08

Alright, I have an empty project and an empty deps.

norbert23:04:36

Banner says, Project SDK is not defined.

cfleming23:04:43

If you open the Build toolwindow, does the Sync complete ok?

cfleming23:04:04

Ok, we’ll fix that - File | Project Structure…

norbert23:04:18

No:

java.lang.ExceptionInInitializerError
	at com.intellij.externalSystem.JavaProjectData.<clinit>(JavaProjectData.java:44)
	at cursive.deps.DepsProjectResolver.resolveProjectInfo(DepsSupport.kt:313)
	at cursive.deps.DepsProjectResolver.resolveProjectInfo(DepsSupport.kt:291)
	at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.lambda$resolveProjectInfo$0(RemoteExternalSystemProjectResolverImpl.java:37)
	at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:58)
	at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.openapi.externalSystem.service.RemoteExternalSystemFacadeImpl$1.invoke(RemoteExternalSystemFacadeImpl.java:115)
	at com.sun.proxy.$Proxy3.resolveProjectInfo(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.MissingResourceException: Can't find bundle for base name messages.JavaCoreBundle, locale en_US
	at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
	at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
	at java.util.ResourceBundle.getBundle(ResourceBundle.java:773)
	at com.intellij.core.JavaCoreBundle.getBundle(JavaCoreBundle.java:45)
	at com.intellij.core.JavaCoreBundle.message(JavaCoreBundle.java:33)
	at com.intellij.pom.java.LanguageLevel.<clinit>(LanguageLevel.java:24)

norbert23:04:46

Just one thing before I waste your time, my intellij is a little old.

cfleming23:04:58

Hmm, how old?

norbert23:04:18

Not that old but I haven't updated for a while.

cfleming23:04:48

Hmm, yeah, it’s not that old but the deps support is built on an API that changes pretty frequently.

cfleming23:04:12

I’m not sure what that exception is telling us. One sec…

norbert23:04:20

The build is from March 2018. I can upgrade and then report back.

cfleming23:04:11

Seems like upgrading IntelliJ might be the fix.

norbert23:04:14

Oh, yeah. Let me upgrade and I'll get back to you if it persists.

norbert23:04:26

Thanks for the help. I appreciate it.

cfleming23:04:45

No worries, let me know if you still can’t get it working.

norbert23:04:18

Fixed 🙏 Thank you 🎉

cfleming23:04:26

Great! Thanks for letting me know.