mirror of
https://github.com/golang/go
synced 2024-11-18 16:14:46 -07:00
internal/lsp/protocol: actually handle cancellation delivery
CL 215738 didn't work because the canceller was embedded in the serverHandler, which already had a Deliver method. Add it as an actual handler instead. Change-Id: I0c79f1bee67aa3b4da53d92547804de859f1938c Reviewed-on: https://go-review.googlesource.com/c/tools/+/216303 Run-TryBot: Heschi Kreinick <heschi@google.com> Reviewed-by: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
bdfa187a52
commit
8fe064f891
@ -233,7 +233,7 @@ func (r *Request) Reply(ctx context.Context, result interface{}, err error) erro
|
||||
return fmt.Errorf("reply invoked more than once")
|
||||
}
|
||||
if r.IsNotify() {
|
||||
return fmt.Errorf("reply not invoked with a valid call")
|
||||
return fmt.Errorf("reply not invoked with a valid call: %v, %s", r.Method, r.Params)
|
||||
}
|
||||
// reply ends the handling phase of a call, so if we are not yet
|
||||
// parallel we should be now. The go routine is allowed to continue
|
||||
|
@ -23,12 +23,12 @@ const (
|
||||
type canceller struct{ jsonrpc2.EmptyHandler }
|
||||
|
||||
type clientHandler struct {
|
||||
canceller
|
||||
jsonrpc2.EmptyHandler
|
||||
client Client
|
||||
}
|
||||
|
||||
type serverHandler struct {
|
||||
canceller
|
||||
jsonrpc2.EmptyHandler
|
||||
server Server
|
||||
}
|
||||
|
||||
@ -73,6 +73,7 @@ func NewClient(ctx context.Context, stream jsonrpc2.Stream, client Client) (cont
|
||||
ctx = WithClient(ctx, client)
|
||||
conn := jsonrpc2.NewConn(stream)
|
||||
conn.AddHandler(&clientHandler{client: client})
|
||||
conn.AddHandler(&canceller{})
|
||||
return ctx, conn, &serverDispatcher{Conn: conn}
|
||||
}
|
||||
|
||||
@ -81,6 +82,7 @@ func NewServer(ctx context.Context, stream jsonrpc2.Stream, server Server) (cont
|
||||
client := &clientDispatcher{Conn: conn}
|
||||
ctx = WithClient(ctx, client)
|
||||
conn.AddHandler(&serverHandler{server: server})
|
||||
conn.AddHandler(&canceller{})
|
||||
return ctx, conn, client
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user