Inline REPL results

Sep 2, 2024

I'm doing something a bit different for this release. It's a big change in the default workflow, and since I suspect that a decent number of people don't read the release notes before upgrading, I'm initially releasing this as a development build that you'll have to download manually to try out. You can download the latest build here and install it using Settings→Plugins, clicking on the gear icon and choosing "Install from disk...", or just searching for the action. This build is only available for 2024.2, but it will be available for all versions once I do an EAP release.

With this release, Cursive now supports showing evaluation results inline by default. As a result, it does not show the REPL toolwindow 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.