lambdaisland / npmdemo

Demo of using Node+Express with ClojureScript
60 stars 9 forks source link

slow work clsj REPL #2

Open Guliy opened 6 years ago

Guliy commented 6 years ago

Hi! thanks for the work you've done, this is very useful!

But, I met with the incomprehensible behavior of the replays, when I try to set an example in an emacs. After cider-jack-in-clojurecript - cjs repl work very sow. Just eval (prn "test") - take up to 10 s I tried run in terminal lein figwheel and then in emacs cider-connect, but i get something like this in emacs repl buffer:

WARNING: CIDER's version (0.16.0-snapshot) does not match cider-nrepl's version (nil). Things will break! More information. WARNING: clj-refactor and refactor-nrepl are out of sync. Their versions are 2.4.0-SNAPSHOT (package: 20171117.317) and n/a, respectively. You can mute this warning by changing cljr-suppress-middleware-warnings.

And then after run (require '[figwheel-sidecar.repl-api :as ra]) in emacs repl buffer i get in terminal something like this:

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by clojure.tools.nrepl.middleware.interruptible_eval$set_lineBANG to field java.io.FilterReader.in WARNING: Please consider reporting this to the maintainers of clojure.tools.nrepl.middleware.interruptible_eval$set_lineBANG WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release

And then repl starts work slow in terminal too. Any idea what I'm doing wrong?

My project.clj: `(def shared-compiler-settings '{:main npmdemo.core :npm-deps {:express "4.16.2" :ws "3.2.0"} :install-deps true :infer-externs true :target :nodejs})

(defproject npmdemo "0.1.0-SNAPSHOT" :description "" :url "http://github.com/lambdaisland/npmdemo" :license {:name "Mozilla Public License 2.0" :url "https://www.mozilla.org/en-US/MPL/2.0/"} :dependencies [[org.clojure/clojure "1.9.0-beta3"] [org.clojure/clojurescript "1.9.946" :scope "provided"]]

:plugins [[lein-cljsbuild "1.1.7"]]

:jvm-opts ["--add-modules" "java.xml.bind"]

:min-lein-version "2.6.1"

:clean-targets ^{:protect false} [:target-path :compile-path "dev-out" "out"]

:cljsbuild {:builds [{:id "dev" :source-paths ["src"]

            :figwheel {:on-jsload "npmdemo.core/reset-app!"}

            :compiler ~(merge
                        {:output-to "npmdemo-dev.js"
                         :output-dir "dev-out"}
                        shared-compiler-settings)}

           {:id "prod"
            :source-paths ["src"]
            :compiler ~(merge
                        {:output-to "npmdemo.js"
                         :output-dir "out"
                         :optimizations :simple
                         :closure-defines '{goog.DEBUG false}
                         :pretty-print false}
                        shared-compiler-settings)}]}

:figwheel {:server-logfile "log/figwheel.log" :nrepl-port 7000 :server-port 3450}

:profiles {:dev {:dependencies [[figwheel "0.5.15-SNAPSHOT"] [figwheel-sidecar "0.5.15-SNAPSHOT"] [cider/cider-nrepl "0.16.0-SNAPSHOT"] [com.cemerick/piggieback "0.2.2"]]

          :plugins [[lein-figwheel "0.5.15-SNAPSHOT"]]

          :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}})

` Cider version 0.16.0snapshot

Emacs 25.3.1

plexus commented 6 years ago

Hi @Guliy, you're going to have to do a bunch of extra setup to get cider-jack-in-clojurescript to work properly. You can have a look at the Chestnut template, in particular env/dev/user.clj and .dir-locals.el. Without that CIDER will use its defaults to get to a ClojureScript REPL, which I believe is a Rhino or Nashorn based REPL, so it is not using Figwheel.

There's an extensive Lambda Island episode about configuring Emacs for use with Figwheel: 15. Using Figwheel With Emacs, part 2: CIDER

The examples in this repo are really just minimal examples, and they've only been tested as documented in the README.

What you can do is do a regular cider-jack-in, and then use the Figwheel sidecar API to switch to a clojurescript repl, see Using the Figwheel REPL within NRepl

Guliy commented 6 years ago

I have setup my emacs for work with Figwheel. It's works. I localized the problem, which is to use :npm-deps in cljsbuild compiler config. If removed this section - all works well. But in this case i need install npmdeps manually. Yes, you right, problem in defaults settings cider-jack-in-clojurescript, but i can't decide its with new version clojurescript. At this moment my decision - used lein-npm plugin