Skip to content

Using Calva with Remote Development#

VS Code Remote Development is a new feature in version 1.35 of VS Code that allows a developer to use a container, remote machine, or the Windows Subsystem for Linux (WSL) as a full-featured development environment.

I would recommend reading the introductory blog post and watching the videos. I find the feature extremely exciting and wish more IDEs would implement something like it.

From a Clojure perspective it allows you to have VS Code installed on your Java-less, Clojure-less hardware and still use it to develop Clojure through it.

A use-case#

  • For some reason your physical computer has to be running Windows (organizational rules etc.)
  • Your deployment environment is Linux
  • You want to edit files in an editor running on your physical computer
  • Most Clojure tooling is made with *nix first in mind and there are incompatibilities with Windows

How to#

Run Remote-Containers: Add Development Container Configuration Files... and pick a suitable Java base image. Then:

Modify Dockerfile to install Clojure CLI (and optionally lein)#


# ...

# Install Clojure - see
apt-get update && \
apt-get install -y curl make rlwrap wget && \
rm -rf /var/lib/apt/lists/* && \
wget$ && \
sha256sum linux-install-$ && \
echo "28b1652686426cdf856f83551b8ca01ff949b03bc9a533d270204d6511a8ca9d *linux-install-$" | sha256sum -c - && \
chmod +x linux-install-$ && \
su vscode -c "clojure -e '(clojure-version)'" && \
rm ./linux-install-$

# Install Lein
wget -O /bin/lein && \
chmod uog+x /bin/lein
RUN su vscode -c "/bin/lein"

# Cleanup
RUN apt-get purge -y --auto-remove curl wget

# ...

Modify devcontainer.json#

Add Calva and, optionally, forward some ports to the host::

"extensions": ["betterthantomorrow.calva"],
"forwardPorts": [8088, 52162], // example: your webapp, your nREPL

Build and start#

Run Remote-Containers: Rebuild and Reopen in container


See Using Calva with WSL