diff --git a/internal/lsp/cmd/serve.go b/internal/lsp/cmd/serve.go index b24c9261..4a07bf7d 100644 --- a/internal/lsp/cmd/serve.go +++ b/internal/lsp/cmd/serve.go @@ -81,7 +81,7 @@ func (s *Serve) Run(ctx context.Context, args ...string) error { // For debugging purposes only. run := func(srv *lsp.Server) { srv.Conn.Logger = logger(s.Trace, out) - go srv.Conn.Run(ctx) + go srv.Run(ctx) } if s.Address != "" { return lsp.RunServerOnAddress(ctx, s.app.cache, s.Address, run) @@ -92,7 +92,7 @@ func (s *Serve) Run(ctx context.Context, args ...string) error { stream := jsonrpc2.NewHeaderStream(os.Stdin, os.Stdout) srv := lsp.NewServer(s.app.cache, stream) srv.Conn.Logger = logger(s.Trace, out) - return srv.Conn.Run(ctx) + return srv.Run(ctx) } func (s *Serve) forward() error { diff --git a/internal/lsp/server.go b/internal/lsp/server.go index 2903951e..ed04bde4 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -53,10 +53,7 @@ func RunServerOnAddress(ctx context.Context, cache source.Cache, addr string, h if err != nil { return err } - stream := jsonrpc2.NewHeaderStream(conn, conn) - s := NewServer(cache, stream) - h(s) - go s.Run(ctx) + h(NewServer(cache, jsonrpc2.NewHeaderStream(conn, conn))) } }