cursive

Issues at: https://git.io/cursive-issues
2020-08-14T07:58:52.034300Z

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

thheller 2020-08-14T10:58:46.035700Z

@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?

2020-08-14T11:13:23.037700Z

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!

kenny 2020-08-14T15:35:25.041600Z

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?

cfleming 2020-08-15T22:47:38.083100Z

@kenny If you manually refresh your project using the button in the deps toolwindow, does that fix that problem using the deps CLI?

kenny 2020-08-16T00:55:03.084800Z

No.

cfleming 2020-08-16T04:54:23.085Z

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

kenny 2020-08-16T18:52:41.086300Z

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

kenny 2020-08-16T18:54:21.086600Z

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.

kenny 2020-08-16T18:54:50.086800Z

Both are the same version so I wouldn't expect a different behavior.

kenny 2020-08-14T15:38:11.041800Z

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

kenny 2020-08-14T15:44:27.042100Z

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.

alexmiller 2020-08-14T15:54:21.042600Z

there was a dependency bug related to this scenario in tools.deps / clj

alexmiller 2020-08-14T15:55:32.043Z

that was fixed in tools.deps 0.8.709 / clj 1.10.1.561

alexmiller 2020-08-14T15:57:05.044500Z

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.

kenny 2020-08-14T15:57:59.045400Z

Oh, so I assume Cursive needs to make some change to work correctly with the fix?

alexmiller 2020-08-14T15:59:04.046400Z

not sure what happens in the nrepl case in intelllij

alexmiller 2020-08-14T15:59:19.046800Z

running it as a deps project with system clj should work based on what you have

alexmiller 2020-08-14T16:00:01.047700Z

intellij has been updated in the version you have to cover recent changes in clj

kenny 2020-08-14T16:00:05.047800Z

Ah, selecting "Run with Deps" in the run config?

alexmiller 2020-08-14T16:00:12.048Z

yeah

alexmiller 2020-08-14T16:01:06.048500Z

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

cfleming 2020-08-15T22:54:02.083300Z

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.

cfleming 2020-08-15T22:55:32.083500Z

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.

kenny 2020-08-14T16:03:48.049900Z

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.

kenny 2020-08-14T16:04:18.050300Z

"Run with Deps" also does not encounter the problem.

alexmiller 2020-08-14T16:04:31.050700Z

you are past my level of knowledge on the calculating thing

1
kenny 2020-08-14T16:05:25.051600Z

It sounds like whatever machinery IntelliJ project classpath uses requires some sort of change to work correctly with the latest cli version.

alexmiller 2020-08-14T16:06:28.052600Z

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 :)

1
kenny 2020-08-14T16:07:47.053500Z

The Run with Deps option fixes my problem so I'll use that. Thanks 🙂

kenny 2020-08-14T16:16:47.054300Z

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.

kenny 2020-08-14T16:20:09.054700Z

The only method that works is selecting "Use tools.deps directly".

alexmiller 2020-08-14T16:24:29.055200Z

that doesn't make sense to me, as I would expect using clj 1.10.1.561 to work

kenny 2020-08-14T16:26:46.055800Z

I would agree. Directly using the CLI works as expected.

marciol 2020-08-14T17:19:47.059Z

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.

cfleming 2020-08-15T22:57:58.083800Z

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?

alexmiller 2020-08-14T17:42:30.059700Z

there are some options under Preferences -> Languages & Frameworks -> Clojure like "Prettify stacktrace elements using folding" - did you try that?

2020-08-14T17:49:11.062Z

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))

cfleming 2020-08-15T23:00:35.084Z

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

cfleming 2020-08-15T23:01:37.084300Z

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.

2020-08-16T15:49:27.085900Z

Ah I see. It's unfortunate it cannot work with the current form, but thank you for providing the ghostwheel example.

marciol 2020-08-14T17:57:14.062300Z

Nice @alexmiller

2020-08-14T23:25:22.063500Z

Hi, I am getting the following error in Shadow-cljs when evaluating a string with UTF-8 characters in nREPL:

2020-08-14T23:25:22.063600Z

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

2020-08-14T23:25:22.063700Z

If I evaluate it from REPL in terminal, everything works fine.

2020-08-14T23:25:30.063900Z

Any idea what could be causing this?