internal/lsp/lsprpc: partial integration of the jsonrpc_v2 library
Update the protocol package to allow wrapping the jsonrpc2 API, and add wrappers for v1 and v2 of the API, so that we may switch between them. Add simple bindings for the lsprpc package for jsonrpc2_v2 package, and get them working well enough to pass a version TestClientLogging test. This seemed like a reasonable checkpoint. Also add some type safety to client closing: all LSP clients must implement io.Closer. Change-Id: Ib2e6906e0db0c94102a7e794de932d6b61d54670 Reviewed-on: https://go-review.googlesource.com/c/tools/+/320850 Trust: Robert Findley <rfindley@google.com> Trust: Ian Cottrell <iancottrell@google.com> Run-TryBot: Robert Findley <rfindley@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
df36e4f0cb
commit
b619c1cc78
1 changed files with 6 additions and 0 deletions
|
|
@ -51,6 +51,12 @@ func (defaultHandler) Handle(context.Context, *Request) (interface{}, error) {
|
|||
return nil, ErrNotHandled
|
||||
}
|
||||
|
||||
type HandlerFunc func(ctx context.Context, req *Request) (interface{}, error)
|
||||
|
||||
func (f HandlerFunc) Handle(ctx context.Context, req *Request) (interface{}, error) {
|
||||
return f(ctx, req)
|
||||
}
|
||||
|
||||
// async is a small helper for things with an asynchronous result that you can
|
||||
// wait for.
|
||||
type async struct {
|
||||
|
|
|
|||
Loading…
Reference in a new issue