clojure-emacs / cider

The Clojure Interactive Development Environment that Rocks for Emacs
https://cider.mx
GNU General Public License v3.0
3.55k stars 645 forks source link

Make boot ClojureScript REPL more user friendly #2403

Closed arichiardi closed 5 years ago

arichiardi commented 6 years ago

With the changes we made to cider and piggieback we kind of have one missing in action thing: the cljs REPL for boot.

It can still be launched by modifying cider-boot-parameters manually and by using the adzerk/cljs-repl-env task but it would be awesome if we could do something for injecting this as well now that we fully control the cli.

Untested, but this is what should work out of the box for cider-boot-parameters:

cljs-repl-env nrepl-server -b :: wait

and then C-c M-J selecting boot as usual.

Note that the weasel dependency needs to be on the classpath (I don't think cider adds it at the moment).

Environment & Version information

CIDER version information

;; CIDER 0.18.0snapshot

Lein/Boot version

Latest boot

bbatsov commented 6 years ago

Note that the weasel dependency needs to be on the classpath (I don't think cider adds it at the moment).

It doesn't. But there's the problem that both weasel and the boot cljs repl still depend some ancient version of piggieback. Maybe we can just fork them under the nrepl org and use updated versions, as you try to use the current versions with clj (for instance) you'll immediately get a lock-up, same with boot nrepl-server (as both with start nREPL 0.4 which requires the latest piggieback).

arichiardi commented 6 years ago

I think at this point it would be better for us to host our own boot cljs REPL by replicating what is in that repository.

bbatsov commented 6 years ago

You know best. To me it seems that this boot cljs repl is just some wrapper around weasel, but it’s probably more than this.

On Thu, 9 Aug 2018 at 20:03, Andrea Richiardi notifications@github.com wrote:

I think at this point it would be better for us to host our own boot cljs REPL by replicating what is in that repository.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/clojure-emacs/cider/issues/2403#issuecomment-411828140, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGVyqketIVP83EYNnpLJT2R2BN1G4ZDks5uPGtogaJpZM4V0VTD .

-- Best Regards, Bozhidar Batsov

http://www.batsov.com

arichiardi commented 6 years ago

I think you are right, and that is why we can probably bypass the library completely

bbatsov commented 6 years ago

@arichiardi You're the expert. If we can bypass it - that'd be great. We'd still have to update weasel, though.

vigilancetech-com commented 6 years ago

when I set cider-boot-parameters:

cljs-repl-env nrepl-server -b :: wait

I get "nrepl-server not found"

I've upgraded everything to the latest (including all of boot-cljs-repl's dependencies)

arichiardi commented 6 years ago

I think you need to fully qualify the symbol unless you refer to it in build.boot

arichiardi commented 6 years ago

The fully qualified symbol is cider.tasks/nrepl-server. Not at the keyboard now but I double checked cider-nrepl.

vigilancetech-com commented 6 years ago

I tried to set up hoplon's first example (upgrading boot-cljs-repl) and I get:

$ boot -d nrepl\:0.4.5 Classpath conflict: org.clojure/clojure version 1.9.0 already loaded, NOT loading version 1.4.0

I'm not familiar with lien. When I try and run the cljs jack in it says it can't start the nREPL server due to a similar error. I see the lien profiles selecting the different versions of clj but I don't know why its not auto-selecting them when I use boot.

Can anyone help?

Here's my repo for you to (hopefully) duplicate my results:

https://github.com/vigilancetech-com/address-book

bbatsov commented 6 years ago

@vigilancetech-com Unfortunately both the boot-cljs-repl and the underlying weasel library are both abandonware right now and they simply don't support nREPL 0.4. I'd suggest using figwheel or shadow-cljs instead.

bbatsov commented 6 years ago

See also https://github.com/adzerk-oss/boot-cljs-repl/pull/61

Seems to me we'll have to fork both projects and update them if we want someone to be able to use them with nREPL 0.4.

arichiardi commented 5 years ago

While working on something else, I had time for looking at this a bit more and you basically need something like this in build.boot

(deftask dev
  [p port       PORT int  "The nRepl port"]
  (comp (serve :dir "assets/")
        (watch)
        (notify)
        (cljs-devtools)
        (reload :client-opts {:debug true}
                :asset-path "/public") ;; Deprecated
        (cljs-repl :nrepl-opts {:port port})
        (cljs :optimizations :none
              :source-map true
              :compiler-options {:external-config
                                 {:devtools/config {:features-to-install [:formatters :hints]
                                                    :fn-symbol "λ"
                                                    :print-config-overrides true}}})))

Of course customized according to your needs, then you can add (cider-boot-parameters . "dev") in .dir-locals.el or set it somewhere.

Problem is that the buffer does not cider does not seem to launch the right command because I see (pending-cljs) and no cljs.user> yet.

So still not there.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

stale[bot] commented 5 years ago

This issues been automatically closed due to lack of activity. Feel free to re-open it if you ever come back to it.