Fork me on GitHub
#cursive
<
2021-02-19
>
Casey08:02:50

hey there 👋 I'm working with fulcro and pathom using the fulcro-template. Out of the box fulcro's defsc seems recognized as a "def-like" macro. Guardrails' >defn wasn't but using the 💡 popup I could tell Cursive to resolve it as a defn. However, with pathom's defresolver macro in the same file, the 💡 menu only gives me spell checking options. Is there a way to resolve that macro as a defn too?

Casey08:02:07

... and all of a sudden the resolve as option appears. Huh, maybe intellij wasn't done indexing? In any case, its working now, nevermind. Sorry for the noise.

Casey08:02:40

Been awhile since I used intellij+cursive, gotta remember to give it time to index 🙂

Casey08:02:26

Oh, man, and I remember my biggest beef with ideavim+cursive: paredit doesn't work when using vim commands.

Zak Singh09:02:38

Is there any way to deal with these unresolved symbols inside of this defspec macro? I’ve added a symbol resolution to resolve defspec to deftest, and one for prop/for-all to let, but I still get the red squiggly errors

dazld13:02:32

Is View expansion broken for projects using shadow-cljs? I get the following error expanding (identical? {} {})

------ REPL Error while processing ---------------------------------------------
(cljs.core/load-file "/Users/danpeddle/Library/Application Support/JetBrains/IntelliJIdea2020.3/plugins/clojure-plugin/lib/runtime.jar!/cursive/riddley/compiler.clj")
can only load .cljs and .cljc files
{:file-path "/Users/danpeddle/Library/Application Support/JetBrains/IntelliJIdea2020.3/plugins/clojure-plugin/lib/runtime.jar!/cursive/riddley/compiler.clj"}
ExceptionInfo: can only load .cljs and .cljc files
	shadow.cljs.repl/repl-load-file* (repl.clj:290)
	shadow.cljs.repl/repl-load-file* (repl.clj:282)
	shadow.cljs.repl/repl-load-file (repl.clj:330)
	shadow.cljs.repl/repl-load-file (repl.clj:328)
	shadow.cljs.repl/process-read-result (repl.clj:517)
	shadow.cljs.repl/process-read-result (repl.clj:497)
	shadow.cljs.repl/process-input (repl.clj:681)
	shadow.cljs.repl/process-input (repl.clj:659)
	shadow.cljs.devtools.server.worker.impl/eval17164/fn--17167 (impl.clj:754)
	clojure.lang.MultiFn.invoke (MultiFn.java:234)
	shadow.cljs.devtools.server.util/server-thread/fn--16793/fn--16794/fn--16802 (util.clj:284)
	shadow.cljs.devtools.server.util/server-thread/fn--16793/fn--16794 (util.clj:283)
	shadow.cljs.devtools.server.util/server-thread/fn--16793 (util.clj:256)
	java.lang.Thread.run (Thread.java:832)

Error initialising macroexpansion

thheller13:02:10

looks like you are trying to load a .clj file? hmm or rather that cursive is trying to?

favila19:02:55

I’ve had this problem for a while now (months?) where I can’t interact with the dialog that shows macroexpansion.

favila19:02:11

Has anyone else experienced this?

cfleming20:02:52

I haven’t had any reports, but I also don’t use that view much and it’s hard to make automated tests for, so it may be broken.

cfleming20:02:09

I’ll take a look and see if it works for me.

kenny20:02:28

Yes. I’ve had this too.

cfleming23:02:42

I’ve just tried this, and I’m seeing the following exception thrown:

java.lang.StackOverflowError
	at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:471)
	at com.intellij.codeWithMe.ClientIdService$Companion.tryGetInstance(ClientIdService.kt:13)
	at com.intellij.codeWithMe.ClientId$Companion.getCurrentOrNull(ClientId.kt:77)
	at com.intellij.codeWithMe.ClientId$Companion.isCurrentlyUnderLocalId(ClientId.kt:60)
	at com.jetbrains.rdserver.ui.popup.bePopups.impl.BackendBePopupFactory.getChildPopups(BackendBePopupFactory.kt:137)
	at com.intellij.openapi.ui.popup.JBPopupFactory.getChildFocusedPopup(JBPopupFactory.java:208)
	at com.jetbrains.rdserver.ui.popup.bePopups.impl.BackendBePopupFactory.getChildFocusedPopup(BackendBePopupFactory.kt:156)
	at com.intellij.openapi.ui.popup.JBPopupFactory.getChildFocusedPopup(JBPopupFactory.java:212)

cfleming23:02:17

Is that what you are both seeing as well? This must be fairly new since it seems to be a problem with Code With Me, probably trying to share the macroexpand results with other clients.

kenny23:02:11

I’m on my Mac laptop right now and just tried. The popup won’t even appear now. I’m getting a different exception.

cfleming23:02:00

Could you try to expand this form and see if it does the same thing?

(defn x [a]
  (+ 1 a))

cfleming23:02:07

Just to have something simple as a baseline.

kenny23:02:31

That one opens the window. The window isn’t intractable. Same error in the logs.

kenny23:02:57

No, yours.

kenny23:02:33

To get mine, I tried macroexpanding my-macro in a comment form:

(defmacro my-macro
  [x]
  `(int? ~x))

(comment (my-macro 1))

cfleming23:02:42

Ok, thanks. I’m going to have to ask JetBrains about that. Your NPE looks like a bug in the expander code itself. Are you able to share what you were trying to expand?

cfleming23:02:48

Great, thanks, let me try that.

cfleming23:02:47

Do you think it would be ok to open the macroexpander in a toolwindow, perhaps in a tab in the REPL one? I think for Code With Me, they’re planning to automatically sync toolwindows so that might make it easier.

kenny23:02:14

Is that like how the test diff opens in a window?

cfleming23:02:39

No, it would open in a tab in the REPL toolwindow, like multiple REPL sessions do now.

kenny23:02:32

Oh. That seems wrong haha.

kenny23:02:52

I probably want my active repl session in view while I have the macroexpand.

cfleming23:02:54

Yeah, that was what I was thinking. The popups are really a pain though, and not very flexible from a user point of view. Perhaps in a new editor, like the other code editors?

kenny23:02:41

What’s a new editor?

cfleming23:02:51

I’d have to try that and see how it would work. A few people have requested that the REPL itself be shown in an editor tab rather than a toolwindow.

cfleming23:02:07

Like a standard code editor, that would be open in a tab.

cfleming23:02:35

IntelliJ does that for some diffs now, rather than opening them in a new window, although I haven’t managed to figure out when it actually does that.

kenny23:02:41

Oh, yeah a new editor seems fine. The knobs for configuring the macroexpand go at the top? Kinda like markdown support?

cfleming23:02:59

Right, exactly.

cfleming23:02:38

So then you could switch to them using “Recent files” and the like too.

kenny23:02:43

I always work with my repl opened in “Window” View Mode on a separate monitor. Switching to a regular editor tab does seem more general.

cfleming23:02:31

Right, doing that you could have two repls side by side. My one issue with it is it then becomes more confusing which one is “active” when you send forms to it.

kenny23:02:51

Yeah, you’d definitely need some way of marking a repl as active.

kenny23:02:36

The one thing that could be problematic with a new editor for macroexpand is usually you’d want the pre-expanded code in context. If macroexpanding opens you into a new tab, you lose that.

cfleming23:02:46

Yeah, that’s true. I wonder if I could actually do the macroexpansion inline inside the editor with the new inlay stuff - that might be the best option if I can make that work in a non-confusing way.

kenny23:02:26

Oh, interesting. Where would the macroexpand knobs go?

cfleming23:02:14

Inline in the editor itself. IntelliJ uses that itself these days for code review comments in the diff views - you get Swing controls embedded in the editor itself.

cfleming23:02:30

I’ll give that a try, since I’m working on some inlay stuff right now anyway.

cfleming23:02:45

If I have something to try I’ll let you know so you can try it out.

kenny23:02:00

Cool. People have been asking for inline for as long as I’ve been using Cursive haha. Seems like a good poc.

kenny23:02:20

Curious what it looks like. Is there a public screenshot somewhere of the code review inline thing?

cfleming23:02:28

Yeah, IntelliJ finally has the infrastructure for it. I’m dying to get the test diffs inline too.

cfleming23:02:40

I don’t think that’s it because Upsource is an online tool.

cfleming23:02:45

I can’t find one, though.

kenny23:02:06

Oh haha. I thought it’s style didn’t quite match.

kenny23:02:34

Anyway, happy to try it out. Inline seems like a powerful new UI concept. Curious how it’ll work with large data structures.

cfleming23:02:09

I’ll let you know when I have something.

1