Exploring DelphiLSP: A Small Experiment

Today I got curious about Embarcadero’s DelphiLSP – the Language Server Protocol implementation that powers code intelligence in the Delphi IDE. I wanted to understand how it worked under the hood and whether it could be useful outside of RAD Studio.

The result was DelphiLSP Tools, a pair of small Delphi applications:

DelphiLspProbe is a console utility that connects to DelphiLSP and dumps its capabilities to a JSON file. It’s useful for seeing exactly what the language server advertises it can do – hover information, code completion, go-to-definition, and so on.

DelphiLspHoverDemo takes things a step further with a simple VCL GUI. You can load a Pascal source file, hover over identifiers, and see the type information that DelphiLSP returns. It uses SynEdit for syntax highlighting and implements the basic LSP handshake, file synchronization, and hover requests.

Both tools communicate with DelphiLSP via stdin/stdout pipes using JSON-RPC 2.0, which is how all LSP servers work. They auto-detect DelphiLSP’s location from the Windows Registry, so they should work with any recent Delphi installation.

The Honest Truth

I never got much real use out of these tools. DelphiLSP is tightly coupled to the Embarcadero licensing system, which limits its usefulness as a standalone component. The experiment was interesting from a protocol perspective, but it didn’t lead anywhere practical for me.

That said, the code demonstrates a working LSP client implementation in Delphi, which isn’t something you see often. If you’re curious about how LSP works or want a starting point for your own experiments, the source might be helpful.

The code is available on SourceForge: https://sourceforge.net/p/delphilsp-tools/code/HEAD/tree/

Requires Delphi 10.2 or later to build.