Skip to content

lsp: Add default communication via stdout/stdin #650

@flofriday

Description

@flofriday

Currently the TCP port is hard-coded which means that on each machine only a single instance of the LS can be running.
Even with the option to specify the port, we're moving the problem the problem just a bit up because then we'll have to implement strategies for port choosing and recovery if the chosen port is already in use.

Many LSPs avoid this set of problems all together by using stdout/stdin as the communication for the protocoll and stderr exclusively for the logs.

It's probably still a good idea to leave in the option for a communication via TCP for development ergonomics.

Example: Gleam LSP

The gleam compiler comes with a build in LSP and starting it looks like:

Image

As you can see it prints a short message (to stderr) and then waits in a loop for LSP messages via stdin.
I'm particularly found of this message and I think we should implement something similar.

Sidenote: I also like that it comes with the same binary as it makes packaging the lsp much easier but that will be problem for a future issue.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions