Fork me on GitHub
#calva
<
2019-06-24
>
pez08:06:57

Fixed a bug where if you didn't have a custom cljs repl specified, the connect picker menu would not be populated.

taylor15:06:23

Maybe a known issue, but if my project defines no aliases, the jack in action uses invalid arguments to Clojure CLI

taylor15:06:52

It sets the A flag but doesn’t pass any alias names (because none exist)

pez15:06:41

That's not a known issue. Maybe something introduced just today even. Can you file an issue about it? I'll look at it ASAP.

taylor16:06:01

Issue created, thanks!

pez16:06:30

Thanks for reporting! I'm sorry about that bug. I'll fix as soon as I have access to a computer.

taylor17:06:51

No worries, thanks for making Clojure easier in more environments!

pez17:06:04

The fix is out. Again thanks for quickly reporting. I hope that not too many people were inconvenienced by that!

Stefan19:06:06

(set! *newbie-alert* true) I’m trying to get a REBL session by running jack-in command from Calva. I have followed the instructions to setup REBL using deps.edn, and that works when I run it from the command line: clj -R:rebl -m cognitect.rebl. When I call jack-in from Calva, and select the REBL alias to launch with, I get an error:

> Executing task: /usr/local/bin/clojure -Sdeps "{:deps {nrepl {:mvn/version \"0.6.0\"} cider/cider-nrepl {:mvn/version \"0.21.1\"}}}" -A:rebl -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" <

Exception in thread "main" clojure.lang.ArityException: Wrong number of args (4) passed to: cognitect.rebl/-main
        at clojure.lang.AFn.throwArity(AFn.java:429)
        at clojure.lang.AFn.invoke(AFn.java:44)
        at clojure.lang.AFn.applyToHelper(AFn.java:165)
        at clojure.lang.AFn.applyTo(AFn.java:144)
        at clojure.lang.Var.applyTo(Var.java:705)
        at clojure.core$apply.invokeStatic(core.clj:665)
        at clojure.main$main_opt.invokeStatic(main.clj:491)
        at clojure.main$main_opt.invoke(main.clj:487)
        at clojure.main$main.invokeStatic(main.clj:598)
        at clojure.main$main.doInvoke(main.clj:561)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.lang.Var.applyTo(Var.java:705)
        at clojure.main.main(main.java:37)
The terminal process terminated with exit code: 1
Any ideas on how to fix this?

Daniel Hines19:06:22

I tuned out of Calva development for a couple months… wow - ya’ll have moved fast! Is there a changelog for v2+ stuff somewhere? My CTO asked for me to demo how Clojure could fit into our product, and I’m trying to get back up to speed on Cavla to do so.

pez19:06:57

I’m happy to hear you want to use Calva for that! Here’s the closest to a change log: https://clojureverse.org/t/the-calva-journey-continues-please-jack-in

pez20:06:00

@stefan.van.den.oord, I’m unfamiliar with the -R flag. And with REBL. I think @lilactown may have more knowledge about it…

lilactown20:06:47

You can see in the command that you are using an alias called :rebl which probably has a main set

Stefan20:06:21

yes indeed

lilactown20:06:23

But the jack-in command is trying to use the nrepl main to start the server

Stefan20:06:53

that’s what the -R does, right: load the stuff, but not run it (or something like that)

lilactown20:06:22

Right. What's actually happening is the args after -A:rebl are passed through to the main set by the REBL alias

lilactown20:06:35

You could remove the main from the :rebl alias or Calva could provide a way of specifying what way to consume the alias (R, A, etc.)

lilactown20:06:41

I would suggest the former

Stefan20:06:01

Ok I’ll try that.

lilactown20:06:14

To get it working today 😉

lilactown20:06:36

Configuring aliases is tricky. It sucks in Emacs too

Stefan20:06:00

It launches the REPL without the main, as you would expect, but how can I now launch a REBL that is connected to Calva?

lilactown20:06:02

You should then be able to require the cognitect rebl ns and start the UI

lilactown20:06:19

I'm not at my computer right now so not sure what the exact incantation is

Stefan20:06:14

Yes, that worked.

Stefan20:06:29

(require '[cognitect.rebl])

Stefan20:06:36

(cognitect.rebl/ui)

pez20:06:41

Is there something Calva can do to support this better? What does it mean “remove the main from the :rebl alias”?

lilactown20:06:43

Getting things wired up to redirect repl expressions to the REBL ui takes some sort of middleware FYI

lilactown20:06:31

By remove the main, I mean that an alias can contain different configurations that override what's passed in to the clojure CLI. Like a different main routine to run on startup

pez20:06:32

Also, can you write something about how you got it working on the Calva wiki, @stefan.van.den.oord?

Stefan20:06:03

There’s still one missing link though: How can I evaluate something in Calva and have it end up in REBL?

Stefan20:06:45

@lilactown So I would probably be best off creating two aliases, one with main for clj cli and one without for Calva?

pez20:06:57

I think that’s what @lilactown meant by middleware.

lilactown20:06:21

Re: aliases, probably for now yeah. You'll need to use some middleware

Stefan20:06:24

Oh right I missed that sorry

Stefan20:06:10

completely out of my league here 🙂 does that exist?

lilactown20:06:45

I'm using that branch with Emacs and it works alright

lilactown20:06:40

You'll need to specify the middleware to be loaded via the jack in command tho so I'm not sure you can use it with Calva automatically

Stefan20:06:07

Sounds like something @pez can solve 😉

pez20:06:41

Yeah, I agree.

lilactown20:06:48

I think what this whole situation is about is that people who want to use some of these more "advanced" tools need finer grained control over the jack in command

Stefan20:06:13

While we’re at it, what’s wrong when I get “unable to resolve symbol: slurp in this context”, that’s on clojure.core…

Stefan20:06:26

Should always be available, right?

lilactown20:06:38

In Emacs there's a way to execute jack in that prompts for the exact command to run to start the Clojure process

pez20:06:02

Yeah, that is not easy to do with Calva…

lilactown20:06:16

As well as project-level config via a file

pez20:06:38

@stefan.van.den.oord, have you loaded the file?

Stefan20:06:26

Ahhh, that simple eh. :+1:

pez20:06:03

It was? Yeah, I should probably make loading files automatically default behaviour in Calva and people who do not want it need to disable it, because it is causing confusion like it is now.

Stefan20:06:27

Yeah that would definitely be helpful for me 🙂

Stefan20:06:42

Gotta consider auto-namespace switching too then, though, keep reloading it?

pez20:06:46

Often loading the right file works. It will load all its requires and such.

Stefan20:06:33

Sounds good to me!

Stefan20:06:45

To be honest I’m thoroughly confused about the build-side of things with clojure. I started doing cljs a few months back, with shadow-cljs, and that seemed clear enough, but now with clojure there’s leingingen, boot, tools.deps, … 😞

pez20:06:22

yeah, lots of options. shadow-cljs really shines in making it simple.

Stefan20:06:55

What should I pick for a fresh clj project today you think?

lilactown20:06:49

The mental model of Clojure and CLJS is very different too. CLJS is a static compile of code to JS. Clojure is usually interpreted in process

lilactown20:06:02

On startup at least

pez20:06:57

deps.edn for sure, @stefan.van.den.oord. Maybe @dominicm can make a case for you using Edge.

Stefan20:06:18

Right, off to bed. So @pez in summary, I don’t think I’ll write that wiki post just yet, because without the “middleware” to integrate it, it doesn’t make a lot of sense I guess.

pez20:06:51

Maybe you can write the issue asking for the middleware support? 😃

Stefan20:06:05

Sure thing. But bed first 😉

pez20:06:15

I haven’t been using REBL. (Will fix that flaw.) Does it makes sense to think of it as a better REPL prompt? I am trying to figure out how to design an integration well.

Stefan20:06:07

Editor integration is shown near the end iirc.

lilactown20:06:39

I think it’s better to think of it is as like a tool for data inspections / introspection

lilactown20:06:17

kind of like the CIDER inspector, or the browser dev console

lilactown20:06:28

I would never type into REBL (though it has a prompt), but having results of expressions executed in my REPL show up in REBL is good

pez20:06:35

Sounds a bit like how I use the REPL prompt.