Setting up an SBCL Common Lisp Language Server for VsCode

Posted on Aug 14, 2021

This document is to help me remember how I got the following working in the SBCL REPL:

  • C^a for (go to line beginning)
  • C^e for (go to line ending)
  • C^l for (clear screen)
  • C^p or up arrow for (previous command)

as well as how I got common-lisp-server vscode integration working.

LispCookBook is much better suited to the task of providing an intro to programming in common lisp.

Installing Steele Bank Common Lisp(SBCL)

You can install SBCL with your package manager. If your package manager for some reason doesn’t have SBCL, you can install SBCL with roswell.

I’m not a fan of roswell as I’ve seen some common-lisp packages/systems distributed in a roswell-first fashion. I think that common-lisp packages/systems should be designed in such a way that assumes the end user doesn’t have a particular common-lisp package manager installed on their machine.

This may seem somewhat irrational, but I haven’t yet found what I would consider to be a good package manager for common-lisp. So I believe that none of them are worth targeting.

Getting Readline-like REPL Behavior Without Roswell

mkdir ~/common-lisp
cd ~/common-lisp
git clone
git clone
git clone
git clone
git clone

echo -e "(require \"asdf\")\n(asdf:load-system \"sbcl-readline\")" > ~/.sbclrc

Getting Readline-like REPL Behavior Without Roswell

If you’re using Roswell, do the following:

ros install babel
ros install cffi
ros install alexandria
ros install trivial-features

cd  ~/.roswell/local-projects
git clone
echo -e "(require \"asdf\")\n(asdf:load-system \"sbcl-readline\")" > ~/.roswell/init.lisp

Common Lisp VsCode Integration

You’ll need Roswell for this step. It is possible to build the cl-lsp language server without any third party tooling such as Roswell or quicklisp(I don’t like quicklisp as it is easily subject to man in the middle attacks), but I have yet to develop a robust way to do this.

Change .bash_profile on the last line below to .bashrc if you’re on Linux.

ros install ailisp/cl-lsp
echo export PATH=\"$HOME/.roswell/bin:\$PATH\" >> ~/.bash_profile

And finally, go ahead and install this VsCode extension.