calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
bringe 2021-01-31T00:06:56.403400Z

I do think it would be nice if certain parts of Calva could be made available as separate projects/libraries. However, this is a ton of work and not a priority at all, with everything else that is a priority. If we expose things, even if we say the API is subject to change, when we do change it and break others' workflows/projects, then we likely will hear about it. It's just not something we want to spend time worrying about or managing at this point in time. If you feel that you'd like to pull some things out of Calva for your own use, then please feel free to do so. Or, if you want to just keep a forked version of Calva with some customizations for yourself, you could do that too and keep it up to date with Calva's published branch. And for some things you desire that make you want these features exposed, there may be other solutions within Calva rather than exposing those features.

Cris B 2021-01-31T00:36:35.418400Z

To echo your comment a bit, @eric.uitbeijerse- I started learning Clojure mid last year, then that project fell aside for the usual kinds of reasons, and now I'm having another crack at it. I was a slightly unlikely Calva user. I had once been an Emacs enthusiast, then switched to IntelliJ Idea & Appcode mainly because of the kinds of projects I was working on. I came to really love the Jetbrains platform, and had never thought much of VSCode, so Cursive was a natural fit. I tried it out and found it great (Colin Fleming has done a terrific job with it). I had a nagging feeling though that I would like to be able one day if I had time & ability to to contribute to the clojure IDE I was using. Given VSCode's reach and Calva being open source, I tried the VSCode/Calva solution for a while. Liking IntelliJ so much, I fully expected this to be a bit of a sacrifice. Well it wasn't. Sure, it had some bugs and missing features (what doesn't?), but it was generally pleasant to use and development was proceeding fast. Now coming back to learning Clojure after a few months, I find Calva development still going really strong. Anyway that's a huge preface (sorry if it's a tad indulgent) to thanking @pez and @brandon.ringe (the 2 names I've noticed - I'm sure there are others) for Calva. It must be a ton of work, which we get the benefit of. And VSCode's growing presence in the developer community makes Calva genuinely significant. Thanks! :spock-hand::skin-tone-2:

2❤️
bringe 2021-01-31T00:50:39.418700Z

Thanks @cb.lists and @eric.uitbeijerse! It's a pleasure to be a part of providing a good Clojure experience in VS Code, and a pleasure to be part of this dev community.

plexus 2021-01-31T07:38:14.419400Z

is it possible to customize the command line invocation that Calva uses to jack-in?

plexus 2021-01-31T07:39:12.420100Z

I'd like to test if replacing powershell.exe with pwsh.exe would help with this issue, but it seems the only way to do so is to create a custom Calva build... is that right? https://github.com/BetterThanTomorrow/calva/issues/997

pez 2021-01-31T07:45:20.424100Z

Not currently, @plexus. I have planned to make the windows executable configurable, because of the two versions of powershell. However, it is very easy to build Calva and experiment with this.

plexus 2021-01-31T07:48:38.424300Z

ok, thanks

pez 2021-01-31T08:40:41.425700Z

At a computer now. Did you find where this is configured, @plexus? It’s here, at line 282. https://github.com/BetterThanTomorrow/calva/blob/05a9c08d3a9e16427e4a9f36a0b7691a2e8d4fd0/calva/nrepl/project-types.ts

pez 2021-01-31T08:50:36.431100Z

I’m looking at how to make it configurable by the user. It doesn’t really fit in the custom repl connect sequences, where I first thought it would go. We could add a setting that is just calva.powerShellExecutable, but it is still a bit hard to discover. The whole #clj-on-windows story is complicated as hell… I’ve spent 100+ hours getting the quoting right, and it still fails on some machines. Maybe it is better to advice people to use WSL2 instead? I think that is what @seancorfield does when he helps people in #beginners.

borkdude 2021-01-31T09:28:36.432800Z

@plexus if you have bb installed on Windows, you can also invoke bb.exe --clojure which doesn't need powershell (same as deps.exe basically)

borkdude 2021-01-31T09:29:06.433200Z

I usually just cider-connect instead of cider-jack-in

1👍
pez 2021-01-31T10:11:12.433900Z

Hmm. Maybe we should bundle bb.exe....

borkdude 2021-01-31T10:13:31.434100Z

@pez or just the deps.clj uberjar, since you already use Java. I'm just not certain if people will appreciate Calva using a custom tools.deps runner ;)

borkdude 2021-01-31T10:14:11.434600Z

I guess you could also re-implement deps.clj to CLJS and invoke it using node :P

borkdude 2021-01-31T10:14:20.434900Z

PR to make it .cljc welcome ;)

borkdude 2021-01-31T10:14:54.435800Z

That might actually not be a bad idea, because any JS based editor can then use this to invoke clojure

pez 2021-01-31T10:15:35.436800Z

I think it may fall in that we do not get command line argument parsing that clojure gives us.

pez 2021-01-31T10:15:57.437300Z

I mean as a means to jack in.

borkdude 2021-01-31T10:16:09.437500Z

The command line argument parsing is implemented in deps.clj itself.

borkdude 2021-01-31T10:17:12.437900Z

What deps.clj does is basically replace the bash/powershell with JVM Clojure, but porting it to Node CLJS would be a logical next step

borkdude 2021-01-31T10:18:55.439800Z

but of course, feel free to bundle bb / deps.exe

borkdude 2021-01-31T10:19:09.440100Z

just make people aware they are using a different non-official tool

borkdude 2021-01-31T10:19:30.440800Z

non-official as in: not the official cognitect one

pez 2021-01-31T10:25:05.443500Z

The jack-in story has two sides to it: 1. As a beginner with Clojure it gets a bit too much to also need to understand the concept of editor dependencies. 2. Cooperation in a project gets easier if Calva doesn't demand changes to the project dependencies. It seems to mostly work. 70% or so of the repl sessions are started using Calva jack-in. Windows keep giving us grief. I think that might be why Windows exists.

pez 2021-01-31T10:28:08.446200Z

Cool. We can make it a project type. So at the gate you would make the choice (as a user). Also, I have plans for babashka in Calva, regardless. 😍

borkdude 2021-01-31T10:28:09.446400Z

I've always used cider-connect, as I do not want my dev process to die when my editor restarts

pez 2021-01-31T10:29:22.447900Z

Me too. We are adding a way to copy out the jack-in command line to the clipboard for this purpose.

pez 2021-01-31T10:30:12.449Z

That said Vscode restarting is very rare. I have uptimes of several months sometimes.

borkdude 2021-01-31T10:30:41.449200Z

Huh, that's not my experience. Often when an extension is updated or disabled it wants a restart

borkdude 2021-01-31T10:30:53.449400Z

And things can crash. I just don't find this reliable.

pez 2021-01-31T10:33:51.450200Z

Things can crash. It is just not common.

borkdude 2021-01-31T10:35:53.450400Z

Haha, optimist

clyfe 2021-01-31T13:12:14.454600Z

📣 calva-extras.backspacePositional added to https://github.com/clyfe/calva-extras :calva:

1👍
clyfe 2021-01-31T13:26:08.455600Z

Not ideal because it does not account for string context (https://clojurians.slack.com/archives/CBE668G4R/p1611839273287100 as Calva).

clyfe 2021-01-31T13:26:37.456Z

But does the job for me at the moment.

pez 2021-01-31T17:02:31.456400Z

So, I can now launch it on windows using a bundled bb.exe. Makes quoting easier as well. Question is if it will be allowed on all machines… It is a bit hard to make it an option because the quoting is different and some other process settings as well…

borkdude 2021-01-31T17:08:08.456600Z

@pez to make it easier, you don't have to invoke bb --clojure from the command line. you can do this from a script as well: script.clj:

(some-> (babashka.deps/clojure ["-Sdescribe"]) (babashka.process/check))
$ bb script.clj
Most quoting issues should disappear now, the invocation will be the same on all OSes

borkdude 2021-01-31T17:08:39.456800Z

if used from a script that is

borkdude 2021-01-31T17:09:20.457Z

so you could emit some temporary file that contains the invocation to not have to go through the command line

pez 2021-01-31T18:15:48.457300Z

Thanks. The thought has crossed my mind. There’s a bit of a point with having it on the command line though. It makes it transparent what command is being issued and people can copy that and use it for starting their project in a Calva friendly way.

practicalli-john 2021-01-31T20:08:17.470800Z

I've switched to using connect from all the Clojure editors I use (calva, cider, conjure) Using connect is much easier and far more flexible, especially with Clojure CLI tools. You don't need editor specific configuration to do anything interesting. Using a separate repl is really easy with some nice aliases in the user-level configuration for Clojure CLI tools. Using connect also make it easier to collaborate via a shared REPL on a remote server. And as others mentioned it's not tied to an editor, so I can use what ever tool is right for the task at hand. In some cases I have used a mixture of terminal UI and a couple of different editors to get things done effectively.

2👍
pez 2021-01-31T20:24:40.474200Z

I think we are a lot of people who generally use connect instead of jack-in. It’s easy when you get an understanding for how things work, not so easy for beginners. The vast majority of Calva users use jack-in, and that is good and as it should be. We need to make that work as well as we possibly can.

seancorfield 2021-01-31T20:27:57.475800Z

I think jack-in harms beginners -- because they don't start out by understanding the REPL: they just see it as something their editor "does". I think we adopt "easy" approaches far too readily instead of sticking with "simple" and teaching beginners how things actually work.

1👍
Stefan 2021-02-02T08:24:08.057300Z

Just a couple of more cents: half a year ago I started developing Clojure in my day-time job. I have been meddling around with it for some two years now I think. I’m a very experienced programmer, even a bit FP, but completely new to Lisp/Clojure/REPL/etc. I think in this situation there’s quite a big learning curve. So many things you have to learn and understand. So many options. Quite overwhelming frankly. So to me the easy jack-in of Calva was absolutely great, because it allowed me to just start using things without also having to figure out all the details of that part of the story. And today I still use jackin all the time, I don’t have a reason to start a REPL outside and connect to it. Maybe when I have a few more years of experience I will, maybe I won’t , but to me the jack-in is awesome 😍

2
pez 2021-01-31T20:42:55.476400Z

I have yet to see a beginner harmed by this.

alexmiller 2021-01-31T20:50:12.476900Z

Does jack-in require a project context?

alexmiller 2021-01-31T20:56:49.478100Z

That is, can I just open a new file and jack-in to start a repl? Not at a computer right now to try it

borkdude 2021-01-31T20:58:02.478400Z

I kinda agree with @seancorfield here

clyfe 2021-01-31T21:00:46.480900Z

I was pretty confused for a while "$%?!? this jack-in thing ?!". The name is good for cider dev, less so for user. Better name "repl-in".

1➕
2021-02-01T16:24:07.040300Z

Agree. I felt almost the same when I first knew about Jack-In. I get used to run a repl starting in a separate terminal. But now I often use Jack-In.

pez 2021-01-31T21:00:50.481Z

@alexmiller currently it does require a project context. But there is no particular reason it does. We should fix it. Please chime in on this issue: https://github.com/BetterThanTomorrow/calva/issues/855

pez 2021-01-31T21:03:41.481200Z

I know you do. And I think you are both wrong. 😃

seancorfield 2021-01-31T21:05:04.481400Z

What a terrible world it would be if we all agreed on everything... 🙂

pez 2021-01-31T21:06:28.481600Z

Indeed. 😃

pez 2021-01-31T21:07:52.481800Z

For the record, even if I am working hard with getting jack-in right, the connect story is also important and never forgotten.

pez 2021-01-31T21:16:49.482100Z

My experience is that I used to spend 90% of Calva support with helping people to get the editor dependencies right, constantly worried about all those who gave up without asking for support. Since releasing jack-in I instead spend the support time with helping people using their connected REPL. It is so much better.

1👍
alexmiller 2021-01-31T21:27:29.484700Z

Done

1❤️
alexmiller 2021-01-31T21:32:19.491300Z

I don’t think jack-in vs connect is inherently problematic. A beginner needs to understand they are “connecting to Clojure” but whether that’s in process or out of process is not really much different. Imo not needing to understand project context is more important (at first). We (Rich and others) have been working through better getting started directions for the Clojure site and I think a focus of that has been getting people to “editor with connected repl” first (not repl only - where nothing is persistent, that’s a dead end), and not project context (not needed, can be additive to what you’re doing later)

2👍
alexmiller 2021-01-31T21:34:15.493500Z

Jackin is nice in being able to keep you “in the tool” and defer needing to understand the details. I like that Calva is explicit about seeing the command and what’s happening there even if you’re launching in process

alexmiller 2021-01-31T21:34:45.494200Z

That at least sets the stage for learning more about how that works

bringe 2021-01-31T21:35:58.495300Z

I agree. It's awesome too that there's an effort by you and Rich and the others to improve the getting started directions for the Clojure site.

pez 2021-01-31T21:36:09.495700Z

Now we are talking!

bringe 2021-01-31T21:36:59.497100Z

To make an analogy (hopefully not a terrible one), learning to drive with an automatic transmission doesn't necessarily make it harder for you to learn to drive with a manual transmission.

seancorfield 2021-01-31T21:39:43.497300Z

@brandon.ringe Pretty much every tutorial starts with a plain REPL started from the command-line and has beginners typing directly into the console REPL -- so most users have the "start a REPL" experience under their belt before they try moving to a connected editor. But "typing directly into the console REPL" is also problematic in its own ways. I think both jack-in and type-in-console are bad for beginners. Overall, we do a terrible job of getting beginners up to speed with a "good" REPL-based workflow.

seancorfield 2021-01-31T21:42:23.497500Z

The problem with jack-in -- based on my observations over the years watching beginners here and elsewhere -- is that it "magics over" how the editor/REPL integration actually works -- and gives an (incorrect) impression that editor integration and command-line REPL are somehow two completely separate things. And when they run into problems with jack-in, especially around figuring out how to persuade the editor to start the REPL exactly like they do from the command-line, it becomes a very editor-specific and somewhat archaic process to debug and fix.

seancorfield 2021-01-31T21:44:16.497700Z

And the weird thing (from my p.o.v.) is that historically we used lein repl to get started at the command-line and it already starts a network REPL that most editors could connect to so we've missed the opportunity to simplify the overall process -- and decomplect the editor/REPL integration.

seancorfield 2021-01-31T21:47:20.499200Z

@brandon.ringe In England, if you pass your test on an automatic transmission, you are not licensed to drive a manual transmission -- or at least that used to be the case. You have to take your test on a manual transmission in order to drive a manual (and you are also licensed to drive an automatic at that point).

bringe 2021-01-31T21:47:37.499300Z

I agree with you on some of this. Though, I think the issue you speak of around jack-in isn't necessarily a problem with jack-in but with either how it's implemented or the supporting docs. We can provide a tool for making getting started easier while also educating them on what's happening, and how to perform the process themselves. Hopefully @alexmiller and others publish improved getting started material on http://clojure.org as he mentioned. I'm looking forward to that.

seancorfield 2021-01-31T21:48:11.499900Z

(and I can't resist seeing automatic transmission = easy vs manual transmission = simple 🙂 )

bringe 2021-01-31T21:49:11.000800Z

I agree with you with the easy vs simple argument, but we don't have to see easy as always bad. That makes sense to me, the separate driving tests, but I don't think it detracts from my previous statement.

seancorfield 2021-01-31T21:50:50.002400Z

(just to be clear: if you learn on manual and take a test on manual, you're licensed for both manual and automatic; if you learn/test on automatic, you can't drive manual until you've also taken a test on manual -- not sure if that was how you read it, given your "separate driving tests" comment?)

seancorfield 2021-01-31T21:51:24.002900Z

And, yes, our goal should be to make the simple path also be easy. Or easy enough.

bringe 2021-01-31T21:52:11.003700Z

I see, but I think it's good to give the user (driver) a choice like that.

bringe 2021-01-31T21:53:30.004800Z

I think the concept of jack-in is what makes the simple path easy, but like I mentioned before, how that's done is what's important.

seancorfield 2021-01-31T21:57:27.007200Z

Editor integrations requiring nREPL is part of why jack-in appeared and why it is "easy" -- especially when you switch from lein to the Clojure CLI. Another reason I think our reliance on nREPL is unfortunate by this point. Side-loading of nREPL into a plain Socket REPL will help, when that happens.

alexmiller 2021-01-31T21:57:43.007300Z

we have come to see "Pretty much every tutorial starts with a plain REPL started from the command-line" as bad and we should stop doing that

alexmiller 2021-01-31T21:59:08.007500Z

because there's nowhere to go from there. you're backing to starting over to get into an editor / files / projects /repl connected editor / structural editing

alexmiller 2021-01-31T22:00:39.007700Z

we should just be getting them to repl-connected editor and start in a file - everything from there is additive. (and just never type directly into a repl)

alexmiller 2021-01-31T22:02:07.008400Z

I find Clover with it's absence of even having a repl that takes stdin to be actually good in this regard - you have to eval from your editor if you want to do anything

seancorfield 2021-01-31T22:02:32.008900Z

@alexmiller Agreed. I keep repeating Stu's comment about "I'm always baffled when I see people typing into their REPL" (or whatever his exact wording was).

seancorfield 2021-01-31T22:03:01.009300Z

Yes, I also like Chlorine/Clover for that: no more typing into a REPL!

alexmiller 2021-01-31T22:03:37.010100Z

and that startup process you see with Clover/Calva could be even easier if you could easily launch a non-project REPL and jack-in to it

bringe 2021-01-31T22:03:49.010600Z

I see - so this more so can be boiled down to an issue with reliance on nREPL, at least in your mind. I know others might echo that sentiment, and I can't say I have a strong stance on that one way or the other. I'm much newer to Clojure than yourself though. 😄

seancorfield 2021-01-31T22:04:18.010700Z

But the elephant in the room at this point is nREPL: nearly all editors need it to talk to a REPL and while lein repl and boot repl start nREPL servers, the Clojure CLI doesn't.

1☝️
seancorfield 2021-01-31T22:05:01.010900Z

(and jack-in kind of papers over that by adding nREPL as a dependency behind the scenes)

alexmiller 2021-01-31T22:06:16.011900Z

well I have my own preferences there, but I think that is not important to a beginner (it's important to implementors of course :)

alexmiller 2021-01-31T22:06:45.012700Z

ideally I want any editor to support both, even if the experience is not the same

seancorfield 2021-01-31T22:06:51.013Z

If we'd had the Socket REPL built into Clojure from day one, I think we might never have seen nREPL, and all editors would happily connect to a plain Socket REPL and perhaps side-load some affordances (such as unrepl/unravel). But... at this point we'll never know 🙂

flowthing 2021-02-01T08:07:50.037200Z

I'm not sure it's quite that simple. 😛 I think it might be that Calva requires that your project is set up in a certain way. I just tried it and nothing happens if I try evaluating from a ClojureScript buffer. Calva also knows about Figwheel, shadow-cljs etc., whereas I don't want my editor plugin to have to know anything about the build tool du jour. Anyway, this topic is quite involved, and I don't want to take up more of your time with my blathering. 🙂

pez 2021-02-01T11:16:39.037600Z

I love spending time on talking about these things. 😃 Huge topic. For the record. though. Calvas repl session handling, including cljc toggle, was there long before Calva new anything about the build tool du jour. Pretty sure it is that simple. Haha.

flowthing 2021-02-01T11:25:58.038700Z

I believe you. In all likelihood, I'm just doing something wrong, not Calva. Wasn't trying to say that Calva is doing something wrong here. :) I'm not quite sure we're talking about exactly the same thing, though, and I don't know how to use Calva, so... Anyway, I guess my point is that with Clojure, I can just start an nREPL server in the Terminal. In my editor plugin, there is only one option: connect. Once the user does that, they're off. What I'd like to do is that if the user then opens a ClojureScript view, everything would work exactly as well as with Clojure — or as close as possible. Obviously, there are differences we can't really do away with. For example, the user must have a ClojureScript dependency, and they must select the JavaScript runtime environment (Node.js, browser, etc.) at some point. Calva might might work like that already, but there's just something I'm missing. I'll need to look into it at some point, when I'm a bit less busy with work.

flowthing 2021-02-01T11:27:00.038900Z

I don't have a clear picture in my head about the whole thing anyway, since the ClojureScript world is significantly messier than the JVM world (it seems to me, anyway), so it all's going to take some thinking.

pez 2021-02-01T12:00:15.039100Z

Yes, it is messier. What Calva does is something like so: 1. Create the Clojure REPL session 2. Clone it 3. Promote the clone to a ClojureScript REPL Promoting it is different between tools and also people create their own CLJS repls. What Calva “knows” about these tools is actually just convenience configuration. The users can create their own. We call it Connect Sequences. See https://calva.io/connect-sequences/ where you fid some example configurations at the bottom.

flowthing 2021-02-01T12:00:51.039400Z

Thank you! I'll definitely take a look. :thumbsup::skin-tone-2:

pez 2021-02-01T12:02:27.039600Z

It can be made a bit simpler than that, I think. Calva takes a bit of a “holding hand” approach- 😃

alexmiller 2021-01-31T22:07:42.013900Z

I think it's highly unlikely that we're going to recommend any getting started path on http://clojure.org that doesn't work with clojure cli

seancorfield 2021-01-31T22:07:54.014300Z

Yup, definitely. Clover/Chlorine support a wide variety of REPLs now -- including nREPL -- but also as simple as lumo etc.

alexmiller 2021-01-31T22:08:19.015Z

I've been using Clover some this week too and I do like the structure of that

1
pez 2021-01-31T22:08:52.015600Z

So, I created a feature request about helping people with those first Clojure steps. https://github.com/BetterThanTomorrow/calva/issues/1003 Please chime in, Calva friends.

alexmiller 2021-01-31T22:09:43.015800Z

but I realize all that stuff is hard from editor impl pov (I'm glad I'm not working on it and can just make unreasonable requests of others :)

1😄
alexmiller 2021-01-31T22:10:31.016Z

props to my oss maintainer brethren

seancorfield 2021-01-31T22:15:34.016200Z

It seems that the main things people want from editor integration that Socket REPL/pREPL don't provide out of the box are: 1) a way to interrupt long-running evaluation and 2) a way to manage evaluations that produce infinite (or very large) results. That's my perception, mostly based on talking to a few of the integration folks, so I don't know if that's the entire story.

bringe 2021-01-31T22:24:32.016500Z

I have to admit I also like that about Clover, the lack of ability to type into the "repl" window. I think part of the reason @pez has kept this is related back to the getting started tutorials. If we didn't allow that then beginners might be confused, ask questions, request we add it, etc., because they got started this way and may think that's the "repl-driven" experience people discuss (another issue with tutorials). I think in time it could be done away with though, and this would make maintenance of the repl window a bit easier too.

alexmiller 2021-01-31T22:27:22.016900Z

when I work (in Cursive primarily) I almost entirely "work" from my editor, but I do use the repl window to do a few things (mostly (pst *e) because I leave the repl window sitting in user with clojure.repl referred).

Cris B 2021-01-31T22:34:36.017200Z

There are different kinds of beginners - really there's very little in common between (say) a beginner-to-programming and a java-programmer-beginner-to-lisps. As an experienced developer starting with clojure I haven't found jack-in confusing. I naturally ignored the 'type into the REPL' instructions and started with a blank slate project in a connected editor. Over time as I've figured out the tooling (somewhat) I've backpedaled to using a manually-started REPL and then connecting. But jack-in was very handy to get a frictionless start with.

2➕
alexmiller 2021-01-31T22:39:34.017500Z

beginner-to-programming is a special case and not one that we as a Clojure core team is trying to satisfy. I think there is a great deal of commonality between new-to-a-lisp though

pez 2021-01-31T22:43:18.017700Z

The Calva REPL window is really just an editor (vs code speak for what Emacs calls a buffer), just like any other editor. It would be a bit strange if it didn’t allow evaluations just like the other files. When I first created it, I tried not giving it a prompt. But VS Code wouldn’t really let me. I needed a way to display the current namespace… Anyway, we try to encourage people to stay in their files. We’re Stu’ed like that. 😃

1👍
Cris B 2021-01-31T22:48:02.017900Z

I can quite see a total beginner not being a major case in point @alexmiller. I was assuming @seancorfield’s comments about the 'magic' of jack-in inhibiting gaining understanding of the real tooling story was about complete beginners. It's hard to imagine a reasonably experienced programmer falling into that?

seancorfield 2021-01-31T23:29:31.018200Z

It's not hard for me to imagine based on what I've seen here (and in other forums) over the years 🙂

1