This is a study note on how to develop Clojure using VS code. It is based on the Calva Usesr Guide.
Calva is a REPL powered Clojure and Clojure Script development tool that supports inline code evaluation, Paredit, code formatting, a test runner, syntax highlighting, linting, and more.
To provide many of its IDE features, Calva relies on nREPL middleware, mainly
cider-nrepl and, for ClojureScript,
Jack in creates the command that starts Calva with these dependencies satisfied. The details are explained in Learn about Jack-in.
Jack-in supports Leiningen and Clojure CLI for Clojure. It supports Figwheel Main, shadow-cljs and Nashorn for ClojureScript.
Open a project root folder in VS Code, then
ctrl+alt+c ctrl+alt+j to open start Jack in, then specify project type and profile to start.
Calva only supports one project at a time per VS Code window. For a full stack project, create two workspaces and use them in two windows.
See Custom Connect Sequences for customizing Jack-in.
3 Code Evaluation
Calva has the notions of the
current form and the
current top level form. When you place the cursor to any code, it highlights the
current form. The
current top level form refers the various
defs such as
(comment ...) creates a new context for top level forms.
- Load current file:
- Evaluate current form:
- Evaluate current top-level form:
- Clear inline evaluation result:
- Copy last evaluation results:
4 Other commands
You can find all commands in
Feature Contributions in the Calva extension page. Commonly used commands:
- Expand selection:
Toggle pretty printing (
Run all tests:
Run tests for current namespace:
Run current test:
Forward Down Sexp:
Forward up Sexp:
Backward Down Sexp:
Backward Up Sexp:
Delet Sexp forward:
Delete Sexp backward:
Delete forward to end of list:
Delete backward to start of list:
Show preivous REPL history entry:
Show next REPL history entry: