Fork me on GitHub
#vim
<
2016-11-26
>
lsenta09:11:51

@dominicm I honnestly don’t know: I lein repl, (use ‘figwheel-sidecar.repl-api), (start-figwheel!), (cljs-repl) my project.cljs, :profiles :dev contains:

{:dependencies [[figwheel-sidecar "0.5.2"]
                   [com.cemerick/piggieback "0.2.1"]]
    :source-paths ["src/cljs"]
    :plugins      [[lein-figwheel "0.5.9-SNAPSHOT"]
                   [lein-doo “0.1.7”]]}

lsenta09:11:25

from what I’ve read in the doc, figwheel tries to start piggieback by default, what’s the command you’re talking about?

juhoteperi09:11:17

:Piggieback (figwheel-sidecar.repl-api/repl-env)

juhoteperi09:11:52

And I think you should not run (cljs-repl) if you connect Fireplace to Figwheel, but I'm not sure if it will cause problems

juhoteperi09:11:19

This doesn't seem to be documented at all on Figwheel yet

lsenta09:11:52

@juhoteperi so :Connect will connects me to the nREPL server and :Piggieback will create a new session within that server using the env passed as argument?

juhoteperi09:11:36

Though you probably don't need to use :Connect because Fireplace will automatically connect to nrepl based on .nrepl-port file

lsenta09:11:09

Ok so that maybe where I’m mistaken

lsenta09:11:27

lein repl pops a nrepl instance with the .nrepl-port

lsenta09:11:44

then start-figwheel pops another nrepl instance

lsenta09:11:50

I should connect to the parent one?

juhoteperi09:11:59

Hmm, I don't think figwheel should start another nrepl

juhoteperi09:11:11

It will do that IF you run lein figwheel

juhoteperi09:11:29

but it does't make sense if you use start-figwheel

lsenta09:11:13

ok I had an :nrepl-port from the “easy way” attempt

juhoteperi09:11:28

Yeah I think you don't need that if you use start-figwheel

lsenta09:11:42

err, there’s really no way to have some feedback from fireplace?

lsenta09:11:19

without nrepl-port, it seem’s it won’t connect to the nrepl, not by default, not with :Connect

dominicm09:11:29

If I get chance, today I'll try and update the docs on that Figwheel wiki

lsenta09:11:34

I guess I’m making progress, but without feedback, it’s impossible to know

juhoteperi09:11:45

Does repl connection work for clj files?

lsenta09:11:53

If I eval a println the output shows up in vim, not sure I’m connected to the lein repl

dominicm09:11:16

That's normal I'd say. If it was quick, you're connected to the nrepl

juhoteperi09:11:21

Unless it took like 30sec to eval, it is working

lsenta09:11:11

ok so I should by on my repl

lsenta09:11:34

piggieback gives me no such variable exception, here’s what I got when I autocomplete in the repl:

figwheel-sidecar.repl-api/*repl-api-system*
figwheel-sidecar.repl-api/api-help
figwheel-sidecar.repl-api/app-trans
figwheel-sidecar.repl-api/build-once
figwheel-sidecar.repl-api/clean-builds
figwheel-sidecar.repl-api/cljs-repl
figwheel-sidecar.repl-api/fig-status
figwheel-sidecar.repl-api/figwheel-running?
figwheel-sidecar.repl-api/print-config
figwheel-sidecar.repl-api/reload-config
figwheel-sidecar.repl-api/reset-autobuild
figwheel-sidecar.repl-api/start-autobuild
figwheel-sidecar.repl-api/start-figwheel!
figwheel-sidecar.repl-api/start-figwheel-from-lein
figwheel-sidecar.repl-api/stop-autobuild
figwheel-sidecar.repl-api/stop-figwheel!
figwheel-sidecar.repl-api/switch-to-build
figwheel-sidecar.repl-api/system-asserts
user=> figwheel-sidecar.repl-api/

juhoteperi09:11:59

You have old version of figwheel

juhoteperi09:11:12

repl-env was added in the latest update

juhoteperi09:11:34

check both lein-figwheel and figwheel-sidecar deps

juhoteperi09:11:43

Just got this working myself

juhoteperi09:11:51

I have previously used separate nrepl for figwheel

juhoteperi09:11:05

But migrated to start-figwheel! now

lsenta09:11:03

I was on o.5.9-SNAPSHOT + sidecar 0.5.2

lsenta09:11:31

with both in 0.5.8 the variable is there, almost there, thanks!

lsenta09:11:39

Now my piggieback is hung

juhoteperi09:11:49

when using sidecar + start-figwheel!, I don't think lein plugin is used at all

dominicm09:11:46

Piggieback takes a while

juhoteperi10:11:01

Do you have the app open in browser?

dominicm10:11:11

Also this ^^

dominicm10:11:30

Acid should make this so much nicer with it's streaming output

lsenta10:11:24

what’s acid?

dominicm10:11:54

A highly alpha alternative to fireplace :)

lsenta10:11:01

ho boy ^^'

lsenta10:11:15

count me... out! 😄

lsenta10:11:31

I get this after piggiebacking and eval’ing a println in cljs:

{'status': ['eval-error', 'done'], 'ex': 'class clojure.lang.ExceptionInfo', 'root-ex': '
class clojure.lang.ExceptionInfo', 'id': 'fireplace-HALIX-1480154541-14', 'session': ['71
2f4939-70fe-4832-b057-1a45c87932c1'], 'err': '#object[TypeError TypeError: Cannot read pr
operty ''getStackTrace'' of undefined]^@'}

lsenta10:11:14

(I hadn’t opened the webpage on the first try)

dominicm10:11:53

Kinda implies the println failed

dominicm10:11:19

Do you get the same for (+ 1 1)?

lsenta10:11:38

yup, and (js/alert 1) too

dominicm10:11:17

I feel like we're close, just the evaluations are causing an exception for some reason.

dominicm10:11:14

Fireplace could be way smarter about exceptions in the context of cljs I think. But there we go.

lsenta10:11:31

can I switch my repl to the cljs session?

lsenta10:11:15

I’d bet the exception is “couldn’t find myfile.clj(s)”, but I’d like to try evaling by hand first

dominicm10:11:26

I think Figwheel always uses the same system. So if you run the command you used to do at the repl

dominicm10:11:46

Err, function you used to do at the REPL. It should connect to the same place.

dominicm10:11:22

figwheel/cljs-repl is what I'm thinking of

lsenta10:11:00

it works there

lsenta10:11:18

is there anyway to “connect” my lein repl to the fireplace session?

lsenta10:11:32

to see the exception on stdout

dominicm10:11:48

Nothing is coming to mind. You'd probably have to check the repl-y docs as an existence check.

dominicm10:11:07

Maybe reboot the REPL and start again fresh? (I'm that lost, totally hoping we've run an odd command)

dominicm10:11:35

Try the usual lein clean, shaking a chicken over it :p

lsenta10:11:34

Even the sacrificial lamb didn’t do it

lsenta10:11:26

Well we’ve tried, I’ve put the info you shared with me in https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-with-Vim so it’s not a complete waste

lsenta10:11:03

Thanks for the help guys, I’m going to slowly sneak back to #cursive now 😉

dominicm12:11:49

@lsenta I don't suppose your project is open source and I can try it?

dominicm12:11:06

Ooh, chestnut, that's probably a good basis right?

dominicm12:11:26

I have wifi for now, so I'll grab the latest chestnut, and write down exactly what I do to get clojurescript.

dominicm13:11:38

@lsenta This worked for me:

lein new chestnut testfigwheel
cd testfigwheel
lein repl
=> Ctrl-D # exit (wrong figwheel version)
nvim project.clj # (update figwheel version in 3 places - 2 in deps, 1 in plugins)
lein repl
=> (run)
=> (browser-repl)
# New terminal
nvim src/cljs/testfigwheel/core.cljs
nvim=> :Piggieback (figwheel-sidecar.repl-api/repl-env)
nvim=> :Eval (js/alert "hello, world")

dominicm13:11:54

If it doesn't work for you, I'd suspect an outdated fireplace plugin or something like that. If it does, then it means your figwheel setup might be slightly off.

lsenta13:11:27

Clever, thanks a lot @dominicm

lsenta13:11:42

I’ll just reboot my project using this template, it has everything I need apparently and it just works

dominicm13:11:38

If you like it, great 🙂. Glad it works.

dominicm13:11:44

Sidecar is hard to get right.

dominicm13:11:08

I had a few days of hell getting it up, due to it's parsing of project.clj, which doesn't always work well

lsenta13:11:30

Haha, I believe you

lsenta13:11:24

I’ll keep this solution in mind next time, just take a template that works and trash the previous project.clj

dominicm13:11:46

JUXT (company I work for) has edge https://github.com/juxt/edge and deraen has saapas https://github.com/Deraen/saapas Both use boot which has supported vim for a very long time

dominicm13:11:12

Plenty of good templates about

lsenta16:11:50

thanks @dominicm I’m trying it out, looks nice