planck

Planck ClojureScript REPL
2016-09-09T17:19:45.000055Z

Hi all! I’m trying to get a planck repl working with cursive, I’d like to be able to send code from a cljs namespace in my project to the repl. I feel like I must be missing something pretty simple I can get the cursive repl to connect to planck, and send basic cljs forms to the repl and have them evaluated in the planck repl. However, when I try to require a library in the cljs namespace (e.g. "(ns guestbook.core (:require [reagent.core :as reagent :refer [atom]]))” , I get a “no such namespace error...”. I am starting planck with the -c option: “planck -c src -n 7777”. My directory structure is src clj <project-name> cljc cljs <project-name> core.cljs If you need more info, I’ll post a gist later, but I’m hoping I’m just missing something obvious 🙂

2016-09-09T17:20:59.000056Z

I should have mentioned, when I do lein cljsbuild.. , the same cljs source files compile fine, so I think the dependencies are actually in the project

2016-09-09T17:21:30.000057Z

also, I’m using the instructions here: http://planck-repl.org/ides.html

mfikes 2016-09-09T19:05:32.000058Z

@ghufran I’d suggest trying it outside of Cursive first, but that doesn’t seem to be a problem. I’m wondering if Reagent works at all in self-hosted ClojureScript, and if the problem is related to that. What is the specific error you get?

2016-09-09T21:37:24.000060Z

ok, so I managed to get planck (outside of cursive) working with a source directory using the instructions at http://planck-repl.org/source-dev.html . I can define a function ‘hello’ in a namespace (‘guestbook.core’), then (require ‘guestbook.core) in planck and then call the function. However, if there are (:require ) forms in the namespace declaration in guestbook.core,then I get an error in planck:

2016-09-09T21:39:00.000061Z

guestbook.core=> (require 'guestbook.core :reload) foo nil guestbook.core=> (hello "foo") "Hello, foo” ;; then added (:require [datascript.core :as ds]) to the guestbook.core namespace declaration. Then when I try it again, I get the following: (require 'guestbook.core) No such namespace: datascript.core, could not locate datascript/core.cljs, datascript/core.cljc, or Closure namespace “datascript.core" (require 'guestbook.core :reload) No such namespace: datascript.core, could not locate datascript/core.cljs, datascript/core.cljc, or Closure namespace "datascript.core" nil cljs.user=>

mfikes 2016-09-09T21:39:45.000062Z

Do you have datascript in the classpath?

2016-09-09T21:40:46.000063Z

I guess I implicitly expected that planck would be able to magically find it as long as it was in the project.clj and I had called lein deps… 🙂

mfikes 2016-09-09T21:41:51.000064Z

Planck will indeed honor whatever classpath you pass to it, so it is probably worth taking a peek at that

2016-09-09T21:43:51.000065Z

Sorry for the super noob questions..is there a way to say “use the classpaths used /defined in this leiningen project”?

mfikes 2016-09-09T21:46:30.000066Z

You can

planck -c`lein classpath`

mfikes 2016-09-09T21:46:36.000067Z

@ghufran See http://planck-repl.org/dependencies.html

2016-09-09T21:47:03.000068Z

thanks+++, I will go rtfm.. 🙂

2016-09-09T21:49:10.000069Z

great docs btw!

mfikes 2016-09-09T22:13:31.000070Z

Thanks. Appreciate it!