Open oshyshko opened 8 years ago
FWIW, I had this problem exactly as reported.
However, @cursive-ide advised me in Clojurians Slack channel to rename file to .cljc. I did this, wow, and I can now copy forms into CLJS REPL.
I suspect this issue has been resolved since it was filed 2 years ago...
There is a drop-down menu in the REPL window, selecting 'cljs' should fix the issue
Hi Clojurians, this is my setup and the steps to make figwheel
and ClojureScript REPL work inside InteliJ IDEA 2021.3.3
lein --version
Leiningen 2.9.1 on Java 11.0.15 OpenJDK 64-Bit Server VM
lein new figwheel figwheel-demo
Generating fresh 'lein new' figwheel project.
Change into your 'figwheel-demo' directory
Then run 'lein figwheel'
cd figwheel-demo
lein figwheel
Figwheel: Cutting some fruit, just a sec ...
Figwheel: Validating the configuration found in project.clj
Figwheel: Configuration Valid ;)
Figwheel: Starting server at http://0.0.0.0:3449
Figwheel: Watching build - dev
Figwheel: Cleaning build - dev
Compiling build :dev to "resources/public/js/compiled/figwheel_demo.js" from ["src"]...
Successfully compiled build :dev to "resources/public/js/compiled/figwheel_demo.js" in 8.181 seconds.
Figwheel: Starting CSS Watcher for paths ["resources/public/css"]
Launching ClojureScript REPL for build: dev
Figwheel Controls:
(stop-autobuild) ;; stops Figwheel autobuilder
(start-autobuild id ...) ;; starts autobuilder focused on optional ids
(switch-to-build id ...) ;; switches autobuilder to different build
(reset-autobuild) ;; stops, cleans, and starts autobuilder
(reload-config) ;; reloads build config and resets autobuild
(build-once id ...) ;; builds source one time
(clean-builds id ..) ;; deletes compiled cljs target files
(print-config id ...) ;; prints out build configurations
(fig-status) ;; displays current state of system
(figwheel.client/set-autoload false) ;; will turn autoloading off
(figwheel.client/set-repl-pprint false) ;; will turn pretty printing off
Switch REPL build focus:
:cljs/quit ;; allows you to switch REPL to another build
Docs: (doc function-name-here)
Exit: :cljs/quit
Results: Stored in vars *1, *2, *3, *e holds last exception object
Prompt will show when Figwheel connects to your application
[Rebel readline] Type :repl/help for online help info
ClojureScript 1.10.773
dev:cljs.user!{:conn 3}=>
At this point you know that your figwheel project is compiled, the web server has started at http://0.0.0.0:3449
and the ClojureScript REPL is launched. Now we want to integrate these with InteliJ IDEA
and its Cursive plugin.
(fig-start)
expression at the end of the filedev/user.clj
The image shows that we managed to start successfully the Figwheel server
and connect it to the local nREPL server
Then we tried to evaluate (cljs-repl)
, i.e. launch Figwheel ClojureScript nREPL middleware library but it failed (see error message)
This the reason for the error message you get "Cannot load ClojureScript form into Clojure REPL" (notice that it is not written correctly on the subject line of the issue). You can reproduce this red error message when you try to send an expression from an open (cljs
) file e.g. src/figwheel_demo/core.cljs
to the CLJ REPL that is active and running.
This is how you can fix this error
project.clj
(see my gist for what modifications to include)src/figwheel_demo/core.cljs
to Figwheel ClojureScript REPL
Summary: can't send forms from editor to an attached ClojureScript REPL.
Here is a screenshot of the problem: https://www.dropbox.com/s/2gessquui612ahj/intellij-cursive.png?dl=0
Prerequisites:
Steps to reproduce:
$ git clone https://github.com/oshyshko/intellij-cursive-red-error.git
cd hello-world
$ lein figwheel
You should see:resources/public/index.html
in your Browser (e.g. Chrome), naviage to Dev Console. You should see:Run it. You should see:
script/figwheel.clj
and send 2 forms from it to REPL using "Send top form to REPL" hotkey. You should see:src/hello_world/core.cljs
(ns hello-world.core ...)
and press "Send top form to REPL" hotkey. You should see red error sayingCannot load Clojure form into ClojureScript REPL
(println "Edits to this ...")
. You should see red error saying "Cannot load Clojure form into ClojureScript REPL"(js/alert 123)
and press Enter. You should see a popup with [OK] button fired by browser.Expected behavior:
Two last points: the form should be evaluated in browser (observed in Dev Console) and no red error should appear.