
Language Server Protocol - hota_mazi
https://github.com/Microsoft/language-server-protocol
======
sctb
Previous discussion:
[https://news.ycombinator.com/item?id=11988446](https://news.ycombinator.com/item?id=11988446)

------
Eridrus
I'm on the fence about this, standardization let's people pool resources to
provide common functionality, but it also ossifies the interface so that doing
anything _not_ supported by the interface becomes harder than before.

The first thing that pops into my head is that for languages with
interprocedural type inference, I really want my IDE to show me what types it
has inferred, but this is outside the spec and not even applicable to all
languages.

~~~
hitr
With this,a new language can have an IDE integration done easily which can
cover say 95% features. Some language specific feature may be obviously left
out but getting a minimum viable integration to any supported IDE is a good
thing.May be when this protocol evolves,it can give extension to the protocols
to cover the other 5% features(or may be it is already there)

~~~
Eridrus
Heh. We'll see. Writing the glue code is not what makes writing language
analysis hard. This is clearly a move to make the lives of IDE writers easier,
rather than those who would be writing the analysis code.

~~~
euyyn
But it'd make your analysis code work for multiple IDEs and editors instead of
having to learn about each's peculiarities. One less thing to worry about is
always good.

------
jntrnr
We're considering moving the new Rust language service over to this protocol,
or possibly, having it as a default protocol while supporting other protocols.

Since I've been learning it recently, maybe some points to help understand it:

It's _just_ the protocol piece. Currently, VSCode will stand up the language
server and communicate using the protocol over stdin/stdout. Nothing to say
they couldn't support http servers in the future, but currently it seems lower
level that that.

They do support hovers, which you can use for seemingly anything. We currently
are using them for type information and showing API docs.

I'm hoping this takes on with other editors, as once they support it, then
they'll get the stronger language support the servers provide, which can do
hovers, on-the-fly error checking, code navigation, and more. It's not
perfect, but as a baseline set of features, it's a pretty good starting set.

------
Edmond
This is great! Abstracting away static code analysis is very helpful for
people like us building browser based dev tools.

I am the developer of HiveMind (crudzilla.com), I have been dragging my feet
about plunging into static code analysis so this type of solution is
definitely intriguing.

------
qwertyuiop924
Well, us emacs users will finally get some decent autocomplete. So that's
nice, I suppose.

This actually sounds an awful lot like what Grok was trying to do. Any
relation in the development?

~~~
lann
See Kythe (Google OSS): [http://kythe.io/](http://kythe.io/)

~~~
qwertyuiop924
Heh. Neat.

------
falcolas
I only glanced through the document, but I didn't see anything which could
verify that the "Tool" and the "Language Server" are both referring to the
same content. Is there a mechanism for handling this kind of synchronization
drift?

~~~
icholy
See TextDocumentSyncKind and TextDocumentItem.

------
eatonphil
Does anyone know what tool was used to create that diagram?

~~~
rkangel
I very much doubt it was used in this case, but
[https://www.websequencediagrams.com/](https://www.websequencediagrams.com/)
is great if you want to do Message Sequence Charts.

------
protomyth
What happens when I don't have internet access? Do I install a second piece of
software on by box?

~~~
killercup
The "server" in "language server" does not mean "server you access over the
network" but "other process (on your machine) your editor talks to". (This is
just the spec for a protocol.)

~~~
protomyth
Can it be on across the internet? So, Apple can or cannot set up an internet
service for Swift? If I think I have a better version can I point my editor
towards that? If I program in a couple of languages, do I need to get ahold of
servers to install?

~~~
Etzos
> Can it be on across the internet?

In theory, yes the protocol can be used across the internet, but that would
raise plenty of issues (security being a huge one). This is designed so that
any program, like an IDE, can get code analysis and more without having to
build special handling for each of them.

> So, Apple can or cannot set up an internet service for Swift?

Again, in theory they could. But why would they do that? Just run the server
locally and get all the information there.

> If I think I have a better version can I point my editor towards that?

Yes. You simply stop the currently running language server and start the one
you want to use instead.

> If I program in a couple of languages, do I need to get ahold of servers to
> install?

Yes. Each language would, in theory, provide its own server to do analysis. Of
course, your favorite IDE would likely be more than happy to start the server
for you if it's not running yet (as it's just a small process that runs in the
background).

If you want to see how this works in practice just grab Visual Studio Code and
start editing a Typescript file. This is already in use there.

~~~
protomyth
> In theory, yes the protocol can be used across the internet, but that would
> raise plenty of issues (security being a huge one). This is designed so that
> any program, like an IDE, can get code analysis and more without having to
> build special handling for each of them.

I'm pretty sure I would be ok at part of teaching a class.

> Again, in theory they could. But why would they do that? Just run the server
> locally and get all the information there.

I was getting at that from the student-level. I'm pretty sure some metrics on
edge problems in a remote learning class might help with the material
revisions.

