mirror of
https://github.com/golang/go
synced 2024-11-18 18:04:46 -07:00
internal/lsp/protocol: handle cancellation delivery
$/cancelRequest is handled out of band in the Request flow, but was allowed to continue down the Deliver chain. There's no sense in letting downstream Handlers see it and try to reply like it was a normal request. Fixes golang/go#36662. Change-Id: I8471ac0fdd4f2a08acd87d6e4b83c1f077eb8600 Reviewed-on: https://go-review.googlesource.com/c/tools/+/215738 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
fc669b13a2
commit
b3205ff6ff
@ -64,6 +64,11 @@ func (canceller) Cancel(ctx context.Context, conn *jsonrpc2.Conn, id jsonrpc2.ID
|
||||
return true
|
||||
}
|
||||
|
||||
func (canceller) Deliver(ctx context.Context, r *jsonrpc2.Request, delivered bool) bool {
|
||||
// Hide cancellations from downstream handlers.
|
||||
return r.Method == "$/cancelRequest"
|
||||
}
|
||||
|
||||
func NewClient(ctx context.Context, stream jsonrpc2.Stream, client Client) (context.Context, *jsonrpc2.Conn, Server) {
|
||||
ctx = WithClient(ctx, client)
|
||||
conn := jsonrpc2.NewConn(stream)
|
||||
|
Loading…
Reference in New Issue
Block a user