Fork me on GitHub
#cursive
<
2021-02-26
>
Jeff Evans22:02:39

this isn’t Cursive specific, I don’t believe, but I figure people here might know… is it just me, or are all the in-scope vars null when walking up the stack in the IntelliJ debugger? they’re only populated in the bottom-most frame (i.e. directly on the breakpoint). I presume this is a side effect of how the Clojure runtime works, but just in case there’s any sort of optimization level that can be tweaked, that would make debugging a lot more pleasant.

dpsutton22:02:10

check out this article about locals clearing

Jeff Evans22:02:18

whoa, nice. that was easy! guess I just need to run this in the remote REPL just after attaching:

(alter-var-root #'clojure.core/*compiler-options* 
                update :disable-locals-clearing not)

Jeff Evans22:02:27

er, actually, that’s too late… hmm

Jeff Evans22:02:18

I basically need to find some way to run that before everything else gets loaded, I think

dpsutton23:02:40

I thought you just restart the repl with that option set

Jeff Evans23:02:05

well, I’m using a remote REPL in this case

dpsutton23:02:35

Oh I see. Running it in docker or something?

Jeff Evans23:02:55

uh… running lein repl in Metabase 😆

dpsutton23:02:36

Ah. Then just let cursive start it up. Not a remote connection then

Jeff Evans23:02:01

that works some of the time, but not all (ex: driver loading)

dpsutton23:02:43

Then I’m out of cursive knowledge at that point :)

Jeff Evans23:02:36

yeah I think basically if you let Cursive launch it, then it must do this alter-var-root invocation for you

Jeff Evans23:02:38

I suspect there is some way to do it that Clojure just reads, i.e. https://clojure.atlassian.net/browse/CLJ-860

Alex Miller (Clojure team)23:02:23

-Dclojure.compiler.disable-locals-clearing=true

Jeff Evans00:02:21

Thanks, Alex. Exactly what I was hoping for. Will give it a shot on Monday.

Jeff Evans02:02:33

actually, had a chance to try it out tonight, and yeah. this is going to be a game changer. have a nice rest of the weekend!