tools: golang.org/x/tools/internal/lsp/lsprpc Index | Files

package lsprpc

import "golang.org/x/tools/internal/lsp/lsprpc"

Package lsprpc implements a jsonrpc2.StreamServer that may be used to serve the LSP on a jsonrpc2 channel.

Index

Package Files

lsprpc.go telemetry.go

Variables

var ForwarderExitFunc = os.Exit

ForwarderExitFunc is used to exit the forwarder process. It is mutable for testing purposes.

type Forwarder Uses

type Forwarder struct {
    // contains filtered or unexported fields
}

A Forwarder is a jsonrpc2.StreamServer that handles an LSP stream by forwarding it to a remote. This is used when the gopls process started by the editor is in the `-remote` mode, which means it finds and connects to a separate gopls daemon. In these cases, we still want the forwarder gopls to be instrumented with telemetry, and want to be able to in some cases hijack the jsonrpc2 connection with the daemon.

func NewForwarder Uses

func NewForwarder(network, addr string, withTelemetry bool) *Forwarder

NewForwarder creates a new Forwarder, ready to forward connections to the remote server specified by network and addr.

func (*Forwarder) ServeStream Uses

func (f *Forwarder) ServeStream(ctx context.Context, stream jsonrpc2.Stream) error

ServeStream dials the forwarder remote and binds the remote to serve the LSP on the incoming stream.

type StreamServer Uses

type StreamServer struct {
    // contains filtered or unexported fields
}

The StreamServer type is a jsonrpc2.StreamServer that handles incoming streams as a new LSP session, using a shared cache.

func NewStreamServer Uses

func NewStreamServer(cache *cache.Cache, withTelemetry bool) *StreamServer

NewStreamServer creates a StreamServer using the shared cache. If withTelemetry is true, each session is instrumented with telemetry that records RPC statistics.

func (*StreamServer) ServeStream Uses

func (s *StreamServer) ServeStream(ctx context.Context, stream jsonrpc2.Stream) error

ServeStream implements the jsonrpc2.StreamServer interface, by handling incoming streams using a new lsp server.

Package lsprpc imports 14 packages (graph) and is imported by 2 packages. Updated 2020-02-20. Refresh now. Tools for package owners.