potato face
CryingPotato

When You Don’t Have Docs, Look at Tests #

Anytime you do something off the beaten path in the world of software, you have one of two choices:

  • reverse engineer the base concept from a couple of RFCs and a reference implementation
  • find a couple of libraries that do exactly what you want, but are poorly documented

As a concrete example, I was trying to figure out how you connect to the Astro LSP locally. I started off by reading the LSP specification, but quickly got bogged down by details around how to give requests. I learn best with experimentation, so I moved on to finding a library I could use to connect to LSPs locally. I found ts-lsp-client and pylspclient, both of which are sparsely documented. The VSCode reference implementation looked way too complex. And then I realized both those libraries had tests, and the tests had a working way to connect to those LSPs!

My original goal was to connect to the Astro LSP, so sticking to the pattern above, it’s time to take a deep dive into the Astro LSP test suite.