mirror of
https://github.com/golang/go
synced 2024-11-18 15:24:41 -07:00
625332f3c5
LSP https://microsoft.github.io/language-server-protocol/specifications/specification-current/#cancelRequest expects the server to send back the response even when the request is cancelled. Gopls LSP protocol implements the cancellation using the context cancellation. That is, upon a cancellation request from the client, the server calls the corresponding canceller that cancels the context passed to the handler. Reusing this cancelled context for the replyer is not safe because code in any layer can decide to shortcircuit and skip sending the data back to the client. E.g. https://cs.opensource.google/go/tools/+/master:internal/jsonrpc2/stream.go;l=63 This CL make sure to pass the detached context to the replier. Alternative, or a better approach to avoid any unexpected side-effect of using a detached context is to send out the response at the point of cancellation with a separate context. But that requires more significant code change. Testing is currently hard, but maybe doable once the current refactoring is done. Test is left as a TODO. Change-Id: I4611af00ad913e96b62c6b7180c6673b0465daf9 Reviewed-on: https://go-review.googlesource.com/c/tools/+/232300 Reviewed-by: Ian Cottrell <iancottrell@google.com> |
||
---|---|---|
.. | ||
typescript | ||
context.go | ||
doc.go | ||
enums.go | ||
log.go | ||
protocol.go | ||
span.go | ||
tsclient.go | ||
tsprotocol.go | ||
tsserver.go |