Fork me on GitHub
#cursive
<
2019-06-25
>
joaohgomes01:06:50

Hey guys, Maybe somebody already asked this: Something that annoys me and I can’t find a way to change the default behavior is when I’m debugging and try to evaluate expression. It works with var bindings, but when I have function calls I get “unable to find symbol in this context”. Apparently the debugger defaults current namespace to clojure.core, which is weird. Found out by evaluating *ns*. I can fix by either prepending namespaces to functions or (in-ns '<namespace>)(<code>). Wondering if there’s a way to reset the default namespace to the currently opened file or some other trick that could help avoid prepending namespaces every time.

4
ignorabilis09:06:58

ok, so thanks to @cfleming I found out that I need to be using tools.deps directly and there's no support for the cli; however when hitting the Refresh button I'm getting locator.getService(RepositorySystem::class.java) must not be null; this is the full exception:

locator.getService(RepositorySystem::class.java) must not be null
java.lang.IllegalStateException: locator.getService(RepositorySystem::class.java) must not be null
	at cursive.artifacts.ArtifactManager.newRepositorySystem(ArtifactManager.kt:86)
	at cursive.artifacts.ArtifactManager.<init>(ArtifactManager.kt:44)
	at cursive.artifacts.ArtifactManager.<init>(ArtifactManager.kt:38)
	at cursive.deps.DepsSystemSettingsControl$$special$$inlined$apply$lambda$5$1.run(DepsSettings.kt:389)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:307)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Let me know if anyone has seen this and what are some possible reasons for that exception

cfleming22:06:05

Oh, I just realised what this might be - do you have the Maven support enabled? It’s possible that there’s a bug there when it’s not.

ignorabilis11:06:40

@cfleming sorry, just realized that you're the right guy to talk to about Cursive 😂; I'm using Intellij only for Clojure (and a tiny bit of Haskell) so I'm not very familiar with Maven; what is that support and how can I make sure that it is enabled?

ignorabilis12:07:20

@cfleming - I'm using intellij only for Clojure projects, so I'm not sure what Maven support enabled means - can you elaborate on that one?

cfleming20:07:45

@U8XSMEQS0 There’s a Maven plugin in IntelliJ - you can go to Settings-&gt;Plugins and make sure it’s enabled, and enable it if it’s not.

ignorabilis12:07:52

@cfleming - it was enabled; disable->enable did not help; however since my intellij has not been updated for some time I've updated it and things are now working, so at least for me this is solved 🙂; thanks again for your help!

sparkofreason16:06:47

Keep getting this exception, results in the REPL being unusable, keeps trying to write over previous output, and only in a limited number of lines.

manutter5117:06:39

Not sure why cursive is blowing up on you, but it looks like it’s reporting a string with “\U” in it (instead of “\\U” possibly?) on line 514 of C:\Users\dave\Projects\Compute\stream-model\customer-dashboard\compute\dashboard.clj. Maybe check that line out?

sparkofreason17:06:58

An exception is being thrown there, so the output is from clojure.

manutter5117:06:42

There’s also an error in the cursive.filters namespace, but I suspect if you find the \U string and replace it with \\U or whatever you want it to be, that will fix the problem

sparkofreason17:06:44

Ah, it's because I'm running in windows, somewhere the path is not being handled correctly.

manutter5117:06:18

That makes sense. It’s reading the path without escaping the backslashes, and boom

manutter5117:06:03

Although it seems odd that it would try to eval the contents of the path as a string, hmmm

manutter5117:06:50

It could be a hard-coded path (or relative path) that’s missing the escaped backslashes.

sparkofreason17:06:14

Don't know for sure, but I'm guessing it has to do with the first line reporting the file in parens, maybe trying to eval that?

manutter5117:06:45

Can you show the code?

sparkofreason22:06:27

The code that's causing the exception? No, though I could see if I can come up with a repro. It was a pretty boring NPE, nothing interesting about the code.

sparkofreason23:06:46

And it happens for any exception, AFAICT

manutter5111:06:43

Hmm, that’s very odd. At this point I would try File -> Invalidate Caches & Restart, and/or re-installing Cursive. Something seems to be in a really weird state.

manutter5111:06:28

I suppose it could also be some kind of weird dependency conflict too.

sparkofreason14:06:50

Cache clear and restart didn't help. It would be interesting if a dependency conflict affected Cursive. I'll try inducing an exception in a different project and see if I can reproduce the errors.

sparkofreason14:06:48

It does not. Wild.

sparkofreason16:06:28

Think I figured it out. There was an alias in the project that explicitly called out clojure 1.10.1 as a dependency. Removing that solved the problem.

cfleming20:06:14

@joaohgomes I’ve seen this from time to time but haven’t been able to reproduce it. So you see this just when evaluating function calls?

joaohgomes21:06:01

Hey. Yes. Only when I’m evaluating function calls that are not part of clojure.core namespace.

joaohgomes21:06:37

This is what happens when I try to eval a fn ….

joaohgomes21:06:21

Thank you for looking into this.

joaohgomes21:06:21

BTW, what is the expected behavior?

cfleming22:06:55

@joaohgomes The expected behaviour is that you should definitely be able to call your function 🙂

cfleming22:06:57

I’ll see if I can repro that, I haven’t tried again recently.

👍 4
hlship20:06:35

Since upgrading to 1.8.2-eap-2019.1 and 2019.1.3 I'm having a problem on my epically large project where Cursive marks virtually evertything in a namespace as undefined, even things like defn, and all my imports are marked as unused. I fixed it the first time by restarting and clearing indexes, can't keep doing that though!

hlship22:06:35

This is happening consistently, even on other projects I'm loading. I have to restart and invalidate caches.

hlship22:06:41

Just invalidating isn't enough.

hlship22:06:42

And even that isn't always working.

sparkofreason22:06:53

Same thing is happening to me.

cfleming22:06:40

@U04VDKC4G @U066LQXPZ This is https://github.com/cursive-ide/cursive/issues/2173, which is caused by an underlying platform issue https://youtrack.jetbrains.com/issue/IDEA-211736. Usually restarting will fix the problem temporarily, but the only definitive solution is to downgrade to 2018.3.

cfleming22:06:07

JetBrains said this should be fixed soon and released in a 2019.1 patch, but I haven’t heard from them in a while.

🙏 4
jvtrigueros15:07:01

I just got hit by this one during my morning commute! Is the "fix" to downgrade IntelliJ or Cursive or both?

cfleming20:07:49

@U0JAE119P You can downgrade IntelliJ to 2018.3, and that will fix the problem. The problem is also often temporarily fixed by just restarting IntelliJ.

👍 4
kidpollo22:06:54

Have smaller projects troll

jvtrigueros23:06:22

Do you have any Java code? That was happening to me, I had to run lein javac externally.

jvtrigueros23:06:30

Perhaps a different issue.