mirror of
https://github.com/golang/go
synced 2024-11-18 19:44:46 -07:00
76a3b8da50
If a user is typing fast, they will quickly invalidate many snapshots. We don't want to stack up a bunch of stale type check and analysis operations, so we should propagate cancellation through the cache. Handles are long-lived, so we may cancel an operation only to restart it again later. Also, there may be multiple operations waiting on the same computation, and just because one is cancelled doesn't mean we should necessarily stop. The easiest way to support all that was to add an explicit state to each handle, and track the number of waiters. See the code for more details on Handle life cycles. As far as I can tell, the rest of gopls is prepared for this behavior. I added an explicit check to the type checking code, where I was worried it might get overly confused. But long-term it would probably be good to return an error from Get. Change-Id: I3ea6e141b52b94300a41248d3f2e039b023709d0 Reviewed-on: https://go-review.googlesource.com/c/tools/+/206879 Run-TryBot: Heschi Kreinick <heschi@google.com> Reviewed-by: Ian Cottrell <iancottrell@google.com> |
||
---|---|---|
.. | ||
memoize_test.go | ||
memoize.go | ||
nocopy.go |