Cursive 1.14.0-eap1

Sep 13, 2024

Cursive 1.14.0-eap1 is out, adding support for the new IntelliJ 2024.3 EAP. Apart from that, the flagship new feature is inline evaluation. Cursive now supports showing evaluation results inline by default, in a navigable tree view called the seeker. As a result, it does not show the REPL toolwindow by default when the REPL is started. Since a picture is worth a thousand words, here is what this looks like:

When you have multiple REPLs running, Cursive can't always know which one you are intending to use. If you have a Clojure and a ClojureScript REPL running (a website and its backend, say), then if you evaluate from a Clojure namespace Cursive will use the Clojure REPL, and if you evaluate from a ClojureScript namespace then it will use the ClojureScript one. There is a REPL selector in the status bar at the bottom of the window, which will indicate which REPL will be used for the namespace of your current editor.

However, if you execute code from a CLJC namespace, then Cursive cannot tell automatically which one to use. Similarly, you might have two Clojure REPLs running corresponding to different areas of your project, one REPL for development and another for integration tests, or something similar. In these cases, the REPL selector will show "Multiple", which indicates that it would be possible to use multiple REPLs for the current namespace. In this case, when you evaluate something, you will get a popup asking you to choose which one to use. You can also click on the selector to configure which REPL should be used for different parts of your project, and Cursive will use that to select that REPL if possible:

This can also be configured in the settings at Settings → Languages & Frameworks → Clojure → REPL → REPL scope settings. Here, you can also configure custom scopes that you have defined at Settings → Appearance & Behavior → Scopes if required.

This workflow doesn't work for everything, and it's a non-goal to make it do so. There are still cases where you'll need the REPL window open, particularly around stdout/err. Output which can be captured due to the evaluation of a form is shown inline, but sometimes output comes out asynchronously from tests, or just in a way that isn't captured via *out*. Sometimes it is useful to be able to quickly scan large amounts of output, and when pair programming seeing the eval history can be useful too. There are also still some usability issues - local REPLs can be killed using the process toolbar buttons, but stopping remote REPLs can currently only be done via the panel. There are progress bars when starting REPLs and loading files, but there's currently no indication that anything is happening when evals take a long time.

And of course, some people have also already mentioned that they just don't like having REPL results inline, and want to continue using the REPL pane as they have previously. Cursive still fully supports this, and will continue to. The relevant config flags are Settings → Languages & Frameworks → Clojure → REPL → Show REPL evaluation results inline in editor and Settings → Languages & Frameworks → Clojure → REPL → Show REPL toolwindow when starting REPLs. With those disabled and enabled, respectively, Cursive should work as it did previously - please let me know if that's not the case.

That said, I was also initially skeptical but after using this for a while, I really like it. As mentioned above, it's not for 100% of cases, but for most standard cases I like it more than the way it worked previously. I hope you'll at least try it out even if you're initially not convinced, and let me know what you like or don't like about it.

There have also been some other improvements which didn't make it into individual issues. Management of REPL commands has been improved, you can now export them to and import them from the clipboard, as well as moving them between project specific and global. There's autocomplete when entering substitutions in the editor, and there are a couple of new ones as well to get the name of the current project or module.

Finally, apart from a few minor fixes and improvements, the sleeper feature is a new action called Code → Reformat Form, which will be enabled when you have a Clojure form selected. It will reformat it and break lines up, which is really useful when dealing with forms that have been printed in a single line.

Here are the issues:

Added

  • Automatically create run configurations on project open/creation #2951
  • Support for inline form evaluation + watching #391

Changed

  • Update rainbow parens colours to use colour palette from new UI guidelines #2948
  • Show directory in editor tabs for non unique file names #2946

Fixed

  • Synchronizing Leiningen projects give errors about writing in EDT #2952
  • Test exceptions/errors not printed in the REPL #2950