Cursive 1.11.0-eap1

233 views
Skip to first unread message

Cursive

unread,
Aug 3, 2021, 8:46:21 AMAug 3
to cur...@googlegroups.com

Hi everyone,

Cursive 1.11.0-eap1 is out. It’s a fairly experimental release containing support for scripting with Babashka, something which util now has been pretty painful with Cursive. It also fixes a bug, but that fix is also fairly experimental - more below.

Babashka has been difficult to support in Cursive because it contains a lot of implicit dependencies which Cursive doesn’t know about when resolving symbols. Here’s how the new support works right now. Depending on how well all this works it may be subject to change in the future, but I hope not. There is also not as much validation as I’d like that all these parts are in place at each step, so if you stray too much from this path you may see weirdness.

  1. Ensure you configure Deps - if you’re working with Babashka, I assume you’ve already done this.
  2. You will need the very latest Babashka, 0.5.1, which has just been released at the time of writing this.
  3. You can then add Babashka support to a module using a facet, which is a standard IntelliJ structure often used for things like frameworks in the Java world. In File | Project Structure, select Modules and then select the the module you’d like to add support for. Click + and select Babashka. Hopefully Cursive will default the path to your bb install correctly, but if not, enter the path there. Assuming all looks good, press OK and you should see a Babashka library in your project view under External Dependencies.
  4. You will probably have script files around which look like Clojure files but are actually Babashka scripts. Once you have the facet configured you can right-click on these files and mark them as Babashka scripts. This will cause their icon to change, and the symbol resolution in those files will now use the Babashka library instead of the module dependencies.
  5. There’s also a new Babashka Local REPL run configuration type which will allow you to start a Babashka REPL. The Remote REPL runtime type now also understands Babashka over nREPL, so you can start a REPL on the command line and connect to it using that as well.

There’s still more to do on the Babashka support, in particular this release doesn’t do anything at all with bb.edn. So if you’re adding extra dependencies via that those won’t work for the moment, and there’s no task running support yet either. I also want to support socket REPLs with Babashka which won’t work currently. There’s also some funkiness in the REPL completions which needs investigating.

There’s also a fix for a problem with the Deps support. Deps doesn’t provide a way to name projects, and this is a problem when syncing to IntelliJ because it requires modules to have a name. Previously Cursive would just name the module using the name of the directory containing the project, but it was often the case that projects would have multiple directories called “api” or something similar. Cursive will now try to name these modules using the names of directories above the project until the module names are unique. This means that module names might change when syncing if a new project has been added in a directory which causes a name conflict where one wasn’t present previously. I’m considering this change experimental for the moment as well since I’m not sure if this might cause subtle problems.

In the greatest tradition of experimental builds, just after releasing this I’m going to go away hiking with my family for the rest of the week. So I hope it works :-). If this release does break anything for you for any reason, you can always downgrade to the stable release.

Since IntelliJ 2021.2 is now out, Cursive will no longer support IntelliJ 2020.2 as of this release.

Here are the issues:

Added
  • Babashka problem inventory #2516
  • Support babashka as valid REPL target #2452
Fixed
  • Deps Sub-modules with same name do not resolve correctly in IntelliJ #2391

Cheers,
Colin

Reply all
Reply to author
Forward
0 new messages