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?
... 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.
Been awhile since I used intellij+cursive, gotta remember to give it time to index 🙂
Oh, man, and I remember my biggest beef with ideavim+cursive: paredit doesn't work when using vim commands.
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
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
looks like you are trying to load a .clj
file? hmm or rather that cursive is trying to?
I’ve had this problem for a while now (months?) where I can’t interact with the dialog that shows macroexpansion.
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)
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.
I’m on my Mac laptop right now and just tried. The popup won’t even appear now. I’m getting a different exception.
Could you try to expand this form and see if it does the same thing?
(defn x [a]
(+ 1 a))
Just to have something simple as a baseline.
That one opens the window. The window isn’t intractable. Same error in the logs.
The NPE?
No, yours.
To get mine, I tried macroexpanding my-macro
in a comment form:
(defmacro my-macro
[x]
`(int? ~x))
(comment (my-macro 1))
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?
Great, thanks, let me try that.
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.
Is that like how the test diff opens in a window?
No, it would open in a tab in the REPL toolwindow, like multiple REPL sessions do now.
Oh. That seems wrong haha.
I probably want my active repl session in view while I have the macroexpand.
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?
What’s a new editor?
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.
Like a standard code editor, that would be open in a tab.
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.
Oh, yeah a new editor seems fine. The knobs for configuring the macroexpand go at the top? Kinda like markdown support?
Right, exactly.
So then you could switch to them using “Recent files” and the like too.
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.
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.
Yeah, you’d definitely need some way of marking a repl as active.
I reproduced your issue BTW: https://github.com/cursive-ide/cursive/issues/2510
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.
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.
Oh, interesting. Where would the macroexpand knobs go?
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.
I’ll give that a try, since I’m working on some inlay stuff right now anyway.
If I have something to try I’ll let you know so you can try it out.
Cool. People have been asking for inline for as long as I’ve been using Cursive haha. Seems like a good poc.
Curious what it looks like. Is there a public screenshot somewhere of the code review inline thing?
Yeah, IntelliJ finally has the infrastructure for it. I’m dying to get the test diffs inline too.
https://www.jetbrains.com/help/upsource/discussion-comments.html#posting-comments?
I don’t think that’s it because Upsource is an online tool.
I can’t find one, though.
Oh haha. I thought it’s style didn’t quite match.
Anyway, happy to try it out. Inline seems like a powerful new UI concept. Curious how it’ll work with large data structures.
I’ll let you know when I have something.
Has anyone else experienced this?
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.
I’ll take a look and see if it works for me.
Yes. I’ve had this too.