Documentation
¶
Overview ¶
Package jsonrpc is JSON-RPC 2.0 over a stream, framed as the language server protocol frames it: a Content-Length header, a blank line and the body. The SIML language server and the spell data server both speak it.
Index ¶
Constants ¶
const ( CodeParseError = -32700 CodeInvalidRequest = -32600 CodeMethodNotFound = -32601 CodeInvalidParams = -32602 CodeInternalError = -32603 CodeRequestCancelled = -32800 CodeContentModified = -32801 CodeRequestFailed = -32803 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FrameReader ¶
type FrameReader struct {
// contains filtered or unexported fields
}
func NewFrameReader ¶
func NewFrameReader(in io.Reader) *FrameReader
func (*FrameReader) Read ¶
func (f *FrameReader) Read() ([]byte, error)
The body of the next frame; io.EOF when the stream ends between frames.
type FrameWriter ¶
type FrameWriter struct {
// contains filtered or unexported fields
}
Writes whole frames, one at a time, from any goroutine.
func NewFrameWriter ¶
func NewFrameWriter(out io.Writer) *FrameWriter
func (*FrameWriter) Notify ¶
func (w *FrameWriter) Notify(method string, params any)
func (*FrameWriter) Request ¶
func (w *FrameWriter) Request(id int, method string, params any)
A request to the other side, whose answer the writer does not wait for.
func (*FrameWriter) Respond ¶
func (w *FrameWriter) Respond(id json.RawMessage, result any, rpcErr *ResponseError)
func (*FrameWriter) Write ¶
func (w *FrameWriter) Write(msg Message)
type Message ¶
type Message struct {
JSONRPC string `json:"jsonrpc"`
ID json.RawMessage `json:"id,omitempty"`
Method string `json:"method,omitempty"`
Params json.RawMessage `json:"params,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
Error *ResponseError `json:"error,omitempty"`
}
type ResponseError ¶
An error a request answers with.
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string