LSP client in Clojure in 200 lines of code
a year ago
- #Programming
- #Clojure
- #LSP
- The blog post details the creation of a minimal LSP (Language Server Protocol) client in Clojure, under 200 lines of code.
- The LSP client implementation includes a base communication layer, JSON-RPC for message exchange, and a wrapper to interact with language servers.
- The author discusses the challenges of integrating LSP for command-line linting, noting that most language servers prefer notifications over request/response for diagnostics.
- A practical example demonstrates linting files using a language server, highlighting the initialization and shutdown process required by LSP.
- The post concludes with reflections on LSP's benefits for text editors and its limitations for command-line tools, along with critiques and defenses of the protocol.