Examples

LSP servers are not easy to demonstrate succintly, because the only way to confirm it actually works is to use it with a LSP client - usually an IDE.

Additionally, various editors require various degrees of effort. Simplest one I found so far is in Neovim Nightly, see https://www.vikasraj.dev/blog/lsp-neovim-retrospective#into-the-future.

LSP for Tree Sitter grammars

Grammar.js LSP

Designed to make my life easier when working with Tree Sitter grammars, this LSP parses a subset of JavaScript the acorn library, builds an index of rules and their reductions, and makes it easier to preview rules and use things like go-to-definition.

Because this LSP needs to parse JS using a JS library, the entire server is packaged using Scala.js as a Node.js application.

LSP for a toy language

Quickmaffs

Designed to serve as the testbed for Langoustine changes, it's a small primitive arithmetic language with associated set of tooling and built-in LSP.

This particular example runs on the JVM and uses Scala CLI exclusively for packaging.

Another LSP for a toy language

Badlang

Made by Jakub Kozłowski for various versions of his talk about building a language and a LSP for it.

Check out the talk at Lambda Days 2023 which also showcases the usage of Langoustine Tracer.