Fork me on GitHub

What should I do to debug when cursive is reluctant to resolve as a macro from cljs :refer-macros?


whatever I do, this won’t go away

Ben Grabow04:11:52

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)

Ben Grabow18:11:58

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.

Ben Grabow15:11:34

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.

Ben Grabow21:11:58

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 evals it, so if it has side effects they will happen during compilation.

Ben Grabow21:11:42

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!


No problem, I’m glad it’s working!


Or at least, it’s clear why it’s not working 🙂

Ben Grabow21:11:51

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.

Ben Grabow21:11:34

"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.

Ben Grabow21:11:39

Root of the classpath is typically <project-dir>/src/ right? Probably depends on my :source-paths option in project.clj?


@ben.grabow That’s right.

👍 4

@hadi.pranoto I’ve never used it, sorry, I don’t know where its output goes.

👍 4

@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?


That’s right.


Or you can use Maven or something like that if you prefer.


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