Fork me on GitHub
#babashka
<
2020-05-05
>
include00:05:52

Hi. I am starting to play with babashka and I am wondering if it’s possible to use REPL + calva with it.

sogaiu01:05:59

@include i think it may be possible to use bb with calva - may be #calva folks can help with details?

include01:05:45

@sogaiu yes maybe. I was able to connect but the behavior is a little bit weird. I think calva expects a initial full namespace load (send to repl) but I have a shebang 🙂 . tomorrow I will ping them; it’s already late here 🙂 thank you anyway.

👍 8
pez05:05:30

it should work. Can you describe ”a little bit weird” some? 😃

include08:05:19

@pez hi sorry for the delay .) so I can write expressions directly to the repl but I cannot send selected forms from the editor to the repl via any shortcut. I think is is related with the problem I mentioned above. I can’t send the namespace in first place. I don’t get an error or any other message. my babashka has an initial shebang on top and maybe this is confusing calva/repl.

include09:05:52

ok I see I can create a barebones clj project/structure and call this namespace via bb cmdline, this way I don’t need that shebang and I bet calva/repl will work just fine.

borkdude09:05:42

@include shebangs should just work fine with any Clojure environment

borkdude09:05:59

the Clojure reader ignores shebangs

borkdude09:05:15

so if Calva doesn't support that, something weird is going on (cc @pez)

pez09:05:10

I hope Calva doesn't have problem with it. Can you share a bit more about what the file looks like?

include09:05:56

@bozhidar ah ok; nice to know that! clj n00b here 🙂 who will pick and migrate a couple of scripts from bash to clj to learn.

include09:05:11

@pez just a simple mkdir -p foo ; touch foo/test.clj ; code foo/test.clj (it‹s not a conventional “project/structure”. Then I have a shebang as I mentioned #!/usr/bin/env bb and the a simple def symbol and it’s println. I am not able to jack-in a repl.

pez09:05:47

There is no jack-in for babashka, yet. You'll need to start it manually: bb --nrepl-server localhost:1667, then connect.

👍 4
pez09:05:46

I should document this a bit... Anyway, when you connect you choose Project type: Generic, and then tell Calva which port you bound babashka's nrepl server to (1667 in this case). (I also suggest not sending stuff to the REPL window, but instead rely on inline evaluations, but that is a matter of style, maybe).

borkdude09:05:12

This method is also suggested here: https://github.com/borkdude/babashka/blob/master/doc/repl.md#nrepl Although this document does not go into detail how to connect from each individual editor. PR welcome for Calva 🙂

👍 8
include10:05:46

thank you @pez and @borkdude. I just jumped right ahead to play with babashka assuming some defaults I had in my mind 🙂

include10:05:57

OT: “First thing first. The https://github.com/VSCodeVim/Vim and Calva has some friction between them. Expect it to be a bit painful.” ah ok 🙂

pez10:05:55

¯\(ツ)

😄 4
martinklepsch21:05:07

I vaguely remember somebody building some static site renderer style thing with graal and/or bb — is that a thing and does anybody know what I’m thinking of?