cursive

Issues at: https://git.io/cursive-issues
2021-02-11T01:20:44.109900Z

I’m running Intellij 2019.3.5 and I’ve just upgraded Cursive to 1.10.1-eap2-2019.3. I’m not able to get a clojure repl running. The error message I’m getting is

Error running 'CLJ Local': class clojure.lang.PersistentVector cannot be cast to class [Lcom.intellij.openapi.actionSystem.AnAction; (clojure.lang.PersistentVector is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @7e26aea8; [Lcom.intellij.openapi.actionSystem.AnAction; is in unnamed module of loader com.intellij.util.lang.UrlClassLoader @5419f379)
I’ve tried deleting the .idea folder and the *.iml file and reimporting the project with no success. Any ideas what might be causing this? I’m on a Mac running 10.14.6 (Mojave) and my project is configured for Java SDK 13. Thanks!

2021-02-11T18:32:30.116300Z

Hi @cfleming - I was going to delete the Intellij Preferences and Caches folders and start from a clean slate but wanted to check with you before doing that in case you needed anything from my config to track down this bug.

Jakub Holý 2021-02-11T20:26:48.117100Z

My IntelliJ also shows wrong branch but otherwise works OK.

2021-02-11T21:20:32.117800Z

After deleting the project directory and re-cloning from github, all my git branches are back. Unfortunately, I’m still getting the same error on launching the repl. FWIW - here’s a link to the project: https://github.com/aeberts/fulcro-rad-demo

cfleming 2021-02-11T21:29:06.118100Z

@alex-eberts Thanks for the project link, I’ll try to reproduce with that.

2021-02-11T21:30:05.118300Z

BTW - I just tried setting my project SDK to 1.8 and I’m getting the same error. (it was Java 13).

2021-02-11T21:41:28.118500Z

@cfleming More testing feedback: I tried running a remote nrepl server in the project with nrepl-0.8.3 and then connecting remotely to it and I’m getting the same error.

cfleming 2021-02-13T04:38:01.144200Z

@alex-eberts Just to let you know I’ve managed to reproduce this with your setup, so I’ll be able to debug it - thanks!

1🎉
cfleming 2021-02-13T04:41:19.144400Z

Ugh, I had also planned to improve the error logging, but that’s handled by IntelliJ. What it does is write out the exception at debug level, so you have to know which logger to set to debug level to see it. Yuk.

cfleming 2021-02-13T05:08:51.144600Z

Ok, this will be fixed for the next build. This bug only affected 2019.3, which I guess is why no-one else hit it (an IntelliJ API accepts a List in recent versions, but in 2019.3 was a varargs call).

2021-02-13T06:38:52.145900Z

@cfleming thanks for the update and good news regarding that bug!

cfleming 2021-02-13T07:48:28.146100Z

https://github.com/cursive-ide/cursive/issues/2504

cfleming 2021-02-11T01:22:43.110Z

Could you check your log (Help->Show log in Finder/Explorer) and see if the full stacktrace appears there?

1👀
2021-02-11T01:26:30.110300Z

Here’s a stacktrace that corresponds to the time I got the error:

2021-02-11T01:26:30.110500Z

2021-02-10 17:22:44,449 [ 652404]   WARN - .impl.LineStatusTrackerManager - Tracker is being held on dispose by com.intellij.openapi.editor.impl.EditorImpl@b9bd544; file: /REPL.clj 
2021-02-10 17:22:44,456 [ 652411]  ERROR - api.util.objectTree.ObjectTree - Editor of class com.intellij.openapi.editor.impl.EditorImpl hasn't been released: 
com.intellij.openapi.util.TraceableDisposable.ObjectNotDisposedException: See stack trace responsible for creation of unreleased object below 
	at com.intellij.openapi.editor.impl.EditorImpl.<init>(EditorImpl.java:148)
	at com.intellij.openapi.editor.impl.EditorFactoryImpl.createEditor(EditorFactoryImpl.java:200)
	at com.intellij.openapi.editor.impl.EditorFactoryImpl.createEditor(EditorFactoryImpl.java:160)
	at cursive.repl.ClojureConsole.<init>(ClojureConsole.java:89)
	at cursive.repl.toolwindow$create_repl_ui.invokeStatic(toolwindow.clj:593)
	at cursive.repl.toolwindow$create_repl_ui.invoke(toolwindow.clj:586)
	at cursive.repl.toolwindow$create_new_repl$reify__12629.run(toolwindow.clj:761)
	at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:519)
	at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:532)
	at cursive.repl.toolwindow$create_new_repl.invokeStatic(toolwindow.clj:760)
	at cursive.repl.toolwindow$create_new_repl.invoke(toolwindow.clj:747)
	at cursive.repl.process_runner$run_nrepl_server.invokeStatic(process_runner.clj:163)
	at cursive.repl.process_runner$run_nrepl_server.invoke(process_runner.clj:148)
	at cursive.repl.process_runner$execute.invokeStatic(process_runner.clj:239)
	at cursive.repl.process_runner$execute.invoke(process_runner.clj:234)
	at clojure.lang.Var.invoke(Var.java:406)
	at cursive.api.DelayedFn.invoke(DelayedFn.java:51)
	at cursive.repl.runner.LocalConfiguration$getRunProfileState$2.execute(ReplRunConfigurations.kt:484)
	at com.intellij.execution.impl.DefaultJavaProgramRunner.doExecute(DefaultJavaProgramRunner.java:111)
	at com.intellij.execution.runners.GenericProgramRunner$execute$$inlined$runProfileStarter$1.executeAsync(GenericProgramRunner.kt:56)
	at com.intellij.execution.runners.GenericProgramRunnerKt$startRunProfile$$inlined$runProfileStarter$1.executeAsync(GenericProgramRunner.kt:56)
	at com.intellij.execution.impl.ExecutionManagerKtImpl$startRunProfile$startRunnable$1.run(ExecutionManagerKtImpl.kt:66)
	at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:83)
	at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:107)
	at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:116)
	at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:121)
	at com.intellij.execution.impl.ExecutionManagerKtImpl$startRunProfile$2.run(ExecutionManagerKtImpl.kt:121)
	at com.intellij.execution.impl.ExecutionManagerImpl.compileAndRun(ExecutionManagerImpl.java:279)
	at com.intellij.execution.impl.ExecutionManagerKtImpl.startRunProfile(ExecutionManagerKtImpl.kt:121)
	at com.intellij.execution.runners.GenericProgramRunnerKt.startRunProfile(GenericProgramRunner.kt:50)
	at com.intellij.execution.runners.GenericProgramRunner.execute(GenericProgramRunner.kt:17)
	at cursive.runner.DeferredRunner.access$execute$s-282919921(Deferred.kt:59)
	at cursive.runner.DeferredRunner$execute$1$run$1.run(Deferred.kt:92)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:309)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:441)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:424)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:407)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:908)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:781)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:424)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:698)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:423)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
2021-02-10 17:22:44,457 [ 652412]  ERROR - api.util.objectTree.ObjectTree - IntelliJ IDEA 2019.3.5  Build #IC-193.7288.26 
2021-02-10 17:22:44,457 [ 652412]  ERROR - api.util.objectTree.ObjectTree - JDK: 11.0.6; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o 
2021-02-10 17:22:44,457 [ 652412]  ERROR - api.util.objectTree.ObjectTree - OS: Mac OS X 

cfleming 2021-02-11T01:28:07.110700Z

I don’t think that’s the same problem unfortunately. That one looks like some kind of object leak, probably caused by the original problem.

2021-02-11T01:29:06.110900Z

I’ll take a look higher up in the log… stand by. Many thanks for your help BTW Colin! 🙂

2021-02-11T01:30:30.111100Z

Maybe this is it?

2021-02-10 17:12:14,903 [  22858]   INFO - il.indexing.FileBasedIndexImpl - Rebuild requested for index ClojureSymbolMeta 
java.lang.Throwable
	at com.intellij.util.indexing.FileBasedIndex.requestRebuild(FileBasedIndex.java:64)
	at cursive.stubs.ReplStubsNotifications$createNotification$1$whenDone$1.run(Stubs.kt:240)
	at cursive.stubs$generate_stubs$fn__15817$process__15818.invoke(stubs.clj:250)
	at cursive.stubs$generate_stubs$fn__15817.invoke(stubs.clj:325)
	at cursive.task$backgroundable$reify__15747.run(task.clj:12)
	at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:888)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:163)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:585)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:531)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:150)
	at com.intellij.openapi.progress.impl.CoreProgressManager$4.lambda$run$0(CoreProgressManager.java:402)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:221)
	at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:402)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:238)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
2021-02-10 17:12:14,962 [  22917]   INFO - il.indexing.FileBasedIndexImpl - scheduleIndexRebuild, reason: checkRebuild 

cfleming 2021-02-11T01:31:38.111300Z

No, that one’s not actually an error, just IntelliJ noting that something requested that the indexes get rebuilt. That’s an unusual thing to do (Cursive is one of the few plugins with a real use-case for it) so they log it to be sure.

cfleming 2021-02-11T01:31:55.111500Z

Let me dig the code out and see what I can see.

2021-02-11T01:33:14.111700Z

Ok, please let me know if I can provide any other info (would you like the full log via email?).

cfleming 2021-02-11T01:33:42.111900Z

Yeah, if you could send it that might be helpful - <mailto:cursive@cursive-ide.com|cursive@cursive-ide.com>

2021-02-11T01:34:23.112100Z

Ok, will do.

cfleming 2021-02-11T01:35:11.112300Z

Also, could you send a screenshot of the run config you’re trying to run in case there’s anything unusual about it?

2021-02-11T01:39:07.112500Z

will do.

2021-02-11T01:40:50.112700Z

Screenshot:

2021-02-11T01:45:36.113100Z

One other thing to note is that git in Intellij seems to be in a weird state. It’s not seeing my develop branch even though it’s fine on disk. I’m not sure if that would have any impact on running a repl but thought I would mention it.

katox 2021-02-11T12:37:34.113400Z

Another thing that stopped working in the latest build is that kill stopped working on multi-line strings. The workaround is to to join the lines, then kill.

markaddleman 2021-02-11T14:18:35.115300Z

Pathom - particularly Pathom3's smart maps - is figuring larger in my codebase. I'd love cursive to understand keywords that are "defined" as part of a Pathom resolver so I can hotlink to their definition

wilkerlucio 2021-02-13T03:33:20.143100Z

hello, Pathom author here 🙂 @cfleming you can find docs for this here: https://pathom3.wsscode.com/docs/resolvers

wilkerlucio 2021-02-13T03:33:40.143400Z

altough, I believe if we want to index resolvers we have a few open questions about what and how much to index

wilkerlucio 2021-02-13T03:34:16.143600Z

I think would be interest to index the presence of an attribute in an "output" as a definition of it (an output attribute means that this resolver can expose this data, this is what I think makes most sense to navigate to)

wilkerlucio 2021-02-13T03:34:34.143800Z

this would have to be open to many definition points, as the same attribute may appear in many different resolvers

wilkerlucio 2021-02-13T03:35:57.144Z

the output may be explicit (::pco/output key in the configuration map of the resolver), or implicit (in case the last statement of the resolver definition is a map, this is documented on that same page)

markaddleman 2021-02-13T15:58:45.146400Z

Thanks @wilkerlucio for stepping in 🙂 I agree that mapping an attribute to the resolvers that produce it would be a great first step

helios 2021-02-11T15:58:57.115800Z

How do you sort your namespace require/imports with cursive?

2021-02-12T09:07:17.124300Z

I personally use https://github.com/greglook/cljstyle which orders them for me, as a file watcher task

imre 2021-02-12T09:07:54.124600Z

ooh file watcher task! can you share how you configure that?

2021-02-12T09:08:13.124800Z

yeah sure, one second...

2021-02-12T09:08:19.125Z

2021-02-12T09:09:48.125400Z

it's the closest I've been able to get to prettier in js

2021-02-12T09:10:46.125600Z

I hope I explained how to set it up with that screenshot but let me know if not, I've been meaning to write a blog post on it really

imre 2021-02-12T09:13:35.125800Z

Thank you! Does this not trigger the "file was modified extrnally" dialog?

2021-02-12T09:15:22.126Z

it doesn't seem to for me, no

imre 2021-02-12T09:16:17.126200Z

Great stuff thanks!. I'll give it a go

1👍
AJ Jaro 2021-02-12T14:21:43.132600Z

Oh this looks interesting @me1763! Thanks for sharing!

1👍
helios 2021-02-15T14:35:34.161500Z

@ajarosinski i was able to use your plugin 🙂 do you have it on github?

AJ Jaro 2021-02-15T14:37:14.161700Z

@helios Yep, https://github.com/mustangJaro/antandreAny improvements to it would be fantastic! I know it’s not written the best

imre 2021-02-11T16:05:36.115900Z

manually or with idea's string manipulation plugin 😞

imre 2021-02-11T16:05:46.116100Z

I think there is a gh issue about it

2021-02-11T18:32:30.116300Z

Hi @cfleming - I was going to delete the Intellij Preferences and Caches folders and start from a clean slate but wanted to check with you before doing that in case you needed anything from my config to track down this bug.

Shantanu Kumar 2021-02-11T20:23:12.116500Z

I manually segregate the requires into 3 sections - 1. clojure.*, 2. third-party lib namespaces, 3. app namespaces. I maintain alphabetic order within each section, again manually. Any pointers to automate this would be great.

danieroux 2021-02-11T20:26:16.116700Z

I install the ideavim plugin, select the requires and run :'&lt;,'&gt;!sort on it.

danieroux 2021-02-11T20:26:33.116900Z

… not elegant, but it works

Jakub Holý 2021-02-11T20:26:48.117100Z

My IntelliJ also shows wrong branch but otherwise works OK.

AJ Jaro 2021-02-11T20:32:32.117300Z

I was also irritated by this so I created a https://plugins.jetbrains.com/plugin/13222-clojure-namespace-sort The insides of the plugin aren’t great, but it works decently

AJ Jaro 2021-02-11T21:15:50.117600Z

Ok, I only tried it the other day, but I’ll let you know if I start leaning on this tool much

2021-02-11T21:20:32.117800Z

After deleting the project directory and re-cloning from github, all my git branches are back. Unfortunately, I’m still getting the same error on launching the repl. FWIW - here’s a link to the project: https://github.com/aeberts/fulcro-rad-demo

cfleming 2021-02-11T21:29:06.118100Z

@alex-eberts Thanks for the project link, I’ll try to reproduce with that.

2021-02-11T21:30:05.118300Z

BTW - I just tried setting my project SDK to 1.8 and I’m getting the same error. (it was Java 13).

2021-02-11T21:41:28.118500Z

@cfleming More testing feedback: I tried running a remote nrepl server in the project with nrepl-0.8.3 and then connecting remotely to it and I’m getting the same error.

verma 2021-02-11T21:53:43.118700Z

Could possibly be done with babashka+clj-rewrite also I believe.

stuartrexking 2021-02-11T22:35:07.119400Z

This is going to seem silly, but how does Tony kill to the end of the form here? https://youtu.be/3dZK5seIaVI?t=1238

verma 2021-02-11T22:36:27.119500Z

Something like kill-sexp-to-end perhaps, let me check which exact paraedit command it is

verma 2021-02-11T22:37:15.119700Z

I think straight up "Kill"

verma 2021-02-11T22:37:48.119900Z

I am not sure what the default binding for it is, but I think its this one:

stuartrexking 2021-02-11T22:40:51.120300Z

Kill and Kill Sexp both work. Now how to paste like he did…

stuartrexking 2021-02-11T22:43:16.120500Z

Thank you @verma

stuartrexking 2021-02-11T22:50:48.120700Z

Yeah, I can’t figure out how to paste it into place like he does in that example. If any one can point me to the action…

2021-02-11T23:13:13.120900Z

@stuartrexking I’m pretty sure that Tony is using a vim plugin with Intellij (I believe it’s IdeaVim) so it could be a vim command that he’s using…

stuartrexking 2021-02-11T23:16:24.121100Z

@alex-eberts I’m using IdeaVim. I’ll ask Tony directly.

1👍
cfleming 2021-02-11T23:35:33.121400Z

Can you show an example of how this works, or link to some doc/examples?

cfleming 2021-02-11T23:38:16.121600Z

Straight up Kill should indeed work, and just normal paste should paste it back wherever you want it.

cfleming 2021-02-11T23:38:46.121800Z

@katox Thanks, I’ll fix that - that’s very strange.

1👍
cfleming 2021-02-11T23:39:21.122Z

(however as reported in another thread, in the very latest build Kill seems to only kill to the end of the line, not the end of the form as it should).

cfleming 2021-02-11T23:39:30.122200Z

That will be fixed in the next build.