Fork me on GitHub
#cursive
<
2018-11-08
>
sooheon00:11:12

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

sooheon00:11:41

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?

csm05:11:37

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.

Hadi04:11:51

im using [org.clojure/tools.logging "0.4.1"] on intellij cursive but log/info doesnt show the log. any idea?

timgilbert15:11:55

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.

didibus04:11:44

Is there a way to have cursive use IntelliJ for the classpath, environment vars, and jvm args?

cfleming07:11:24

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

cfleming21:11:42

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

cfleming21:11:34

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

cfleming21:11:04

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

cfleming21:11:05

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?

cfleming22:11:29

@ben.grabow That’s right.

👍 1
cfleming07:11:00

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

👍 1
cfleming07:11:11

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

didibus08:11:29

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?

cfleming08:11:50

That’s right.

cfleming08:11:41

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

roklenarcic12:11:49

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.

cfleming21:11:30

@roklenarcic I’ll take a look at that