forked from golang/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls: allow for asynchronous request handling
As described in golang/go#69937, we need a mechanism that allows for concurrent request handling in gopls. However, this cannot be implemented entirely within the jsonrpc2 layer, because we need gopls to observe requests in the order they arrive, so it can handle them with the correct logical state. This CL adds such a concurrency mechanism using a trick similar to t.Parallel. Specifically, a new jsonrpc2.Async method is introduced which, when invoked on the request context, signals the jsonrpc2.AsyncHandler to start handling the next request. Initially, we use this new mechanism within gopls to allow certain long-running commands to execute asynchronously, once they have acquired a cache.Snapshot representing the current logical state. This solves a long-standing awkwardness in the govulncheck integration, which required an additional gopls.fetch_vulncheck_result command to fetch an asynchronous result. This enables some code deletion and simplification, though we could simplify further. Notably, change the code_action subcommand to eliminate the progress handler registration, since we don't need progress to know when a command is complete. Instead, use -v as a signal to log progress reports to stderr. Fixes golang/go#69937 Change-Id: I8736a445084cfa093f37c479d419294d5a1acbce Reviewed-on: https://go-review.googlesource.com/c/tools/+/621055 Reviewed-by: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
- Loading branch information
Showing
14 changed files
with
242 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.