Documentation
¶
Overview ¶
Package lsprpc implements a jsonrpc2.StreamServer that may be used to serve the LSP on a jsonrpc2 channel.
Index ¶
Constants ¶
const AutoNetwork = "auto"
AutoNetwork is the pseudo network type used to signal that gopls should use automatic discovery to resolve a remote address.
Variables ¶
var ForwarderExitFunc = os.Exit
ForwarderExitFunc is used to exit the forwarder process. It is mutable for testing purposes.
Functions ¶
func OverrideExitFuncsForTest ¶ added in v1.0.0
func OverrideExitFuncsForTest() func()
OverrideExitFuncsForTest can be used from test code to prevent the test process from exiting on server shutdown. The returned func reverts the exit funcs to their previous state.
Types ¶
type Forwarder ¶
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 ¶
NewForwarder creates a new Forwarder, ready to forward connections to the remote server specified by network and addr.
type StreamServer ¶
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 ¶
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 ¶
ServeStream implements the jsonrpc2.StreamServer interface, by handling incoming streams using a new lsp server.