Fork me on GitHub
#cursive
<
2016-02-21
>
cfleming01:02:00

@dmi3y: This is because Cursive works from source, and it’s difficult to expand macros during editing.

cfleming01:02:21

Some fixes are on the way, one short-term patch and one longer-term definitive fix.

serioga11:02:35

waiting for improvements simple_smile

dmi3y14:02:45

Got it, thanks @cfleming.

lsenta17:02:49

Hola guys, quick question, I lein figwheel and try to run a remote repl with cursive that connects to it

lsenta17:02:20

But it looks like it's still in clj mode, I can do js/window in the figwheel repl, but that fails in the cursive REPL

lsenta17:02:47

Any *simple* solution to connect to my figwheel REPL and run clojurescript pieces of code?

lsenta17:02:30

(I have issues with macro importing and expansion, that'll be a life saver)

cfleming18:02:24

@lsenta: The Cursive remote REPL runs over nREPL - are you running your figwheel REPL with nREPL enabled?

lsenta20:02:41

@cfleming I think I do, I have :nrepl-port 7002 in the project.clj for the figwheel conf

cfleming20:02:03

Ok, and the remote repl connects to that port ok?

cfleming20:02:16

What’s the error that you get?

lsenta20:02:51

I try to do js/window

lsenta20:02:29

I get a:

CompilerException java.lang.RuntimeException: No such namespace: js, compiling:((ns cursive.repl.runtime
large red codetrace

cfleming20:02:41

Ok, you’re right, the REPL is still in Clojure mode.

cfleming20:02:57

I’m assuming you have to start the CLJS part somehow after connecting.

cfleming20:02:52

You don’t need the first step (`lein repl`) since you’re connecting with the remote option but following the steps after that should work.

lsenta21:02:47

@cflemming

The lein figwheel is capable of launching an nREPL server that your tooling can connect to by using the :nrepl-port configuration parameter. This is not the strategy recommended below.

lsenta21:02:03

No simple way to start the clojurescript mode in the cursive REPL?

cfleming21:02:40

That doesn’t use nREPL, but I believe it’s what Bruce recommends right now.

cfleming21:02:00

I’m currently investigating how to make all this easier, but that’s as good as it gets right now I think.

lsenta21:02:31

So: I used the script/repl.clj you just linked, it worked while my browser was still in the session I started with the regular lein figwheel

lsenta21:02:13

(start lein figwheel, open page of the project that connects to figwheel, kill lein figwheel, start script/repl.clj, browser reconnects and all is good)

lsenta21:02:49

Then I refresh, and now goog.require can't find my app anymore

lsenta21:02:09

I guess it's due to note: leiningen profile merging won't occur when fetching config from project.clj

lsenta21:02:22

Thanks for giving me a hand @cfleming, I'll wait for an update that smooth things out simple_smile

cfleming21:02:40

Ok, there was some discussion on here a while ago about profile merging, sadly that’s getting beyond my cljs knowledge

lsenta22:02:57

Isn't profile merging a leiningen/clj thing?

cfleming22:02:26

It is, but for some reason it badly affects cljs REPLs.

cfleming22:02:52

I was really busy during the discussion and didn’t pay enough attention to it, and it’s now lost to the greedy Slack god.

cfleming22:02:55

Thinking about it, I assume it’s because when you’re running the REPL without using lein (as in a quickstart-style REPL), since you’re not using lein your profiles don’t get merged and your REPL ends up with the wrong config.

lsenta22:02:56

@cfleming Yea I think so, I tried quickly to copy and paste parts of my config but it didn't worked

cfleming22:02:54

@lsenta: So you can configure figwheel to retrieve the config directly from project.clj, is that right?

cfleming22:02:14

Can you specify another file to get it from?

lsenta22:02:08

From what I understand in the last link you sent, start-figwheel! loads the project.clj

lsenta22:02:22

but does apply the lein merging, only processing the raw edn

lsenta22:02:34

or you can pass config parameters to the start figwheel

lsenta22:02:35

not sure it'd takes a file path, but why not slurping it directly

cfleming22:02:09

Right. So I think that you could use lein pprint to create a project-merged.clj, and then slurp that and pass it to start-figwheel!

cfleming22:02:07

@lsenta: In fact, I think you’d need to call prep-config and config from that file with your slurped data too.

lsenta22:02:49

@cfleming: FYI I can't open the lein pprint'd file in IntelliJ

lsenta22:02:03

23:43:55 IllegalArgumentException: Don't know how to create ISeq from: com.intellij.extapi.psi.ASTWrapperPsiElement

cfleming22:02:39

Is this something you can refheap, or is it an internal project?

lsenta22:02:00

Internal, I'll try to find the minimal part and open an issue with it

lsenta22:02:51

I don't think lein pprint does merging

lsenta22:02:16

:profiles
 {:uberjar ...
  :dev [:project/dev :profiles/dev],
  :test [:project/test :profiles/test],
  :project/dev ...

lsenta22:02:47

I'm pretty sure :dev should be replaced by a map if that was the case

cfleming22:02:45

I’ll try to play around with this later today and see if I can come up with something better.

lsenta22:02:48

Thanks man, that'd be great. What I saw of cursive + cljs was pretty good already

lsenta22:02:25

I believe it didn't moved namespace automatically when you evaluate a piece of code, but I got autocompletion, which is already better than the lein figwheel repl simple_smile

cfleming22:02:55

I’m actually going to be getting some help soon to make all this easier.

lsenta22:02:06

If you want to reproduce the file I posted above, just lein new luminus my-app; cd my-app/; lein pprint

cfleming22:02:08

2016 is going to be the year of improving CLJS in Cursive

cfleming22:02:17

Ok, great, thanks

lsenta22:02:57

That's pretty cool, congratulation

lsenta22:02:26

From what you know of the community do you think you'll be able to make a living from this?

lsenta22:02:33

as in "full time work on cursive"

cfleming22:02:45

Yes, I think so - Cursive has been selling really well

cfleming23:02:04

Lots of free licences gone out, but lots of paying customers too.

cfleming23:02:29

Long term it will depend on growth in the Clojure/CLJS community, but I’m pretty optimistic about that.

lsenta23:02:47

I wish you the best, you're lowering the barrier to entry to clojure so much, thanks for that... and leaving a free options for hackers-wanna-be-full-time-clojurists!

cfleming23:02:58

Thanks! I appreciate it.

cfleming23:02:11

There’s lots to do to make all this easier, especially around CLJS.

cfleming23:02:33

The tooling has improved a massive amount in the last year, but it’s still difficult to get started for a lot of people.

lsenta23:02:30

You should add a project > new luminus project and market this as the "one click to get started with clojure, clojurescript & react/reagent" simple_smile

darwin23:02:44

@cfleming: do you see any relatively low-hanging fruit to help growth of CLJS community? I think I will have some extra time on my hands soon

darwin23:02:10

btw. I’m Cursive user myself, thanks a lot for such amazing tool

darwin23:02:10

as a side note, I’m going to implement some Cursive-related workflow into Dirac soon, I want to be able to use Cursive to eval code in nREPL, but results would be echoed into Dirac REPL Console as well. If you had any ideas how to improve Dirac for Cursive users , I would be eager to hear.

cfleming23:02:21

@darwin: Thanks! I’m really glad you’re enjoying Cursive.

cfleming23:02:00

You have some very interesting projects as well, plastic is very cool

cfleming23:02:19

dirac is the webtools extension, right?

cfleming23:02:03

Ah, that was why I couldn’t find it under darwin

darwin23:02:08

do not confuse it with cljs-devtools is an “extension”: https://github.com/binaryage/cljs-devtools

cfleming23:02:19

So I have a very long list of things that I would like to improve for CLJS users. I’m not sure many of them are low-hanging fruit though, and I’ve been thinking about all of them from the point of view of integrating them into Cursive.

cfleming23:02:49

More or less: one-click REPLs, including figwheel - these will include the current Cursive goodness (auto-formatting etc)

darwin23:02:50

thanks, plastic is on hold, the project was too big and with invention of ParInfer I’m not sure if I could beat it, also Cursive improved a lot, so I don’t have such pressing need to put more effort into it at this point, but still it could be a nice research “toy” project for long winters simple_smile

cfleming23:02:39

Test integration, both the interactive style that Cursive currently offers for clj, and a test runner with autowatching.