Configuration

In this section we’ll briefly examine some common configuration options related to ClojureScript. Configuration that is specific to a particular REPL (e.g. shadow-cljs) is covered separately in the individual REPL setup sections.

Modifying the ClojureScript jack-in dependencies

Out-of-the-box, CIDER injects a single dependency into ClojureScript REPLs - namely piggieback. If you’d like to inject more deps you’ll have to modify the cider-jack-in-cljs-dependencies variable. Here’s an example:

;; let's add Weasel on jack-in
(cider-add-to-alist 'cider-jack-in-cljs-dependencies "weasel/weasel" "0.7.1")

Typically, modifying this variable is not needed, as ClojureScript dependencies are declared explicitly in your project configuration most of the time.

Modifying this variable will affect all ClojureScript REPL types.

Setting a Default ClojureScript REPL Type

If you frequently use the same ClojureScript REPL, you can set cider-default-cljs-repl and CIDER will skip the prompt and use this instead. For example, the following will make Nashorn the default:

(setq cider-default-cljs-repl 'nashorn)

Defining Custom ClojureScript REPL Types

All supported ClojureScript REPLs are stored in cider-cljs-repl-types. If you need to extend it, you should use cider-register-cljs-repl-type in your Emacs configuration.

(cider-register-cljs-repl-type 'super-cljs "(do (...))" optional-requirements-function)

You can also modify the known ClojureScript REPLs on a per-project basis using .dir-locals.el:

;; replace the list of REPL types and set some default
((nil
  (cider-default-cljs-repl . super-cljs)
  (cider-cljs-repl-types . ((super-cljs "(do (foo) (bar))")))))
;; modify the list of known REPLs and set some default
((nil
  (eval . (cider-register-cljs-repl-type 'super-cljs "(do (foo) (bar))"))
  (cider-default-cljs-repl . super-cljs)))

For one-off REPLs you can also use the custom REPL init form like this:

;; modify the list of known REPLs and set some default
((nil
  (cider-custom-cljs-repl-init-form . "(do (foo) (bar))"
  (cider-default-cljs-repl . custom)))

If you already have a Clojure REPL running and want to add a ClojureScript REPL, you can invoke cider-jack-in-sibling-clojurescript to add it.

Enhanced Completion

By default CIDER will enrich the ClojureScript completion results using the suitable library. If case you run into any suitable-related issues you can disable the enhanced completion like this:

(setq cider-enhanced-cljs-completion-p nil)