Fork me on GitHub
#cursive
<
2015-10-15
>
bbss02:10:38

@cfleming: I have been using cursive for a while now and love it. But I've now run in to a bug I think. might have started at one of the more recent EAP builds. I noticed my debug configurations don't use the most recent project.clj file and now see that I don't have the "Synchronize leinigen project" pre launch step. Any idea if there is something I missed?

cfleming02:10:47

@bbss: The pre launch step is still there, it’s just not enabled by default.

cfleming02:10:00

So you can re-add it if required.

cfleming02:10:18

What sort of debug configurations do you mean?

bbss02:10:54

Actually right now doing it with this way, also figwheel but different script: https://github.com/omcljs/om/wiki/Components%2C-Identity-%26-Normalization

cfleming02:10:36

Ok, and it’s not picking up changes to your project.clj?

bbss02:10:07

Is it supposed to be there?

cfleming02:10:47

When you make changes there, they are not synced to your project automatically. You need to either run the action Refresh Leiningen Projects, or hit the refresh button in the leiningen toolwindow after making changes.

cfleming02:10:26

I’ll check why that’s not working.

cfleming02:10:59

@bbss would you mind filing an issue for that?

bbss03:10:26

Okay I will later today

cfleming03:10:38

Thanks, I’ll look to fix that for the next build.

bbss03:10:44

I've hit the refresh leinigen projects button but it doesn't seem to work

cfleming03:10:16

So you’ve added a new dependency to your project?

cfleming03:10:44

@bbss: Once you’ve hit the refresh button and it’s finished syncing, open Project Structure (Cmd-;), and check Modules->(your module)->Dependencies and check whether the new dependency shows up there.

bbss03:10:36

@cfleming: It does show up

cfleming03:10:26

@bbss: So if you stop and restart your REPL process, it should then have that dependency on the classpath.

cfleming03:10:56

Your Unnamed REPL config in that screenshot, is that a local or remote one?

cfleming03:10:16

Ok, sorry, I hadn’t read the second link you sent. So you’re actually running a local REPL using Leiningen?

bbss03:10:12

I have tried both, but it seems fixed!

bbss03:10:22

Don't have the pre launch step though

cfleming03:10:17

Ok. That should still work, but you don’t need it if you’re running with lein.

cfleming03:10:39

This is because the lein REPL reads the project.clj from disk to build the classpath every time you run it.

bbss03:10:08

I am doing the bottom option of run via clojure.main in normal jvm

cfleming03:10:34

Ok, in that case you do want it.

cfleming03:10:08

If you can file that issue, I’ll check why that’s not working and fix it. In the meantime, manually syncing after changes should work.

bbss03:10:57

Yeah I'll file an issue. Thanks!

cfleming03:10:23

No worries, sorry for the hassle!

bbss03:10:55

No problem, still have to learn more about what is going on under the hood anyway, so this is kind of hassle is educational as I am rather new to the JVM and clojure.

cfleming03:10:29

I also need to write up how the classpath calculation works for the various different REPL types, since it’s very confusing.

bbss03:10:48

That would be interesting.

cfleming03:10:13

Here’s the executive summary:

cfleming03:10:59

For the Run nREPL with lein option, Leiningen always calculates the classpath and IntelliJ really has nothing to do with it. In theory this should be exactly what you get with lein itself.

cfleming03:10:53

So for that you don’t need the Sync before-run task, since lein always reads the file from disk and IntelliJ should save it automatically on run.

cfleming03:10:47

The other two options use the classpath for the selected module as calculated by IntelliJ, i.e. based on the source paths and attached libraries.

cfleming03:10:52

The synchronisation of the lein project (either by refreshing the project or importing a new one) basically reads that info from lein and tries to replicate it into the IntelliJ project, creating libs for the dependencies and so on.

cfleming03:10:32

So this is generally more or less the same classpath as lein will calculate, but it’s an imperfect process and it might get screwed up by lein middleware or other craziness.

cfleming03:10:47

I’m going to release a new lein integration soon which should make that process better.

cfleming03:10:27

So for those two options, if you modify project.clj and re-run your process without syncing first, you will not get your new deps.

bbss03:10:23

Hmm there is still something funky going on. When I run in the command line: lein run -m clojure.main script/repl.clj Everything works as expected. But when I do refresh to the project and run it with the clojure.main in normal JVM option I get an old version of React.

danielcompton04:10:41

@bbss: that sounds like a caching issue?

bbss04:10:40

Yes, but where would that cache be?

bbss04:10:29

@danielcompton: any maven cache perhaps? I only know lein clean but that only seems to clear target and the js output directory

cfleming07:10:08

@bbss: You can check the command line generated for your run config - it’s the first line output in the REPL window. The versions there should always correspond to the versions you see in the Project Structure view.

cfleming07:10:14

And the versions you see in the Project Structure view should correspond to your project.clj after doing a sync.

bbss09:10:53

@cfleming I don't have react as a direct dependency, some of the other deps do, but with lein deps :tree none of them has such a low version.

bbss09:10:43

I found it on the classpath you mentioned though!

bbss10:10:30

And also in the project structure. What decides which dependencies are there? Not just lein right?

bbss10:10:27

Success! simple_smile Compilation failed after removing the old react via the project structure view but adding exclusions for two conflicting projects that both needed react and refreshing lein projects seems to have done the trick simple_smile

bbss10:10:09

Great, some fun hacking awaiting me tonight 😄

stijn15:10:09

@cfleming: Java exception breakpoints is soooo good. simple_smile Thank you!

stijn15:10:22

combined with inline variable values it decreases debug time on NullPointerExceptions with 95%

cfleming20:10:05

@stijn: Glad it’s helping! Yeah, the exception breakpoints are my most-used debugging feature, they’re great.