Translation of the article How the Language Server Protocol Affects the Future of IDEs
Original author Mehul Mohan
Since its inception, Visual Studio Code has single-handedly influenced the developer ecosystem so much that there will be no going back. It is an open source, free and open source tool and is a very powerful tool.
But thanks to VSCode, Microsoft in 2016 gave birth to another super meaningful thing that is less well known. This is the Language Server Protocol.
What is Language Server Protocol?
(Language Server Protocol - LSP) - ( HTTP FTP).
- , . - , (, , ), - , , CMD/Ctrl- , .
, . HTTP JSON-RPC .
LSP?
, VSCode ? , VSCode, IntelliSense , C, Python, Java ..? LSP.
IntelliSense HTML/CSS/JavaScript VSCode ( , PyCharm Python). LSP .
JSON-RPC?
JSON-RPC JSON (Remote Procedure Call). ( , REST ), - , API REST.
JSON-RPC:
// Request
curl -X POST βdata '{
"jsonrpc": "2.0",
"method": "runThisFunction",
"params": [ "some-param", 2 ],
"id": 1
}'
// Response
{
"jsonrpc": "2.0",
"result": "codedamn",
"id": 1
}
JSON RPC. JSON-RPC, runThisFunction
, .
LSP + JSON-RPC
LSP JSON-RPC . :
Content-Length: <bytes of JSON>\r\n\r\n<json-payload>
:
Content-Length: 78
{"jsonrpc":"2.0","method":"runThisFunction","params":["some-param",2],"id":1}
LSP , Content-Length
, CRLF
\r\n
. , ccls
, , :
, , ccls
, , runThisFunction
. , Content-Length
JSON-RPC.
?
LSP, Microsoft M x N M + N.
M = (C, C++, PHP, Python, Node, Swift, Go ..).
N = (VSCode, Eclipse, Notepad++, Sublime Text ..).
, M N , M*N . .
With the advent of the LSP, the only thing left in the editor was to add support for the language server protocol. After that, anyone who makes a language server (following the LSP standards) can easily integrate into the code editor without the editor never "knowing" which language they are working with!
The future of the IDE
As language servers are implemented for different programming languages, it becomes possible for developers to choose the editor of their choice. Without binding to a specific language. There is no need to limit yourself anymore, for example only XCode for Swift development or PyCharm for Python. Not only that, LSPs can be embedded directly into JavaScript to support IntelliSense in the browser! Now is an awesome time for programmers!