This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-08
Channels
- # 100-days-of-code (1)
- # admin-announcements (1)
- # aleph (1)
- # announcements (9)
- # beginners (125)
- # cider (1)
- # cljs-dev (80)
- # cljsrn (2)
- # clojure (82)
- # clojure-czech (1)
- # clojure-dev (5)
- # clojure-finland (1)
- # clojure-italy (16)
- # clojure-nl (6)
- # clojure-spec (24)
- # clojure-uk (39)
- # clojurescript (35)
- # community-development (49)
- # core-async (3)
- # cursive (31)
- # data-science (17)
- # datomic (21)
- # emacs (5)
- # fulcro (92)
- # graphql (1)
- # jobs (2)
- # lambdaisland (1)
- # leiningen (19)
- # luminus (9)
- # off-topic (21)
- # parinfer (6)
- # pedestal (1)
- # portkey (2)
- # re-frame (12)
- # reagent (8)
- # reitit (4)
- # shadow-cljs (117)
- # spacemacs (5)
- # specter (4)
- # sql (2)
- # testing (2)
- # tools-deps (3)
- # vim (1)
What should I do to debug when cursive is reluctant to resolve as
a macro from cljs :refer-macros
?
Asked in #beginners, and sharing here at @seancorfield's suggestion. Is there a way I can prevent eval of my core.clj file when starting a REPL?
You can add :repl-options {:init-ns user}
in your project.clj to load a different namespace (it’s ok if that ns doesn’t exist)
Hmm, I get an error when I start the REPL with that option:
Never mind, the error was coming from something wrong in my Run Configuration.
im using [org.clojure/tools.logging "0.4.1"] on intellij cursive but log/info doesnt show the log. any idea?
I have a project that uses java logging and it doesn't output in the repl window either. What I generally do is start the app from the command-line in the IntelliJ terminal window (or an external terminal) and then connect to it with a remote nrepl connection. Console logging then appears in the terminal window.
Is there a way to have cursive use IntelliJ for the classpath, environment vars, and jvm args?
@ben.grabow Cursive doesn’t load anything like that. Depending on how you run your REPL, your build tool may do depending how how it’s configured.
I created my project from the command line with "lein new app <project-name>" then I "Open"ed the project.clj in Cursive and "open as project". Then I "Run 'REPL for <project>'" from the application Run menu. Here's my run config and project.clj.
I have been working in my <project>/core.clj file. I think lein is compiling my :main namespace, and in the process evals the code I'm working on (which is what I want to avoid). It looks like I can prevent this by setting the project.clj option :main nil
.
@ben.grabow Yes, that makes sense. In Clojure, compiling a namespace effectively eval
s it, so if it has side effects they will happen during compilation.
Makes sense. And I see now that if I run lein repl
from a shell at my project directory I get the same behavior, so obviously not a Cursive-specific thing. Thanks so much for your responses, and all your work on Cursive of course!
Is there a way to "load current namespace in repl" automatically when the repl starts? The hooks in the Run Configuration looked like they all apply prior to the repl starting.
"Switch REPL NS to current file" is what I mean, in the Tools > REPL menu
The problem is that it isn’t always clear what the current namespace or file is when you run a REPL. You can do this with a user.clj
file at the Clojure level, rather than in Cursive. Since the default namespace in the REPL is user
, if you have a user.clj
file at the root of the classpath it will be eval’ed when you start your REPL, and you can do what you like in there.
Root of the classpath is typically <project-dir>/src/ right? Probably depends on my :source-paths
option in project.clj
?
@didibus Do you mean when running a REPL? Yes, the “Use nREPL in normal JVM process” option will do that, or in very recent EAP versions select the REPL type you need and “IntelliJ” under “How to run it”
Hum, oh okay. So with that options, I do not need a deps.edn, or project.clj, or anything like that. I can just configure my IntelliJ project dependencies within itself and it will work?
I've have a problem using clj-pdf
library in cursive. Any require sentence for clj-pdf.core
namespace will show an error claiming circular dependencies. However if I require the same namespace in REPL with (require 'clj-pdf.core)
it works fine.
@roklenarcic I’ll take a look at that