LightTable / Clojure

Light Table Clojure language plugin
MIT License
99 stars 51 forks source link

Figwheel nrepl connection to LightTable not working #58

Closed juanpr2 closed 8 years ago

juanpr2 commented 8 years ago

LightTable gives an error when trying to connect to Figwheel's repl.

Following the steps:

  1. Start figwheel on the project from the terminal lein figwheel
  2. Open the project in LightTable
  3. Add a Connection, choose Clojure (remote nRepl) as a client type
  4. Input server localhost:7888

The blocks spin with the message Connecting.., but nothing happens.

I'm using LightTable version 0.8.0-alpha, Binary version 0.31.1 on a Mac with OS X 10.10.5.

This is my project.clj

(defproject hello-om "0.1.0-SNAPSHOT"
  :description "FIXME: write this!"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}

  :dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.170"]
                 [devcards "0.2.1"]
                 [org.omcljs/om "1.0.0-alpha23-SNAPSHOT"]
                 [lein-light-nrepl "0.2.0"]]

  :plugins [[lein-cljsbuild "1.1.1"]
            [lein-figwheel "0.5.0-1"]]

  :clean-targets ^{:protect false} ["resources/public/js/compiled"
                                    "target"]

  :source-paths ["src"]

  :repl-options { :nrepl-middleware [lighttable.nrepl.handler/lighttable-ops]}

  :cljsbuild {
              :builds [{:id "devcards"
                        :source-paths ["src"]
                        :figwheel { :devcards true}  ;; <- note this
                        :compiler { :main       "hello-om.start-ui"
                                    :asset-path "js/compiled/devcards_out"
                                    :output-to  "resources/public/js/compiled/hello_om_devcards.js"
                                    :output-dir "resources/public/js/compiled/devcards_out"
                                    :source-map-timestamp true}}
                       {:id "dev"
                        :source-paths ["src"]
                        :figwheel true
                        :compiler {:main       "hello-om.draft"
                                   :asset-path "js/compiled/out"
                                   :output-to  "resources/public/js/compiled/hello_om.js"
                                   :output-dir "resources/public/js/compiled/out"
                                   :source-map-timestamp true}}
                       {:id "prod"
                        :source-paths ["src"]
                        :compiler {:main       "hello-om.start-ui"
                                   :asset-path "js/compiled/out"
                                   :output-to  "resources/public/js/compiled/hello_om.js"
                                   :optimizations :advanced}}]}

  :figwheel { :css-dirs ["resources/public/css"]
              :nrepl-port 7888})

Any help is appreciated, thanks.

rundis commented 8 years ago

I'm not all that familiar with the nrepl features of figwheel and what it is supposed to give me of benefits as opposed to using the lighttable with cljs browser eval. Once we do figure it out, we should probably add a section about Light Table on the figwheel wiki :-)

Here's what I did get something up and running though:

If I edit cljs files all workes as expected, the compiled js is loaded into the browser and so is then available for cljs evals in LT.

I'm still confused about piggieback, weasels and whatnot. But I'm not sure why you would ever need it from Light Table as it ships with it's own middleware that handles eval in either LT internally (very limited clojurescript version support), internal browser or external browser.

hope this helps.

cldwalker commented 8 years ago

Here's a screenshot of LT working with figwheel. I'll have a wiki page up soon:

screen shot 2016-01-23 at 7 44 57 pm
cldwalker commented 8 years ago

Made https://github.com/bhauman/lein-figwheel/wiki/Running-figwheel-with-LightTable. Closing for now but can reopen if it doesn't work and you can give me steps like ones I listed on the wiki page

jiangts commented 7 years ago

Curious if there's any way to make LT connect to an external figwheel REPL (not an internal figwheel browser)?

My goal is to onboard a couple people onto a ClojureScript project without throwing Clojure, Emacs/Vim, and Paredit at them all at the same time, but I'd still like them to have an in-editor REPL. For some reason when using the internal Figwheel REPL a couple Chrome APIs aren't working, and I can't see the dev console.

sbauer322 commented 7 years ago

Unfortunately, I don't have enough exposure on the topic to be of use but perhaps @rundis or @cldwalker know something?