LSP 语言服务器协议
The specification: Specification
The base protocol consists of a header and a content part.
The header part consists of header fields. Each header field is comprised of a name and a value, separated by :
(a colon and a space). Each header field is terminated by \r\n
.
Header Field Name | Value Type | Description |
---|---|---|
Content-Length | number | The length of the content part in bytes. This header is required. |
Content-Type | string | The mime type of the content part. Defaults to application/vscode-jsonrpc; charset=utf-8 |
The content part of a message uses JSON-RPC to describe requests, responses and notifications.
综上,一个例子:
Content-Length: ...\r\n
\r\n
{
"jsonrpc": "2.0",
"id": 1,
"method": "textDocument/completion",
"params": {
...
}
}
定义了一些基本类型:integer
, uinteger
, decimal
, LSPObject
, LSPArray
, LSPAny
🗞️ Recent Posts