Refactor Clojure Code

General refactor steps such as changing function names can be done with the Evil tools, iedit, narrowing and helm-ag. These do not require a running Clojure REPL. Examples of refactoring names: within a function, within a namespace, within a project.

Structural editing via the SPC k lisp state uses smartparens to alter the your code whist respecting the structure, as defined by parens, [ ] { } ( ) and even " ". Smartparens works for all languages, although is most useful with lisp syntax.

Refactor Approach Usage
narrowing refactor in function on region (usually with iedit)
iedit refactor in current namespace
helm-ag project wide refactor (usually with iedit)
lisp state A state for smartparens structural editing
clj-refactor , r for clojure specific refactor commands (optional package in Clojure layer)

Clojure REPL based refactoring

Clojure specific refactor commands are in the clojure mode refactor menu, , r provided by the package clj-refactor. These refactor commands typically require a running Clojure REPL

Use , e u ()cider-undef when changing a name of a var (def, defn) to keep the REPL clean of stale names. Or if

results matching ""

    No results matching ""