This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-24
Channels
- # announcements (3)
- # beginners (128)
- # boot (2)
- # braveandtrue (97)
- # calva (13)
- # cider (4)
- # cljdoc (12)
- # cljs-dev (16)
- # clojure (78)
- # clojure-germany (8)
- # clojure-italy (5)
- # clojure-nl (1)
- # clojure-spec (59)
- # clojure-uk (29)
- # clojurescript (46)
- # core-async (9)
- # cursive (63)
- # data-science (3)
- # datomic (22)
- # devcards (1)
- # duct (7)
- # emacs (4)
- # flambo (2)
- # fulcro (37)
- # instaparse (6)
- # jobs-discuss (38)
- # juxt (1)
- # off-topic (35)
- # om-next (1)
- # parinfer (7)
- # re-frame (14)
- # reagent (6)
- # reitit (21)
- # rum (1)
- # shadow-cljs (74)
- # spacemacs (8)
- # specter (1)
- # sql (3)
- # testing (2)
- # unrepl (2)
- # yada (6)
I have a user.clj
on the classpath that does this:
(ns user
(:require
[clojure.spec.alpha :as s]
[expound.alpha :as expound]))
(set! s/*explain-out* expound/printer)
When I start a REPL I get this:
Exception in thread "main" java.lang.ExceptionInInitializerError
at clojure.main.<clinit>(main.java:20)
Caused by: java.lang.IllegalStateException: Can't change/establish root binding of: *explain-out* with set, compiling:(user.clj:6:1)
at clojure.lang.Compiler.load(Compiler.java:7526)
at clojure.lang.RT.loadResourceScript(RT.java:379)
at clojure.lang.RT.loadResourceScript(RT.java:366)
at clojure.lang.RT.maybeLoadResourceScript(RT.java:362)
at clojure.lang.RT.doInit(RT.java:482)
at clojure.lang.RT.<clinit>(RT.java:336)
... 1 more
Caused by: java.lang.IllegalStateException: Can't change/establish root binding of: *explain-out* with set
at clojure.lang.Var.set(Var.java:223)
at user$eval708.invokeStatic(user.clj:6)
at user$eval708.invoke(user.clj:6)
at clojure.lang.Compiler.eval(Compiler.java:7062)
at clojure.lang.Compiler.load(Compiler.java:7514)
Any idea why? Perhaps because the nREPL hasn't connected yet?@raymcdermott There’s nothing lein-specific about it, but it does rely on nREPL (for the moment). If you use a clojure.main REPL it won’t work, but if you use “Use nREPL in normal JVM process” it should work.
@kenny I’m not sure - do you get that running it outside Cursive as well? Is that with deps or lein?
it is nrepl
s/*explain-out*
is a dynamic variable. to be able to set! it, it must have been bound in a binding
somewhere higher on the stack. The clojure.main repl does this, nrepl does not.
https://github.com/clojure/clojure/blob/master/src/clj/clojure/main.clj#L85
in some cases (alter-var-root #'s/*explain-out* (constantly expound/printer))
may work better for you
@alexmiller Interesting, thanks for the explanation.
@cfleming I must have missed the news that you can use a standard nREPL with a deps.edn project. Thanks - it’s working great again
deps.edn can be used to run Clojure programs and an nrepl client is just a program
@llsouder I mostly use the defaults, with a few extra mappings and some remapped to avoid conflicts on MacOS; I also use the Vim plugin, and that's how I tend to navigate - I don't use the sexpr-jumping chords. I find that it works well.
Just those that are REPL-related - switching between REPL and editor window, reloading and syncing, sending form under caret for eval (though the last one might just be mapped by default). I also have test integration set up, but again that might be coming in through the default settings. I haven't changed things in there in a long time, and the Keymap has improved dramatically compared to what the situation was just a couple of years ago.
@alexmiller - yeah, sorry I meant specifically nREPL with #cursive
@cfleming how the classpath is being calculated for the local nREPL and clojure.main run configurations in a deps project?
btw, in the clojure.main case, the -classpath
is not double-quoted, but in the nREPL case it is.
i just noticed it when i copy-pasted the repl command lines into a scratch and it got syntax-highlighted differently
nREPL case:
/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=55773:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk-10.0.2
...
:/Users/onetom/Library/Application Support/IntelliJIdea2018.2/clojure-plugin/lib/tools.nrepl-0.2.12.jar" clojure.main -i /private/var/folders/5m/ssz2l6_n7z74d31b2q5wbfl00000gn/T/form-init5295767744484685351.clj
clojure.main case:
/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=56747:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk-9.0.1
...
:/Users/onetom/.m2/repository/org/clojure/data.priority-map/0.0.7/data.priority-map-0.0.7.jar clojure.main -r
just saying, because maybe the clojure.main case might need some shell escaping... unless there is some magical reason why are they quoted differently
question for a coworker: how can one prevent cursive from indexing a really big edn file? He's getting stack overflow errors
maybe move it into its own folder, then right click the folder and select Mark Directory As -> Excluded — probably not ideal, but I believe that will work
Yeah it took me almost a year to figure out I could Exclude the logs
directory. “Find In Project” is a LOT less spammy now.
awesome. we were looking around in context menus but always by file and not on the directory. thanks a bunch
Hi I recently upgraded intellij to the latest version and I can no longer see the leiningen tool window, nor run my clojure project. I'm running cursive 1.7.0-2018.2 and leiningen plugin 0.0.3. Any ideas?
Maybe try File -> Invalidate Caches & Restart?
Wait, Leiningen plugin? Cursive does its own lein stuff, you shouldn’t need a separate plugin and I would think having one might be a problem
Yeah, I’m pretty sure you want that one turned off
I see rebel-readline
in classpath for REPL, but I can't figure where it comes from. The project is deps.edn
one, and I do have rebel-readline-cljs
in :extra-deps
for some of the aliases, but not in default :deps
.
Is it very deep, i.e. lots of structures nested to a really deep level? I’d be interested to see the stacktrace for the SOE
@dealy Yes, you have to remove the Leiningen plugin, it’s very old and Cursive’s support is much more sophisticated (and was based on that plugin a long long time ago, with the authors’ blessing).
@dottedmag You can see the dependency tree in the deps toolwindow so you can see how it’s being pulled in.
5600 lines of #:db{:ident :breeze.Immunization/status, :valueType #:db{:id 20}, :cardinality #:db{:id 35}}
and similar
If you could email a copy of the SOE stacktrace, it would be much appreciated. Is it possible that the SOE was actually provoked by some other file in the project, especially a CLJC one?
There’s at least one SOE fixed in the latest EAP - are they on the EAP or the latest stable?
@cfleming Oh, I see some of aliases checked, but I don't remember checking them. Thanks.