App Lab logo

Integrating Clem with Cursive

Clem is a program intended to make development with Clojure easier by helping explain Clojure’s sometimes cryptic error messages. It integrates with your REPL an uses an online database to attempt to find more human-friendly messages to explain your errors.

This post will go through the steps required to integrate Clem with Cursive.

This post assumes you have Cursive already installed (if not, follow this tutorial).

  1. Create a new deps.edn Clojure project

Select project type

  1. Choose a name for the project. For this example, will use clem-proj.
  2. Edit the deps.edn file so that it looks like this:

    {:deps {clem-repl {:mvn/version "0.1.2-SNAPSHOT"}}}

  3. Right click the top-level project directory and select New -> Directory, and name it src
  4. Right click the src folder and select New -> Clojure Namespace
  5. Give the namespace a name like clem-proj.core. Remember this namespace, we’ll need it later.
  6. Right click the top-level project directory and select New -> File, name the file .clem-repl.edn. The leading period is important.
  7. Edit .clem-repl.edn and include the following map:

    {:host-domain "http://clem.applab.unc.edu"
     :project-namespace 'clem-proj}

    The hostname is the URL to the server which hosts your clem database. This URL is the server hosted by the AppLab.

    The project-namespace is the root level prefix for your project. In this case it is simple clem-proj (the first part of clem-proj.core).
  8. Right click the top-level project directory and select New -> File, name the file .nrepl.edn. The leading period is important.
  9. Edit .nrepl.edn and include the following map:

    {:middleware [edu.unc.applab.clem-repl.nrepl-middleware/clem-caught]}
  10. Start a repl by right-clicking deps.edn and selecting Run REPL for clem-proj.
  11. Code as normal. Errors will be caught by Clem and compared to the database.