Please help test, does your project work with Calva? If not, why not?

A Clojurist Together Funding story.

TLDR; Please help with testing that Calva can connect and enable the REPL in your projects.

Clean up those Project Files

One of the major things cooking in the Calva distillery right now is that we want to contribute to the community such that fewer Clojure and ClojureScript projects out there need to specify their editor tooling dependencies and setup. It has many benefits, which I won’t elaborate on here.

Connecting the REPL

Some terminology: Calva distinguishes between connecting to a running REPL – which we call Connect, and starting the REPL and connecting – which we call Jack in. These are terms and approaches inherited from the CIDER that Calva is distilled from.

Jack in is the mechanism which can make most of the difference in moving editor specific configuration out of the project and in to the editor settings. It is not as clear cut as either Jack in or Connect, however. Consider the ClojureScript REPL (other than the self hosted kind, that Calva yet can’t offer a REPL for). It needs to be started off of the Clojure REPL. A sort of Jack in, I would say, and it will need to happen even in the Connect to a running REPL case.

The Connect Sequence

As @kstehn and I discussed the need for improving Calva’s support for different kinds of Clojure and ClojureScripts projects, and I tried to describe it in different ways, Kevin suggested the concept of Jack in and Connect Sequences. Which is what we decided to model this feature around.

The prerelease linked above, and the issue to go with it is about:

  1. Adding Customizable Connect Sequences, via user configuration/settings.
  2. Defining Calva’s built in sequences using the customizable configuration mechanism. (This has moved a lot of code to just a little data, making this important part of Calva a lot more maintainable.)

Here’s a summary of what the linked prerelease adds to Calva:

  • Support for configuring Custom Connect Seqences. These can be:
  • Much improved custom ClojureScript REPL configuration.
  • Improved dependency injection at Jack in.
  • Improved help for the user to get the ClojureScript REPL connected.
  • Improved ClojureScript Build switching. (Since Calva only allows for two REPL connections (yet), one for Clojure and one for ClojureScript. It instead makes it easy to attach the ClojureScript repl connection to different ClojureScript builds in your project.)
  • A feature to add custom Clojure code to be evaluated when the Clojure repl has been attached. Maybe your project needs to start a web server before attempting to start a web client and connect a ClojureScript repl?
  • All built in ClojureScript REPLs are made using the Custom REPL Type configuration.
  • Nashorn added as a built in ClojureScript repl type.
  • Support for launching with user alieses/profiles

As the list reveals, in the process of adding this new feature, we have improved both Jack in and Connect, rounding off many of the rougher edges. This is, from that perspective, ready for realease. But I’d like to get some field testing done, in case there are projects out there that still can’t use Calva Jack in, but are in reach (for some definition of ”in reach”). And feeedback on the configuration and its documentation is very welcome as well.

How to help testing:

  1. Install VS Code, if you haven’t.
  2. Download the Calva v2.0.35-wip-custom-repl-connect-sequence prerelease (a VSIX package).
  3. From the VS Code Extensions pane, use the little meatballs menu to Install from VSIX… and install the downloaded VSIX package.
  4. Use the README, the Calva wiki, the comment section below, and the #calva-dev channel at the Clojurian’s Slack, to get going.

Happy helping! :heart:

5 Likes

Is there a list of plugin’s this doesn’t work with?

So far I’ve had issues trying to do some simple edits, for example hitting enter at the end of a line in a form jumps me midway through a form either in the next line or the one after that, and sometimes inside a symbol. It’s making me think that something in my setup is broken as I’d expect a plugin at this level of maturity should “just work” when doing editing.

Paste seems to not preserve parens, I’m having to pay far more attention to balancing parens manually, which I’ve not had to think about in a long time.

Also having done a jack-in: C-M-c C-M-j I’ve not yet seen my repl connect to calva, I always get a disconnected error. I’m unsure if there’s a step I’m missing or if it can’t connect.

AFAIK, That list would be:

  1. Parinfer

Which is unfortunate. But on the other hand the Parinfer extension to VS Code isn’t anything like what it is in other editors (because of limitations in the VS Code APIs).

Everything there surprises me. Editing files with Calva should just work. At times you might want to reformat some code and then tab should do it (it reformats the current list). I have no idea what could be going on… What other extensions do you have installed?

Where do you get this disconnected error? Can you screenshot it?

UPDATE: We decided to release v2.0.35 today. Mostly because it also fixes a problem with jacking in to the latest shadow-cljs.

We are still super keen on your feedback, of course.

This is after typing C-M-c e:

Note the REPL has successfully launched in terminal, it’s just not talking to it.
Is there some required deps that is not mentioned? I’m just using lein+figwheel.main.

Here’s an example of cursor ending up inside a symbol on hitting enter:
cursor-on-enter

I was expecting this:

(let [test 1|])


(comment)

to become this:

(let [test 1]
  |)


(comment)

Instead of what you see in the gif, but I wasn’t sure if that was supported behaviour.

EDIT:
I’ve updated and the cursor issue seems to have gone away.

Thanks! That doesn’t look good at all. Are you launching it with an alias? If so, try without that. Or, if you need the alias for something else than Figwheel dependencies, try making an alias that specifies repl :headless as the task.

Regardless, can you send me the whole Jack-in output as a PM?

If you have started this project from a template, I’d like to know which one, so that I can put it to a test myself.

I missed the gif in my first reading. Totally not expected behaviour! Glad it got sorted, I do hope it was a just a fluke. (And worried it was something else.)

I’ve tried it with no alias and that seems to work fine.
The alias in question is:

"fig:dev"   ["trampoline" "run" "-m" "figwheel.main" "-b" "dev" "-r"]

The template I’m using is figwheel-main-template:

lein new figwheel-main hello-world.core -- --reagent +deps

Thanks again. We (as in the Calva team) will need to figure about the documentation and UI/Ux here.

Guessing a lot of people will try with that alias, unless we find a way to deal with it.

I tried to send a PM of the jack-in output, but it’s not allowing me…

Update again:

Now there is also support for Leiningen and Clojure CLI projects using shadow-cljs.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.