Git Product home page Git Product logo

experiments's People

Contributors

dependabot[bot] avatar rgm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

justindbelanger

experiments's Issues

Get piggieback running via vim

Goal

Have sample/core.cljs open in Vim (with fireplace) and be able to cpp at L23, or :Eval (js/alert "hi from editor via piggieback") and actually see an alert. This indicates we have a live connection and can eg. send re-frame events, look up docs, jump to definitions ... all the good repl-connected editor niceties.

Expected

cpp in vim should show a browser alert after starting Piggieback.

Observed

I seem to get a Nashorn repl, not a browser repl. (Evidence: nashorn_code_cache directory appears). Step 5 below shows in vim:

Execution error (IllegalArgumentException) at cljs.repl/fn$G (repl.cljc:116).
No implementation of method: :-repl-options of protocol: #'cljs.repl/IReplEnvOption
s found for class: nil
Prompt will show when REPL connects to evaluation environment (i.e. a REPL hosting
webpage)
Figwheel Main Controls:
          (figwheel.main/stop-builds id ...)  ;; stops Figwheel autobuilder for ids

          (figwheel.main/start-builds id ...) ;; starts autobuilder focused on ids
          (figwheel.main/reset)               ;; stops, cleans, reloads config, and
 starts autobuilder
          (figwheel.main/build-once id ...)   ;; builds source one time
          (figwheel.main/clean id ...)        ;; deletes compiled cljs target files

          (figwheel.main/status)              ;; displays current state of system
Figwheel REPL Controls:
          (figwheel.repl/conns)               ;; displays the current connections
          (figwheel.repl/focus session-name)  ;; choose which session name to focus
 on
In the cljs.user ns, controls can be called without ns ie. (conns) instead of (figw
heel.repl/conns)
    Docs: (doc function-name-here)
    Exit: :cljs/quit
 Results: Stored in vars *1, *2, *3, *e holds last exception object
Open URL http://localhost:9500
To quit, type: :cljs/quit
Press ENTER or type command to continue

Step 6 below shows in the repl terminal (not vim):

Exception in thread "nRepl-session-b6eb8830-39ac-4122-8c8a-07aa4fec1c91" java.lang.IllegalArgumentException: No implementation of method: :send of protocol: #'nrepl.transport/Transport found for class: nil
	at clojure.core$_cache_protocol_fn.invokeStatic(core_deftype.clj:583)
	at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:575)
	at nrepl.transport$eval8304$fn__8305$G__8295__8312.invoke(transport.clj:16)
	at nrepl.middleware.print$replying_PrintWriter$fn__8761.invoke(print.clj:115)
	at nrepl.middleware.print.proxy$java.io.Writer$ff19274a.write(Unknown Source)
	at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129)
	at java.io.BufferedWriter.flush(BufferedWriter.java:253)
	at java.io.PrintWriter.flush(PrintWriter.java:320)
	at clojure.core$flush.invokeStatic(core.clj:3711)
	at clojure.core$flush.invoke(core.clj:3705)
	at cljs.repl$repl_caught.invokeStatic(repl.cljc:996)
	at cljs.repl$repl_caught.invoke(repl.cljc:980)
	at cider.piggieback$repl_caught.invokeStatic(piggieback.clj:105)
	at cider.piggieback$repl_caught.invoke(piggieback.clj:98)
	at cider.piggieback$do_eval.invokeStatic(piggieback.clj:265)
	at cider.piggieback$do_eval.invoke(piggieback.clj:227)
	at cider.piggieback$evaluate.invokeStatic(piggieback.clj:273)
	at cider.piggieback$evaluate.invoke(piggieback.clj:271)
	at clojure.lang.Var.invoke(Var.java:384)
	at cider.piggieback$wrap_cljs_repl$fn__9317$fn__9320$fn__9321.invoke(piggieback.clj:305)
	at cider.piggieback$enqueue$fn__9289.invoke(piggieback.clj:195)
	at clojure.lang.AFn.run(AFn.java:22)
	at nrepl.middleware.session$session_exec$main_loop__8996$fn__9000.invoke(session.clj:171)
	at nrepl.middleware.session$session_exec$main_loop__8996.invoke(session.clj:170)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.lang.Thread.run(Thread.java:748)

Steps to reproduce

  1. Check out the minimal-piggieback branch
  2. make distclean to clear build products, node modules and start fresh
  3. make repl to start a JVM repl
  4. Once the rebel CLI prompt is showing, type (go) to start nrepl and figwheel running
  5. Open src/cljs/sample/core.cljs in vim w/ fireplace installed
  6. :Piggieback (figwheel.main.api/repl-env "config/dev") ... wait for control to return
  7. cpp on L23 or :Eval pretty much any form

Notes

I've also seen an issue where I seem to get further than this, but end up on a "Can't find react.cljs" error. I don't seem to be able to reproduce this (might have been an older piggieback or nrepl dep), but I'm guessing that somehow Figwheel or Nashorn isn't being made aware that target/public/js-out is where it can find this, since for that error I also had an out directory show up. My understanding is that that's the cljs compiler's default.

Odd `out/` compiled JS

After starting the jvm prepl, figwheel, the figwheel prepl and then cljs-repl in the https://github.com/rgm/clojure-experiments/tree/master/prepl-browser experiment, I'm seeing the following files in /out:

rgm@netherton prepl-browser % find out
out
out/goog
out/goog/iter
out/goog/iter/iter.js
out/goog/array
out/goog/array/array.js
out/goog/reflect
out/goog/reflect/reflect.js
out/goog/math
out/goog/math/long.js
out/goog/math/math.js
out/goog/math/integer.js
out/goog/asserts
out/goog/asserts/asserts.js
out/goog/object
out/goog/object/object.js
out/goog/structs
out/goog/structs/structs.js
out/goog/structs/map.js
out/goog/dom
out/goog/dom/nodetype.js
out/goog/functions
out/goog/functions/functions.js
out/goog/string
out/goog/string/stringformat.js
out/goog/string/stringbuffer.js
out/goog/string/string.js
out/goog/uri
out/goog/uri/utils.js
out/goog/uri/uri.js
out/goog/debug
out/goog/debug/error.js
out/clojure
out/clojure/string.cljs.cache.json
out/clojure/walk.cljs
out/clojure/string.js
out/clojure/walk.js.map
out/clojure/string.cljs
out/clojure/walk.js
out/clojure/walk.cljs.cache.json
out/clojure/string.js.map
out/cljs
out/cljs/repl.js
out/cljs/test.cljs
out/cljs/test.cljs.cache.json
out/cljs/test.js
out/cljs/test.js.map
out/cljs/core.js
out/cljs/repl.js.map
out/cljs/repl.cljs.cache.json
out/cljs/spec
out/cljs/spec/alpha.js.map
out/cljs/spec/gen
out/cljs/spec/gen/alpha.js.map
out/cljs/spec/gen/alpha.cljs.cache.json
out/cljs/spec/gen/alpha.cljs
out/cljs/spec/gen/alpha.js
out/cljs/spec/alpha.cljs.cache.json
out/cljs/spec/alpha.cljs
out/cljs/spec/alpha.js
out/cljs/core.js.map
out/cljs/pprint.cljs
out/cljs/core.cljs
out/cljs/pprint.js
out/cljs/pprint.js.map
out/cljs/pprint.cljs.cache.json
out/cljs/repl.cljs

Figwheel is correctly compiling my code, and I get a working repl connection in Vim, but the JS console is showing:

image

Something deep in Figwheel or Conjure is wanting some test namespaces?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.