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

3083 Commits

Author SHA1 Message Date
Ian Cottrell
fa491999fb internal/lsp: add unified diff
This adds unified diff handling to the diff package.
It also adds a lot more testing and also verifies the unified
diff tests against the diff program if you run the tests with
the flag -verify-diff
This functionality is needed for some of the command verbs.

Change-Id: I817438fd25c0b16f3f31578f51a886944e74a948
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171024
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-15 20:14:25 +00:00
Ian Cottrell
2b5498619e internal/lsp: Remove 1.10 compatability in tests
Change-Id: I6e136d8b3292c1bedfdbb294c0465689ad1ffafb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171239
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-15 15:47:27 +00:00
LE Manh Cuong
681f9ce8ac cmd/compilebench: update document
Add document for "-go" and "-short" flag, which are listed in output of
"compilebench help".

Also reformat "-pkg" document to align with the rest.

Change-Id: I8ce80d8e02a9cf2b94aa099aa34e53412210d61b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170237
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2019-04-11 18:01:16 +00:00
Zac Bergquist
2538eef759 internal/lsp: enhance document symbols support
Make methods children of their receiver's type symbol.
Add struct fields as children of the struct's type symbol.
Also identify numeric, boolean, and string types.

Updates golang/go#30915
Fixes golang/go#31202

Change-Id: I33c4ea7b953e981ea1e858505b77c7a3ba6ee399
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170198
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-10 21:12:19 +00:00
Jonathan Amsterdam
db7bebf5ae apidiff: fix old reference to golang.org/x/exp
Change-Id: I46027c584758a37bee51f1a514b1bee292c1514a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171437
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-04-10 19:41:13 +00:00
Tobias Klauser
7e5bf9270d cmd/getgo: fix build on aix
Change-Id: Ic4a2f8f32258b14354658af5a09c736404d38808
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170961
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-10 13:57:22 +00:00
Rebecca Stambler
96f2e7ef86 internal/lsp: ignore errors for completion and signature help
This change makes sure that we never return error messages for
completions and signature help requests - just empty results.

Change-Id: I00d75cd116daab63beb07f2344e47aac01bb64ee
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170958
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-09 22:37:05 +00:00
Jonathan Amsterdam
9e5445377b internal/apidiff: diffs of package APIs
This is copied unchanged from x/exp.

Change-Id: I944b912212f7fd844a4bea81605433baf4bcc9a2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170862
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-04-09 17:10:12 +00:00
Peter Weinberger
04e50493df cmd/gopls: fix incomplete ClientCapabilities struct
go.ts, the program that generates Go types for the LSP protocol, now
handles Typescript type merging for ClientCapabilites, so fields are no
longer missing. Also, to silence go lint and go vet there are changes
in the comments generated in tsprotocol.go. All the *structs were changed
to structs in ClientCapabilities as it was absurdly complex to write literals
of the type. Finally, several otherwise unused types are no longer
generated.

Change-Id: If414a32bc4d733adb2cf8befda9d8a0703c568a6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171026
Run-TryBot: Peter Weinberger <pjw@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-09 15:09:02 +00:00
Rebecca Stambler
e5b8258f49 internal/lsp: stop formatting on files that do not parse
This change will stop formatting from working on any file that does not
parse. This is a temporary fix to handle the formatting problems
mentioned here: https://github.com/Microsoft/vscode-go/issues/2410, but
is not a long-term solution.

Change-Id: Ie34b1876519832d6859db95fdcad7cc37a20b769
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171019
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-08 22:03:57 +00:00
Ian Cottrell
12dd9f86f3 internal/lsp: remove defunct copy of the LSP protocol
Change-Id: I1cf3f670a3ca0fd9af18a3889ce5ad3d4128e002
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171028
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-08 17:02:12 +00:00
Michael Matloob
cb42bbeb79 go/packages: add a work around for go list behavior for missing ad-hoc package
If a file in an ad-hoc package doesn't exist, go list should exit 0 and
return an dummy package with an error set on it. Since it doesn't do that
yet, add a work-around.

Updates golang/go#29280

Change-Id: I6019f28ce4770582f274919d1aa35d85a634687e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171018
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-08 17:01:53 +00:00
kazyshr
0fdf0c7385 imports: fix circular imports
goimports will add an import for the package of target source file accidentally,
so check if package path is different from target source file when finding import candidates.

Fixes golang/go#30663

Change-Id: I77c29bc74bef6c888e63ccb501b013a5fbc30b5c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170238
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-07 03:08:57 +00:00
Ian Cottrell
a81264a823 internal/lsp: change diff tests to take strings not string arrays to make them more realistic
Change-Id: I7916c29c24cf581ddb4909a9beb8b0be3fb94c68
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170881
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-07 02:04:52 +00:00
Rebecca Stambler
719e078ade cmd/gopls/integration/vscode: log diagnostics as they are received
This change will allow us to investigate golang/go#30786 more easily.
Diagnostics are getting stuck even though they appear to be being sent
in the correct order, so it will be helpeful to see what's happening on
the VSCode side.

Change-Id: I623fcd9979c05decb0a6f60da2f75af7d0ff3853
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170895
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-06 23:58:00 +00:00
Rebecca Stambler
ccd3732616 internal/lsp: refactor code actions
This change makes codeActions look at the diagnostics provided before
responding. Specifically, before running "source.organizeImports", we
check if there is a diagnostic relating to imports.

Change-Id: I5268d5e8f144c4f2e085b2a861d0abfb7614323b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170997
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-06 23:57:00 +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
Bryan C. Mills
052fc3cfdb cmd/auth/cookieauth: add a GOAUTH implementation that reads from a cookiefile
Updates golang/go#26232

Change-Id: Ic8a7336eeb395fb9e8bbb7589a98a402deed0501
Reviewed-on: https://go-review.googlesource.com/c/tools/+/161669
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-04-05 18:06:40 +00:00
Bryan C. Mills
aafdb068a0 cmd/auth/netrcauth: add a reference GOAUTH implementation using .netrc files
Updates golang/go#26232

Change-Id: Ic6e0003be518e37927a25552b23da4f62eb1072d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/161668
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-04-05 18:06:24 +00:00
Bryan C. Mills
e32fe8a1b3 cmd/auth/gitauth: add a reference GOAUTH implementation using 'git credential fill'
Updates golang/go#26232

Change-Id: Ic22722756df1e66551222a8834a152519cb39e24
Reviewed-on: https://go-review.googlesource.com/c/tools/+/161667
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-04-05 18:06:12 +00:00
Bryan C. Mills
50503db0be cmd/auth/authtest: add a manual-test harness for GOAUTH implementations
Updates golang/go#26232

Change-Id: Idd6d32f4fcb99172a31e50fbd5993d563839c530
Reviewed-on: https://go-review.googlesource.com/c/tools/+/161666
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-04-05 18:06:07 +00:00
Ian Cottrell
b184d1ccfc internal/lsp: change diff Op.Content to be the unjoined strings
This also means we don't need the J2 becasue it is implied by len(Content)

Change-Id: I04e2cbaa3e1faa1e3add22ec2d478821b9062419
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170878
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-05 17:03:17 +00:00
Ian Cottrell
f558378bf8 internal/lsp: make definition use the lsp protocol
instead of driving the source pacakge directly, it indirects through the lsp
protocol (the same way check does)
We are normalizing on all the command lines doing this, so that server mode
is more viable in the future.

Change-Id: Ib5f2a059a44a5c60a53129c554e3cc14ca72c4a8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170577
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-05 17:02:55 +00:00
Ian Cottrell
d996c1aa53 internal/lsp: minor comment fix
Change-Id: I6603375beac4e321dd45f99e90d7eddbae4c6c4b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170717
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-05 16:24:45 +00:00
Rebecca Stambler
1058ed41f4 internal/lsp: add a "usePlaceholders" setting to gopls configuration
This change allows us to determine if we should complete with
placeholders in the function signature or not.

We currently complete all functions with parameters with a set of
parentheses with the cursor between them. Now, we support the option to
tab through the parameters.

Change-Id: I01d9d7ffdc76eb2f8e009ab9c8aa46d71c24c358
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170877
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-05 14:18:02 +00:00
Ian Cottrell
923d258130 internal/lsp: make the guru emulation tests slightly looser with a different matching system
We now match only the things we realy need to, to allow the description to vary more.

Change-Id: Ib3591c41ed5a5c725f2a3efb180ba17f808de51a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170341
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-04 13:25:00 +00:00
Brad Fitzpatrick
8a44e74612 go/packages: only test TestSizes on GOOS where 386 and amd64 GOARCH exists
Fixes solaris/amd64 about missing solaris/386, which isn't a supported port:

https://build.golang.org/log/39bfb29694089b7aaa6d0a60cc9bd3360129c2ab

Change-Id: If6d9fb368f3236ccf461d5ec47ad3ff4b7ef55b6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170619
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-04-03 18:35:09 +00:00
Michael Matloob
1aadbdfdbb go/packages: make sure TypesSizes are requested when Types are
This code fixes a bug when a user specifies NeedTypes, which
implicitly requires TypesSizes, but TypesSizes isn't fetched,
which causes typechecking to explode.

Also fix a similar issue where NeedImports isn't implicitly
fetched for NeedDeps.

I added a TODO for a better fix, which is to have an "implicitMode"
in the loader type containing all the data that's needed as a prerequisite
for other fields. Then we can use implicitMode when fetching data,
and cfg.Mode to clear out the fields the user didn't request.

Fixes golang/go#31163

Change-Id: If3506765470af43dfb24d06fcbd31b66a623f2e0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170342
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-03 18:03:48 +00:00
Michael Matloob
202502a5a9 go/packages: fix json struct tag on driverRequest.Command
Fixes golang/go#31181

Change-Id: I99bceb66809ed66393cc8e8deb5b82b8429ca337
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170477
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-02 20:06:28 +00:00
Ian Cottrell
c5ac96b4c4 internal/span: span to protocol needs position as well as offset
Change-Id: I4f39abb5932a951b2e5fa0932f478b00138e626a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170186
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-02 16:07:49 +00:00
Colin Arnott
b7e8f894e3 go/packages: rename golistDriverCurrent to golistDriver
This fixes a naming preference missed in CL 166537.

Since func golistDriverCurrent is no longer polymorphic, it was
suggested we simply call it golistDriver.

Change-Id: Ibf517365c20953628ede3457b9247efd8b79897c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/168837
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-04-02 15:30:18 +00:00
Rebecca Stambler
4c644d7e32 internal/lsp: avoid extra work in *cache.View.remove
Fixes golang/go#31177

Change-Id: I31219c6285fecd0abc4ff5ec4ae732bcfcb69511
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170182
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-01 20:55:34 +00:00
Rebecca Stambler
36ba6a502a internal/lsp: suppress error message when there is no config
Change-Id: I04d26ec3967f6515703142a11fc88b115890ab59
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170185
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-01 20:55:12 +00:00
Ian Cottrell
5bca5db4cb internal/lsp: check the client capabilities before calling workspace/configuration
Change-Id: I88d1142f4737cb74f5d6c9409218dde674dc1834
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170184
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-01 20:27:58 +00:00
Ian Cottrell
1bac838f5b internal/lsp: support multiple views
This uses the workspace folders to build multiple views, and then tries to pick
the right view to send each incomming request to.

Change-Id: I0cc896dbbc67eb0a88225ddeca6c518f4258bbba
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170179
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-01 20:12:29 +00:00
Rebecca Stambler
bf99c0974b internal/lsp: create the undelivered map
(for real, this time)

Change-Id: I563b7b34a1849914e9b922b07a86916bac7be30d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170183
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-01 19:21:32 +00:00
Rebecca Stambler
4fc9f0bfa5 internal/lsp: cache file objects for every dependency
Change-Id: I68eedc49a07aa9ba3328a4380e97ed03d1b75749
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170180
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-01 16:39:57 +00:00
Rebecca Stambler
cf22ef0385 internal/lsp: handle undelivered diagnostics
This change adds a cache of undelivered diagnostics on the server-side.
If we fail to send a diagnostic once, we will retry the next time that
the server sends diagnostics.

Change-Id: I161dfad8ea1d2cfdcee933baed2d6872dc03b0c0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/167737
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-04-01 16:39:43 +00:00
Ian Cottrell
e2f00d1e07 internal/lsp: make pipe mode the default for command line tests
now there are no more race conditions in the jsonrpc or server code make
connected pipe (rather than direct API) the default in the tests to make
sure we stay clean.

Change-Id: Id1ffede795a660dbf7b265b9e0419c60cf83c6e8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170181
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-01 16:30:59 +00:00
Ian Cottrell
5d16bdd7b5 internal/lsp: add the ability to log back to the client
Also use it for errors that were otherwise silently dropped
This makes it much easier to debug problems.

Also added command line control over whether the rpc trace messages are printed, which allows you to read the
log, otherwise the file edit messages swamp the log.

Change-Id: I7b70fd18034a87b2964e6d6d5f6f33dcaf7d8ea8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170178
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-01 16:22:08 +00:00
Dmitri Shuralyov
aef51cc377 go/analysis/unitchecker: allow dash in file paths
The temporary directory may contain a dash, and the test shouldn't
fail because of that.

Fixes golang/go#31164

Change-Id: I3c0d636771e13fec345e46394fb548e3c4ea4478
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170177
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-30 18:03:04 +00:00
Rebecca Stambler
a68386b9ff go/packages: add NeedTypesSizes to LoadTypes
This change moves the NeedTypesSizes bit to LoadTypes instead of LoadSyntax.

Fixes golang/go#31163

Change-Id: Icaf16639202533fbb2190756a325b36d8ac9251c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170016
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-30 16:34:40 +00:00
Dmitri Shuralyov
1cd2f21070 imports: add syscall/js API to zstdlib.go
The syscall/js API is not included in the GOROOT/api/go1.*.txt files
at this time, and so it needs to be added to mkstdlib.go explicitly.
Run the cmd/api command directly in the generator to determine the
syscall/js API.

Regenerate zstdlib.go with the updated generator, using Go 1.12.1.

Fixes golang/go#27590

Change-Id: I541588986d70f67f4917d9b34bdd57ca44f538f7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170014
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-30 15:02:33 +00:00
Rebecca Stambler
a96101f168 internal/lsp: add a work-around for golang.org/issue/31090
Change-Id: I6be1a61bc0b573913ef86b7a47e9f71d036f84e3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170011
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-03-29 22:58:45 +00:00
Rebecca Stambler
73054e8977 internal/lsp: use new go/packages LoadMode to get TypesSizes
This change also fixes the corresponding code in go/packages, which was
actually not filling in the TypesSizes if the bit was set.

Change-Id: I2d5a849045768a81c94218eb41da2faec26189a3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170010
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-03-29 21:52:04 +00:00
Rebecca Stambler
24738cbdc1 internal/lsp: add an error result to findFile
This change allows us to return diagnostics in the case of a file that
doesn't exist.

Change-Id: I6275c0dc9103a3f44070919937afe27c64545828
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170009
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
2019-03-29 21:46:45 +00:00
Ian Cottrell
0ec5c269d4 internal/lsp: clean up the confguraton handling
Now the jsonrpc2 library allows you to call outgoing methods within a handler
we can clean up some stuff and also have it work correctly in more cases.

Change-Id: I8633069816d92f7cc16842431775efb1a98a506a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170008
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-03-29 20:00:12 +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
Rebecca Stambler
0926561711 internal/lsp: fix nil pointer exception in document symbols
Change-Id: I168bf7b995aa0b609de67999879addad250eff11
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170006
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-03-29 18:25:15 +00:00