Fork me on GitHub
#cursive
<
2020-08-14
>
ashk07:08:52

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

thheller10:08:46

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

ashk11:08:23

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!

cfleming00:08:22

I can’t see how Cursive would ever cause that behaviour. Have you tried disabling the rainbow brackets plugin? Cursive actually has its own rainbow brackets (Preferences | Languages &amp; Frameworks | Clojure | Appearance options | Rainbow parentheses) so you shouldn’t need that.

👍 1
ashk01:08:19

Well this is embarrassing, I had mapped the [ to “wrap with []“… foolish, but I think my thoughts were that this would apply to vims command mode only disabled the idea key mapping and all is well now thanks @thheller & @cfleming

cfleming02:08:18

No worries, glad it’s working 🙂

alexmiller15:08:21

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

alexmiller15:08:32

that was fixed in tools.deps 0.8.709 / clj 1.10.1.561

alexmiller15:08:05

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.

kenny15:08:59

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

alexmiller15:08:04

not sure what happens in the nrepl case in intelllij

alexmiller15:08:19

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

alexmiller16:08:01

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

kenny16:08:05

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

alexmiller16:08:06

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

cfleming22:08:02

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-&gt;Project Structure-&gt;Modules-&gt;&lt;some module&gt;-&gt;Dependencies.

cfleming22:08:32

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.

kenny16:08:48

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.

kenny16:08:18

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

alexmiller16:08:31

you are past my level of knowledge on the calculating thing

1
kenny16:08:25

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

alexmiller16:08:28

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
kenny16:08:47

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

kenny16:08:47

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.

kenny16:08:09

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

alexmiller16:08:29

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

kenny16:08:46

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

marciol17:08:47

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.

cfleming22:08:58

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?

alexmiller17:08:30

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

frozenlock17:08:11

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

cfleming23:08:35

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

cfleming23:08:37

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.

frozenlock15:08:27

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

Pavel Klavík23:08:22

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

Pavel Klavík23:08:22

Exception in thread "XNIO-1 I/O-3" java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 start byte 0xf8
 at [Source: [email protected]; 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: [email protected]; 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: [email protected]; 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: [email protected]; 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

Pavel Klavík23:08:22

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

Pavel Klavík23:08:30

Any idea what could be causing this?