1

I want to write a simple LSP server to provide autocomplete that will work with any number of IDEs and Editors that are LSP tools.

On the topic of startup, the LSP specification does say the following:

The current protocol specification defines that the lifecycle of a server is managed by the client (e.g. a tool like VS Code or Emacs). It is up to the client to decide when to start (process-wise) and when to shutdown a server.

source emphasis my own

However nowhere in the specification can I find how the development tool (client) actually launches the server.

The spec just continues straight into the Initialize Request which requires the client and tool already to be connected.

So 2 questions:

  1. If I develop a languageServer.exe that uses a RESTful API over HTTP to communicate with the LSP tool, is there some standard entrypoint where my server and client can agree on what port to use.
  2. If I develop a new LSP tool how can I get some LSP Server from a VSCode extension and launch and connect to it. Is this standard?
Greedo
  • 4,967
  • 2
  • 30
  • 78
  • 1
    A specification can only take you this far. For both questions, go to the text editor you really want to integrate with and there are specific samples. For example, VS Code has so many language extensions (including mine) that you can use as guides, but you seemed to have checked none. So, I totally disagree with your "nowhere can I find" conclusion. – Lex Li Dec 10 '22 at 20:04
  • 1
    Every client has a specific way to set up the server. For VSCode, see https://code.visualstudio.com/api/language-extensions/language-server-extension-guide. You will need to call `new LanguageClient(...)` with the server options set up to your executable for the server, then `start()`. – kaby76 Dec 11 '22 at 13:45

0 Answers0