1
0
mirror of https://github.com/golang/go synced 2024-11-18 21:05:02 -07:00
go/internal/lsp
Heschi Kreinick 3ded1b734d internal/lsp: add and use nonstandard gopls/diagnoseFiles
Switch the command line client, and its tests, away from the hardcoded
30-second timeout and to a newly-added custom request.

Inconveniently for us, the jsonrpc2 package only serializes requests,
not replies. (Notifications are requests for this purpose.) So, for a
flow like this:

diagnoseFiles -->
  <-- publishDiagnostics
  <-- publishDiagnostics
diagnoseFiles <-- (reply)

...there's actually no guarantee that the incoming requests will be
processed before the reply comes in -- it gets to jump the
serialization. The only way to guarantee previous notifications have
been processed is to send another request. I didn't feel like adding
nonstandard notification support, so I just send a fake diagnostic.

Error handling for untyped JSON is hideous so for now we just panic.
Nobody else should be calling these, or if they do it's at their own
risk.

Fixes golang/go#36518.

Change-Id: I63f8df5bb627c9783314a0d38d2dac8721b3c320
Reviewed-on: https://go-review.googlesource.com/c/tools/+/214583
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-01-15 19:23:06 +00:00
..
browser internal/lsp: add version and bug commands 2019-05-11 04:16:02 +00:00
cache internal/lsp: push initialization tasks into one function 2020-01-15 04:46:56 +00:00
cmd internal/lsp: add and use nonstandard gopls/diagnoseFiles 2020-01-15 19:23:06 +00:00
debug internal/lsp: add server instance to debug info 2020-01-15 14:58:21 +00:00
diff internal/lsp: fix unified diffs of edits at the end of a file 2019-10-11 16:38:14 +00:00
fuzzy internal/lsp: make golint happy 2019-12-23 18:17:04 +00:00
mod internal/lsp: show dependency quick fixes for go.mod diagnostics 2020-01-15 16:51:05 +00:00
protocol internal/lsp/protocol: support nonstandard requests 2020-01-14 21:52:24 +00:00
snippet all: fix broken links to LSP specification 2019-10-02 18:32:53 +00:00
source internal/lsp,internal/telemetry: correct stale docstrings 2020-01-15 14:25:42 +00:00
telemetry internal/lsp: load metadata for a single package ID, when needed 2019-12-30 21:09:35 +00:00
testdata internal/imports: load test exports of package under test 2020-01-14 23:54:10 +00:00
tests internal/lsp: show dependency quick fixes for go.mod diagnostics 2020-01-15 16:51:05 +00:00
code_action.go internal/lsp: show dependency quick fixes for go.mod diagnostics 2020-01-15 16:51:05 +00:00
command.go internal/lsp: remove view.FindPosInPackage and view.FindMapperInPackage 2020-01-13 18:51:11 +00:00
completion_test.go internal/lsp: merge completion options into source.Options 2020-01-13 20:09:44 +00:00
completion.go internal/lsp: merge completion options into source.Options 2020-01-13 20:09:44 +00:00
definition.go internal/lsp: finish renaming CheckPackageHandle to PackageHandle 2020-01-14 23:56:10 +00:00
diagnostics.go internal/lsp: make sure diagnostics with analyses are not overwritten 2020-01-14 22:43:10 +00:00
folding_range.go internal/lsp: remove view.FindPosInPackage and view.FindMapperInPackage 2020-01-13 18:51:11 +00:00
format.go internal/lsp: remove view.FindPosInPackage and view.FindMapperInPackage 2020-01-13 18:51:11 +00:00
general.go internal/lsp: prevent initial workspace load from being canceled 2020-01-10 21:08:40 +00:00
highlight.go internal/lsp: remove view.FindPosInPackage and view.FindMapperInPackage 2020-01-13 18:51:11 +00:00
hover.go internal/lsp: finish renaming CheckPackageHandle to PackageHandle 2020-01-14 23:56:10 +00:00
implementation.go internal/lsp: remove view.FindPosInPackage and view.FindMapperInPackage 2020-01-13 18:51:11 +00:00
link.go internal/lsp: remove view.FindPosInPackage and view.FindMapperInPackage 2020-01-13 18:51:11 +00:00
lsp_test.go internal/lsp: show dependency quick fixes for go.mod diagnostics 2020-01-15 16:51:05 +00:00
references.go internal/lsp: remove view.FindPosInPackage and view.FindMapperInPackage 2020-01-13 18:51:11 +00:00
rename.go internal/lsp: finish renaming CheckPackageHandle to PackageHandle 2020-01-14 23:56:10 +00:00
reset_golden.sh internal/lsp: fix regeneration of golden files 2019-09-25 13:16:59 +00:00
server.go internal/lsp: add and use nonstandard gopls/diagnoseFiles 2020-01-15 19:23:06 +00:00
signature_help.go internal/lsp: remove view.FindPosInPackage and view.FindMapperInPackage 2020-01-13 18:51:11 +00:00
symbols.go internal/lsp: remove view.FindPosInPackage and view.FindMapperInPackage 2020-01-13 18:51:11 +00:00
text_synchronization.go internal/lsp: fix support for watching changed files 2020-01-13 19:19:55 +00:00
workspace.go internal/lsp: prevent initial workspace load from being canceled 2020-01-10 21:08:40 +00:00