What's New in Cursive 1.5.0?

May 5, 2017 by Daniel Compton

Cursive, the Clojure editor for IntelliJ released version 1.5.0 today. In this post I wanted to highlight a few big improvements that it brings to dependency management.

Adding Dependencies

The headlining feature in 1.5.0 is search and autocompletion for dependencies. Cursive provides this in two ways.

If you’re editing dependencies in your project.clj file, Cursive will now provide code completion suggestions for artifacts and versions.

Adding Instaparse to your project.clj file with autocompletion

The second way to add dependencies is to use the Generate command. You can do this from anywhere in your project. On macOS the default binding for Generate is Cmd-N, on Windows and Linux it is Alt-Insert.

Imagine you’re working on your project and want to require a namespace from a useful library. You go to require it, but realise you haven’t added it to your project.clj yet. You can use the generate command to search for the artifact and add it. Cursive will synchronise your project.clj automatically, and you can immediately require the namespace.

Adding Instaparse to your project.clj from the generate command

Synchronising project.clj

Cursive now detects changes to your project.clj file and will show you a notification to remind you to import your changes.

A dialog prompting you to import your Leiningen changes

You can also now refresh your project.clj by right clicking on it in the Project pane.

Refreshing Leiningen via right clicking on project.clj

Index maven repositories

The new dependency autocompletion features are built on top of the Maven Integration plugin, so be sure that you have it installed and enabled.

Searching for the Maven Integration plugin

Once its installed, open your preferences and navigate to Build, Execution, Deployment > Build Tools > Maven > Repositories.

Indexing Maven repositories

From there you can view the Maven repositories that Cursive has detected, and their indexing status. Select a repository and click the Update button to update the search index. This can take a few minutes for large repositories, and runs in the background. To my knowledge there is no way to schedule automatic updates for these repositories, so you’ll need to update them every now and then.

Other changes

There are a slew of other changes, fixing performance bugs, printing namespaced maps, generating stubs, formatting ns forms, and more. You can read about them in the release notes.