Closed PeteW closed 6 years ago
UPDATE: Some shadow-cljs devs showed me how to connect fireplace with the REPL properly. Cool stuff! I'm going to follow up on this issue with a PR that adds documentation for shadow-cljs
Closing this issue since it doesnt seem like "make X work with vim-fireplace" sort of information has a home in the vim-fireplace docs, and that's fine. I will, for folks getting here from google, summarize with:
Say your shadow-cljs.edn looks like:
{:source-paths ["src"]
:dependencies [[binaryage/devtools "0.9.10"]
[cider/cider-nrepl "0.18.0"]
[reagent "0.8.1"]]
:nrepl {:port 3333}
:builds
{:app {:target :browser
:output-dir "public/js"
:asset-path "/js"
:modules
{:main
{:entries [pete.core]}}
:devtools
{:after-load pete.core/main
:http-root "public"
:http-port 3000}}}}
:Connect
:Piggieback :app
(converts the clojure repl to a clojurescript repl)@PeteW I'd beg to differ, as far as adding "make X work with vim-fireplace" to the docs/README. I brought up using vim-fireplace with Clojure CLI in #357, and @tpope seemed open to adding documentation around this if we figured out a relatively straightforward way of getting it to work. If he feels it's too much for the README though, maybe we can start some wiki pages for less frequently used (for now) setups? Then we can at least point to them from the README? It took me a while to happen upon this issue, as it did coming to the Clojure CLI solution.
Yeah I do want this sort of stuff documented, but I'm not really sure where. The README is more of a sales pitch, I don't really want any big detours. Maybe we should add a section to the help file and explain Lein, Boot, Clojure CLI, and Shadow CLJS one by one?
Wiki page is also a great solution, in the interim if not permanently.
Note that Fireplace now lets you do :CljEval (whatever/cljs-repl)
to start a CLJS REPL without Piggieback, so maybe the instructions for Shadow CLJS in particular can be simplified.
Also, maybe it's time to add some sort of "jack in" functionality to spare users the trouble?
I added Clojure CLI support to salve.vim. This makes :Console
into a crude first pass at a "jack in", which is good enough for now I think.
I'll do the same for Shadow CLJS if someone can figure out how to retrieve its classpath. I see a list of jar files hiding in .shadow-cljs/classpath.edn
, so I would expect (or at least hope for) it to expose a way to retrieve them from the command line.
@tpope you might not be aware that retrieving the classpath is now possible with shadow-cljs classpath
. It was added pretty recently: https://github.com/thheller/shadow-cljs/commit/d9d0002c30eaf725051a0483b248696eeb731bc8
Implemented. See the caveats in the commit message.
Amazing! Thanks @tpope!
According to this CIDER docs:
Cool! I have a shadow-cljs setup so alls I need to do is:
Then I launch vim and
:Connect
specify the nrepl protocol and localhost and port 3333 and this returns no issues.Then I try and
:<,>Eval
some text(+ 1 1)
whilst editing a core.cljs file And I get an exception:Fireplace: java.lang.AssertionError
Well that isnt much to go with so I edit fireplace.vim a little bit (add error and stacktrace into that vim exception on line 715, no other changes whatsoever)
and now I see much more detail in that error message:
(side note: Pardon the malformed stack. I'm computer illiterate and didnt know how to copy from the vim error window. I took a screenshot and literally ran it through an OCR. Yes this is windows/gvim and yes I am mildly ashamed of myself)
Anyways, my impression is that fireplace is employing some sort of piggieback when I was told no piggieback is necessary. I'm still digging but wanted to see if anything obvious jumps out