4 ms·
Possibly dumb question: what is a language server in this context and what’s it used for outside of the AST package?
by flaque 8y ago
Possibly dumb question: what is a language server in this context and what’s it used for outside of the AST package?
- blcArmadillo 8y agoLook at https://microsoft.github.io/language-server-protocol/ https://microsoft.github.io/language-server-protocol/ for more info. It's a standard interface IDEs can use for things such as autocomplete rather than every IDE having to reinvent the wheel.
- int_19h 8y agoTo add to this: the beauty of the protocol is that it uses JSON over stdin/stdout for communication. So if your language can make console apps, you can write a language server in it that works with any compliant editor/IDE - no FFI necessary, no need to learn how to author extensions for that editor etc. And, conversely, if your editor/IDE can fork a child process and redirect its standard streams, you can support any language server and not care about how it's implemented. I think this more than anything else has contributed to its rapid adoption, especially on Unix-likes.
- hawski 8y agoWhy was this downvoted? Is it not factual? If it's not, it would be far more helpful if it would be pointed out. If it's implemented as stated by int_19h then it's my favourite interface - stdio instead of FFI. So one could implement a server even in Brainfuck.
- int_19h 8y agoThe protocol itself is transport-agnostic - it just needs a bidirectional stream, and the spec doesn't define what it is. In practice, both stdin/stdout and sockets are used - the latter usually for language servers that are "heavyweight", such that it is advantageous to spin up the server once, "prime" it (let it do any indexing etc), and then reuse it between concurrent sessions. The standard streams are usually the default choice for simplicity reasons, though. Implementing a server in Brainfuck is theoretically possible, but only if you ignore the heat death of the universe as the upper time boundary. ~
- justaj 8y agoInteresting, I wonder if Vim is able to use this protocol as well.
- 21 8y agoIt's used by editors like Visual Studio Code to provide intellisense, autocomplete, breakpoints and the like. The idea is that instead of each editor writing it's own (incomplete) Python or Go plugin, someone writes a language server which is then used (and improved) by everybody.
- stephen82 8y agoAlso, I wanted to ask: how does this project compares to https://github.com/mdempsky/gocode https://github.com/mdempsky/gocode?
- rhodysurf 8y agoGo code doesn’t work with go 1.11 or at least I can’t get it to work.
- matloob 8y agomdempsky's fork of gocode should work with Go 1.11... and rstambler's fork of that fork (https://github.com/stamblerre/gocode https://github.com/stamblerre/gocode) should work with modules. * edit: mdempksy's fork should work with Go 1.11 used outside of a module or with GO111MODULE=off; Rebecca's fork adds support for modules on top of that
- icholy 8y agoIt doesn't work half the time.
- guessmyname 8y agoFrom the official website [1][2][3] > The Language Server protocol is used between a tool (the client) and a language smartness > provider (the server) to integrate features like auto complete, go to definition, find all > references and alike into the tool. The LSP was created by Microsoft to define a common > language for programming language analyzers to speak. Today, several companies have come > together to support its growth, including Codenvy, Red Hat, and Sourcegraph, and the protocol > is becoming supported by a rapidly growing list of editor and language communities. [1] https://langserver.org https://langserver.org [2] https://news.ycombinator.com/item?id=18041419 https://news.ycombinator.com/item?id=18041419 [3] https://microsoft.github.io/language-server-protocol/specification https://microsoft.github.io/language-server-protocol/specifi...