1
0
mirror of https://github.com/golang/go synced 2024-10-01 03:28:32 -06:00
Commit Graph

9 Commits

Author SHA1 Message Date
Ian Cottrell
619de4ed67 internal/jsonrpc2: refactor to enable a more advanced request
This separates hides the wire structures, and then exposes a new Request
type to allow for it to carry advanced features.
It also embeds the connection into the request and changes the signature of the
handler to no longer require a separate Conn argument.

Change-Id: I20b54f146285f7a9cb5f279c6ebdf0f286f4b829
Reviewed-on: https://go-review.googlesource.com/c/tools/+/183717
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-06-27 03:33:22 +00:00
Ian Cottrell
a6ef77d3cb internal/jsonrpc2: add telemetry to the rpc system
This uses the opencensus compatability later to track all the json rpc calls in
and out.

Change-Id: Ib719879a8d6855b6e6479a4f1b01fe823b548110
Reviewed-on: https://go-review.googlesource.com/c/tools/+/183248
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-06-27 03:32:48 +00:00
Ian Cottrell
359a0754b7 internal/jsonrpc2: adding rpc trace tasks
Change-Id: I101957f7aeb95034a71ab2db47e0422721c500f6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/179717
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-06-03 17:43:23 +00:00
Ian Cottrell
0d5674b311 internal/jsonrpc2: fix bug in direction logging of call responses
Change-Id: Id2fe0caf49e68b01641dadbc9e801210ecbd464f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171021
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
2019-04-06 16:55:26 +00:00
Ian Cottrell
1f1f5f5d57 internal/lsp: decouple message processing from stream processing.
The means that the stream reader can move forward while a message is being processed.
This will significantly improve responsivness and cancellation handling, and also
allow message handlers to send messages themselves, reducing the need to spin up
new go routines inside handlers.
The flow control changes from blocking to failing when a server is busy, which removes
the main current cause of deadlock, but may break non deadlock cases that currently wait
if the queue is not sufficiently large.

Change-Id: Ia73eb049b38d0651344abdbf16c477a8ce1a6fd1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170007
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-03-29 19:59:38 +00:00
Ian Cottrell
a8f40b3f4d internal/jsonrpc2: split main loop from construction to fix race
This changes the basic API of a jsonrpc2 connection to run the
read loop as a method rather than in a go routine launched in
the NewConn. This allows the handler to be created and bound
between construction and the read loop starting, which fixes
the race.

Fixes golang/go#30091

Change-Id: I8201175affe431819cf473e5194d70c019f58425
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170003
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-03-29 19:31:51 +00:00
Ian Cottrell
94339b8328 internal/jsonrpc2: change to a more synchronous dispatch model
Delivering each message in a go routine turned out to be problematic, there are some messages
that must be fully processed before later messages are started, and there was no way to guarantee that.
We now push concurrence handling up to the higher level, this has the disadvantage of not being able to guarantee
we respond to call messages correctly, but its a small price to pay.
The LSP currently processes each message fully in order blocking the handler, while we still work on basic
functionality.

Change-Id: If0648c77713ddbe4fed69da97a57696f433b8002
Reviewed-on: https://go-review.googlesource.com/c/149497
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2018-11-14 19:09:51 +00:00
Ian Cottrell
96e9e165b7 cmd/golsp: format logging for the lsp inspector
This improves the logging capabilities of the jsonrpc 2 library to always
include the method and also an optional elapsed time.
This is used to implement an lsp inspector compatible logging mode in the golsp.

Change-Id: I2f7ac8b9298c4364b1b89cf6f696b534557ed139
Reviewed-on: https://go-review.googlesource.com/c/146157
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2018-11-02 22:32:51 +00:00
Ian Cottrell
e93be7f42f internal/jsonrpc2: a basic json rpc library to build an lsp on top of
Change-Id: I6aa47fffcb29842e3194231e4ad4b6be4386d329
Reviewed-on: https://go-review.googlesource.com/136675
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2018-09-24 17:56:01 +00:00