Skip to content

Instantly share code, notes, and snippets.

@wdhowe
Last active February 3, 2024 21:27
Show Gist options
  • Save wdhowe/2d6cdf20bf8cdd2c53deb95da1b34a21 to your computer and use it in GitHub Desktop.
Save wdhowe/2d6cdf20bf8cdd2c53deb95da1b34a21 to your computer and use it in GitHub Desktop.

Clojure Development with VScode

Clojure development environment in Microsoft VScode.

Software Install

  • Install Microsoft Visual Studio Code via download or your package manager.

Ubuntu

snap install code

Extensions Installs

  • Open vscode, go to: File > Preferences > Extensions

Extention CLI

  • List Extensions Installed
code --list-extensions
  • Install an Extension by extension id - calva example
code --install-extension betterthantomorrow.calva

Useful extensions

General Use

  • Awesome Emacs Keymap (tuttieee.emacs-mcx) -> Emacs keybindings with system clipboard integration.
  • GitLens (eamodio.gitlens) -> Visualize code authorship, browse repos.
  • Rainbow CSV (mechatroner.rainbow-csv) -> Hightlight CSV files in different colors and run SQL like queries.
  • Remote - SSH (ms-vscode-remote.remote-ssh) -> Open folders on remote machines using ssh.

Clojure

  • Calva (betterthantomorrow.calva) -> Integrated REPL, formatter, Paredit.

Documentation

  • Markdown All in One (yzhang.markdown-all-in-one) -> Markdown previews.
  • markdownlint (davidanson.vscode-markdownlint) -> Markdown linting and style checking.

Configuration

Items to configure.

Remote - SSH Config

Pre-Reqs:

  • You have a ssh keypair (private/public key)
  • The remote system has your public key in its ~/.ssh/authorized_keys

Create a ssh config file.

  • Create a new plain text file. Example location:
    • Linux: $HOME/.ssh/config
    • Windows: $HOME\ssh\config
  • Example contents:
Host devel-system
    HostName system-name-here.example.com
    User MYUSERNAME
    IdentityFile "PATH-TO-SSH-DIR/ssh-rsa.key"

Use Extensions

Remote - SSH Use

Connect to a remote system using the created ssh config:

  • Open the command palette (ctrl+shift+p or View > Command Palette)
  • Search "connect to host", enter or click on the appropriate ssh command (use current window or open new).
    • Answer the questions to use your ssh config file or select a host if already configured for your ssh config file location.
  • Once connected, open a folder on the remote system via normal vscode menus/shortcuts. (ctrl+k ctrl+o)

Calva

Learn some of the Calva shortcuts to help with repl connected editing: https://calva.io/commands-top10/

Start the Calva REPL (jack-in):

  • Navigate to a clojure project directory
  • Execute: "ctrl+alt+c" , release, then "ctrl+alt+j"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment