3 ms·
Interesting post. I have worked a lot with LSP personally and professionally. I'm CEO of Sourcegraph, and we use LSP everywhere. (Go to https://sourcegraph.com/
by sqs 9y ago
Interesting post. I have worked a lot with LSP personally and professionally. I'm CEO of Sourcegraph, and we use LSP everywhere. (Go to https://sourcegraph.com/github.com/mholt/caddy/-/blob/caddyhttp/httpserver/https.go#L22:23$references https://sourcegraph.com/github.com/mholt/caddy/-/blob/caddyh... and open your browser's network inspector Web Socket list to see it live, for example.)
I think LSP's success is a demonstration of the "less is more" principle. It is simple and designed only to satisfy an editor's needs. But unlike many similar attempts, LSP has a lot of traction; see https://github.com/Microsoft/language-server-protocol/wiki/Protocol-Implementations https://github.com/Microsoft/language-server-protocol/wiki/P... for a list of implementations (http://langserver.org/ http://langserver.org/ for more details).
One of the reasons why this simplicity is necessary is that if a protocol even tries to represent structure or relationships across many different languages, it becomes harder and harder to add support for more languages. You can try to make it work for N languages, but the (N+1)th language always has some new language or syntax element that requires you to either change the specification (and update the N previous implementations) or deal with hacks (which goes against the whole reason to design the "one schema to rule them all").
A second reason is that even if you can make it work for all the languages you care about, it's very difficult to find enough language experts across all of those languages to build and maintain the implementations. It takes a lot of time to understand and communicate a complex schema and how the edge cases are handled across the various languages. And in the time it takes you to find and educate that team, you've already fallen behind new languages features being added or new popular languages coming on the scene. (Unless you are Google. Their Kythe project is an exception. :)
LSP has explicitly rejected the goal of modeling complex language features, at least so far. Perhaps with the impressive initial traction they could add it on and succeed where many other attempts haven't yet. But I doubt it.
(If you want to read more background about LSP, in addition to the Microsoft repo, you can check out some articles my cofounder wrote: https://text.sourcegraph.com/how-sourcegraph-scales-with-the-language-server-protocol-a4e8fd3fbae5 https://text.sourcegraph.com/how-sourcegraph-scales-with-the..., https://text.sourcegraph.com/part-2-how-sourcegraph-scales-with-the-language-server-protocol-73b86175f38b https://text.sourcegraph.com/part-2-how-sourcegraph-scales-w..., and https://text.sourcegraph.com/sourcegraph-code-intelligence-and-the-language-server-protocol-f2479fdd92ef. https://text.sourcegraph.com/sourcegraph-code-intelligence-a...)
- xg15 9y ago> It is simple and designed only to satisfy an editor's needs. But isn't that exactly the point of the post? The approach is nice for editors but unsuitable for IDEs. > You can try to make it work for N languages, but the (N+1)th language always has some new language or syntax element that requires you to either change the specification (and update the N previous implementations) or deal with hacks (which goes against the whole reason to design the "one schema to rule them all"). Seems to me LSP has the exact same problem with use-cases. By the description of the post, the goal seems to be to solve a fixed set of use-cases (highlighting, autocompletion, etc) for a flexible set of languages. If you want to add use-case n+1, you're faced with the same rewrite/hack conundrum. (Disclaimer: I don't have much expert with LSP)
- seren 9y agoIsn't LSP an application of Pareto Principle ? 80% of your needs are covered by small set of features.
- sqs 9y ago> But isn't that exactly the point of the post? The approach is nice for editors but unsuitable for IDEs. Yep. I'm just giving my thoughts on what it'd take to extend LSP so it addresses the issues raised in the blog post. I think it's much harder than it might seem. > Seems to me LSP has the exact same problem with use-cases. By the description of the post, the goal seems to be to solve a fixed set of use-cases (highlighting, autocompletion, etc) for a flexible set of languages. If you want to add use-case n+1, you're faced with the same rewrite/hack conundrum. The difference is between "What does an editor need?" and "What is a faithful representation of an element of code in a programming language?" The former is easy (and it's what LSP does) even to do for 50 languages; the latter is way harder than the casual reader would expect.
- Analemma_ 9y agoI agree with everything you've said, especially how LSP's simplicity has been key to its success. I do also agree with the author and would like a standard extensibility point, so that LSP could be the One True Way for every language to have full support in every IDE. I just want that to be done slowly and carefully, because it would be very easy to get wrong. If I had to guess, I'd say this might be coming in the future. Possibly Microsoft wanted to break out of its habit of overengineering things to encourage uptake and avoid scaring people away. They might be willing to carefully add more to "LSP 2.0" once people are comfortable with it.