Hi all, i’m a cursive + ideavim user 🙂 Just wondering if anyone can help me: i’m trying my darnedest type this into the editor:
(d/q {:query '[:find ?e
:where [?e :artist/name "The Beatles"]]
:args [db]})
But I’m having difficulty with the ’[ syntax@ashk I also use cursive + ideavim and have no such issue. I'm also using paredit though. do you maybe have any other plugin active that tries to handle parens? I think there are some?
i’ve disabled vim emulation and it’s still happening…. I’ve just got the cursive & rainbow brackets installed. I think i’m on a EAP build.. i might try a fresh install of cursive thanks @thheller!
When calling datomic.client.api/client
, I get this exception:
Syntax error (FileNotFoundException) compiling at (datomic/client/impl/shared.clj:1:1).
Could not locate cognitect/hmac_authn__init.class, cognitect/hmac_authn.clj or cognitect/hmac_authn.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
That namespace is provided by the com.cognitect/hmac-authn
dep. I can call clj -A:<all my aliases> -Stree -Sforce
and see that hmac-authn is being brought in by com.datomic/dev-local 0.9.184
. In the Clojure Deps panel under my project's Dependencies, I do not see hmac-authn under dev-local. I have Cursive set to use CLI tools under Clojure Deps. My clojure CLI version is 1.10.1.561. My Cursive version is 1.9.4-eap2-2020.2. This occurs in a REPL configured to use nREPL ran with the IntelliJ project classpath. I have tried restarting the REPL, hitting the Clojure Deps refresh button, and restarting my computer. Any idea why this would happen?@kenny If you manually refresh your project using the button in the deps toolwindow, does that fix that problem using the deps CLI?
No.
I spent some time looking at this, I can’t reproduce it and nor do I have a plausible explanation for how it might occur. I created this test repo, could you try it and see if it reproduces the problem for you? https://github.com/cursive-ide/deps-problem-repro
Okay I have a smaller repro here: https://github.com/kennyjwilli/deps-problem-repro. For whatever reason, if I remove any other deps from the deps.edn, the call will succeed. I added an example namespace with a single call in a comment block. A "successful" call will look like this:
(d/client {:endpoint "",
:server-type :ion,
:region "",
:system "",})
2020-08-16 11:49:43.136:INFO::main: Logging initialized @22704ms to org.eclipse.jetty.util.log.StdErrLog
Execution error (ExceptionInfo) at datomic.client.impl.cloud/parse-endpoint (cloud.clj:75).
Invalid endpoint
A failed call will look like this.
(d/client {:endpoint "",
:server-type :ion,
:region "",
:system "",})
Syntax error (FileNotFoundException) compiling at (datomic/client/impl/shared.clj:1:1).
Could not locate cognitect/hmac_authn__init.class, cognitect/hmac_authn.clj or cognitect/hmac_authn.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
When running the REPL with "Run with IntelliJ project classpath" and the test alias checked, I will get a failed call. When running the same call in a terminal started via the REPL I get a successful call.
clojure -A:test
Clojure 1.10.1
user=> (require 'example)
nil
user=> (in-ns 'example)
#object[clojure.lang.Namespace 0x218e28d9 "example"]
example=> (d/client {:endpoint "",
:server-type :ion,
:region "",
:system "",})
2020-08-16 11:49:43.136:INFO::main: Logging initialized @22704ms to org.eclipse.jetty.util.log.StdErrLog
Execution error (ExceptionInfo) at datomic.client.impl.cloud/parse-endpoint (cloud.clj:75).
Invalid endpoint
I did notice that when calling clj -Stree -A:test
, the hmac-authn dep comes from dev-local. In Cursive's dependency tree in Clojure Deps, it comes from client-cloud.
Both are the same version so I wouldn't expect a different behavior.
The dev-local part of -Stree
com.datomic/dev-local 0.9.184
com.google.errorprone/error_prone_annotations 2.3.4
com.datomic/client-api 0.8.54
com.google.guava/listenablefuture 9999.0-empty-to-avoid-conflict-with-guava
com.datomic/client 0.8.111
com.cognitect/http-client 0.1.105
org.eclipse.jetty/jetty-client 9.4.27.v20200227
org.checkerframework/checker-compat-qual 2.5.5
com.google.guava/failureaccess 1.0.1
com.google.guava/guava 28.2-android
com.datomic/client-impl-shared 0.8.80
com.cognitect/hmac-authn 0.1.195
com.google.j2objc/j2objc-annotations 1.3
com.datomic/query-support 0.8.27
org.fressian/fressian 0.6.5
com.google.code.findbugs/jsr305 3.0.2
org.ow2.asm/asm-all 4.2
Switching the Clojure Deps setting to "Use tools.deps" directly with 0.9.763 selected and restarting IntelliJ fixes the issue. Seems like there's some sort of bug in the most recent Clojure CLI + Cursive.
there was a dependency bug related to this scenario in tools.deps / clj
that was fixed in tools.deps 0.8.709 / clj 1.10.1.561
the bug here relates to having the same dep being included via two dependency paths where it's excluded in one and included in another (was previously somewhat arbitrary which branch you encountered first whether you'd get it). as of those versions above, you should always get it.
Oh, so I assume Cursive needs to make some change to work correctly with the fix?
not sure what happens in the nrepl case in intelllij
running it as a deps project with system clj should work based on what you have
intellij has been updated in the version you have to cover recent changes in clj
Ah, selecting "Run with Deps" in the run config?
yeah
re "the IntelliJ project classpath" - I think that's an independent thing sourced from your deps, not sure I understand exactly how it's managed
Basically, when you sync a project to IntelliJ, it adds all the deps to the project and indexes them. That’s what you see under “External Libraries” in the project view, or in more detail under File->Project Structure->Modules-><some module>->Dependencies.
Run with IntelliJ project classpath just uses those deps as well as the source roots etc to make the classpath. In a deps project, this should be the same as using Run with Deps, with the caveat that you’re implicitly using the aliases which were used to sync the project.
Each time I start a REPL with the "Run with Deps" option, Cursive will run a "Calculating Classpath" step that takes a solid 5s or so. The IntelliJ project classpath appears to use some sort of caching to avoid that step.
"Run with Deps" also does not encounter the problem.
you are past my level of knowledge on the calculating thing
It sounds like whatever machinery IntelliJ project classpath uses requires some sort of change to work correctly with the latest cli version.
don't know, that's a question for Colin. of course it's like 4 am Sat morning his time so he's probably won't see this for a bit :)
The Run with Deps option fixes my problem so I'll use that. Thanks 🙂
Actually, that's not true. I didn't add any aliases to my "Run with Deps" selection. After adding in the alias that has dev-local, I get the same FileNotFound exception.
The only method that works is selecting "Use tools.deps directly".
that doesn't make sense to me, as I would expect using clj 1.10.1.561 to work
I would agree. Directly using the CLI works as expected.
Hi @cfleming, I’m wondering if it’s possible to add some niceties in the cursive REPL, such as a way to fold and unfold large EDNs, and to add some kind of scrolling to exceptions. I suspect that this is not so easy to do given the Intellij constraints, but it’d be nice to know at first hand.
The folding of large EDNs might be possible (I assume you’re talking about eval results, right?) and I have some plans along those lines. I’m not sure what you mean by “scrolling to exceptions” - can you elaborate?
there are some options under Preferences -> Languages & Frameworks -> Clojure like "Prettify stacktrace elements using folding" - did you try that?
Hello, I have some co-workers using Cursive and apparently the static analysis doesn't work with modified defn forms. Is it something that can be configured?
(defn-spec my-inc
:args any?
:ret any?
[x]
(inc x))
Sort of. If your macro can be made to look like one of the built-in ones, then you can tell Cursive to treat it as the built-in like this: https://cursive-ide.com/userguide/macros.html#customising-symbol-resolution
Your example there won’t work, because defn
doesn’t accept forms before the arglist. However, see https://github.com/gnl/ghostwheel for an example of how that macro might look to be able to work with Cursive.
Ah I see. It's unfortunate it cannot work with the current form, but thank you for providing the ghostwheel example.
Nice @alexmiller
Hi, I am getting the following error in Shadow-cljs when evaluating a string with UTF-8 characters in nREPL:
Exception in thread "XNIO-1 I/O-3" java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 start byte 0xf8
at [Source: java.io.ByteArrayInputStream@78fae8d5; line: 1, column: 92]
at com.cognitect.transit.impl.ReaderFactory$ReaderImpl.read(ReaderFactory.java:114)
at cognitect.transit$read.invokeStatic(transit.clj:319)
at cognitect.transit$read.invoke(transit.clj:315)
at shadow.cljs.devtools.server.common$fn__14808$fn__14809.invoke(common.clj:47)
at clojure.core$map$fn__5862$fn__5863.invoke(core.clj:2742)
at clojure.core.async.impl.channels$chan$fn__872.invoke(channels.clj:300)
at clojure.core.async.impl.channels.ManyToManyChannel.put_BANG_(channels.clj:83)
at clojure.core.async$put_BANG_.invokeStatic(async.clj:199)
at clojure.core.async$put_BANG_.invoke(async.clj:187)
at shadow.undertow$fn$reify__16240$handler_fn__16241.invoke(undertow.clj:314)
at shadow.undertow.WsTextReceiver.onFullTextMessage(WsTextReceiver.java:20)
at io.undertow.websockets.core.AbstractReceiveListener$2.complete(AbstractReceiveListener.java:156)
at io.undertow.websockets.core.AbstractReceiveListener$2.complete(AbstractReceiveListener.java:152)
at io.undertow.websockets.core.BufferedTextMessage.read(BufferedTextMessage.java:105)
at io.undertow.websockets.core.AbstractReceiveListener.readBufferedText(AbstractReceiveListener.java:152)
at io.undertow.websockets.core.AbstractReceiveListener.bufferFullMessage(AbstractReceiveListener.java:90)
at io.undertow.websockets.core.AbstractReceiveListener.onText(AbstractReceiveListener.java:70)
at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:44)
at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:33)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:952)
at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:932)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
Caused by: com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 start byte 0xf8
at [Source: java.io.ByteArrayInputStream@78fae8d5; line: 1, column: 92]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidInitial(UTF8StreamJsonParser.java:3544)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidChar(UTF8StreamJsonParser.java:3538)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishString2(UTF8StreamJsonParser.java:2543)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishAndReturnString(UTF8StreamJsonParser.java:2469)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.getText(UTF8StreamJsonParser.java:315)
at com.cognitect.transit.impl.JsonParser.parseVal(JsonParser.java:60)
at com.cognitect.transit.impl.JsonParser.parseMap(JsonParser.java:112)
at com.cognitect.transit.impl.JsonParser.parseArray(JsonParser.java:128)
at com.cognitect.transit.impl.JsonParser.parseVal(JsonParser.java:56)
at com.cognitect.transit.impl.JsonParser.parse(JsonParser.java:46)
at com.cognitect.transit.impl.ReaderFactory$ReaderImpl.read(ReaderFactory.java:112)
... 25 more
Exception in thread "XNIO-1 I/O-4" java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 start byte 0xf8
at [Source: java.io.ByteArrayInputStream@668568cb; line: 1, column: 92]
at com.cognitect.transit.impl.ReaderFactory$ReaderImpl.read(ReaderFactory.java:114)
at cognitect.transit$read.invokeStatic(transit.clj:319)
at cognitect.transit$read.invoke(transit.clj:315)
at shadow.cljs.devtools.server.common$fn__14808$fn__14809.invoke(common.clj:47)
at clojure.core$map$fn__5862$fn__5863.invoke(core.clj:2742)
at clojure.core.async.impl.channels$chan$fn__872.invoke(channels.clj:300)
at clojure.core.async.impl.channels.ManyToManyChannel.put_BANG_(channels.clj:83)
at clojure.core.async$put_BANG_.invokeStatic(async.clj:199)
at clojure.core.async$put_BANG_.invoke(async.clj:187)
at shadow.undertow$fn$reify__16240$handler_fn__16241.invoke(undertow.clj:314)
at shadow.undertow.WsTextReceiver.onFullTextMessage(WsTextReceiver.java:20)
at io.undertow.websockets.core.AbstractReceiveListener$2.complete(AbstractReceiveListener.java:156)
at io.undertow.websockets.core.AbstractReceiveListener$2.complete(AbstractReceiveListener.java:152)
at io.undertow.websockets.core.BufferedTextMessage.read(BufferedTextMessage.java:105)
at io.undertow.websockets.core.AbstractReceiveListener.readBufferedText(AbstractReceiveListener.java:152)
at io.undertow.websockets.core.AbstractReceiveListener.bufferFullMessage(AbstractReceiveListener.java:90)
at io.undertow.websockets.core.AbstractReceiveListener.onText(AbstractReceiveListener.java:70)
at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:44)
at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:33)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:952)
at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:932)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
Caused by: com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 start byte 0xf8
at [Source: java.io.ByteArrayInputStream@668568cb; line: 1, column: 92]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidInitial(UTF8StreamJsonParser.java:3544)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidChar(UTF8StreamJsonParser.java:3538)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishString2(UTF8StreamJsonParser.java:2543)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._finishAndReturnString(UTF8StreamJsonParser.java:2469)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.getText(UTF8StreamJsonParser.java:315)
at com.cognitect.transit.impl.JsonParser.parseVal(JsonParser.java:60)
at com.cognitect.transit.impl.JsonParser.parseMap(JsonParser.java:112)
at com.cognitect.transit.impl.JsonParser.parseArray(JsonParser.java:128)
at com.cognitect.transit.impl.JsonParser.parseVal(JsonParser.java:56)
at com.cognitect.transit.impl.JsonParser.parse(JsonParser.java:46)
at com.cognitect.transit.impl.ReaderFactory$ReaderImpl.read(ReaderFactory.java:112)
... 25 more
If I evaluate it from REPL in terminal, everything works fine.
Any idea what could be causing this?