Talks: LSP Demystified - How to write an LSP server in Python

Friday - May 17th, 2024 4:30 p.m.-5 p.m. in Ballroom A

Presented by:


In today's IDE-land, we've often overheard conversations between developers about new features being added to their editor-of-choice and how editor XYZ is better than ABC (vim vs emacs vs VSCode vs IntelliJ, we know the drill). This talk doesn't stoke fire to that debate in any direction (since different things work for different people). But, a very important tool that often powers most of the magical features that come with modern software development is the LSP server. The LSP server often keeps chugging in the background, tirelessly providing the user with diagnosis regarding the codes, autocompleting variables, and formatting the codebase to maintain prettiness. While various elements such as parsing, linting, and formatting have long existed, it is the LSP server that seamlessly unifies these features in an editor-agnostic manner.

LSP servers are used everywhere, often installed individually by the user even, but there aren't many resources regarding how to actually build a functional server that can do more than send /"Hello Editor World!"/ messages to the editor. This talk aims to fill in that gap to provide a blueprint of steps that anyone who wants to implement an LSP server in Python can follow. Following this talk will provide a better understanding of the JSON-RPC protocol used by LSP servers to communicate with the client, diagnosis that a server can share with the user and pitfalls that one can fall into while implementing their own server. It will end with a live demonstration of a toy-LSP server that provides the basic functionalities to an editor client.