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

313 Commits

Author SHA1 Message Date
Rebecca Stambler
2e4132e53b internal/lsp: add a test for completion of builtin types and functions
Change-Id: I7df2cfebbf2c44d189066a6d16770c753f7bf1d4
Reviewed-on: https://go-review.googlesource.com/c/158020
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-01-16 00:24:28 +00:00
Rebecca Stambler
f344c7530c internal/lsp: add ranges to some diagnostics messages
Added a View interface to the source package, which allows for reading
of other files (in the same package or in other packages). We were
already reading files in jump to definition (to handle the lack of
column information in export data), but now we can also read files in
diagnostics, which allows us to determine the end of an identifier so
that we can report ranges in diagnostic messages.

Updates golang/go#29150

Change-Id: I7958d860dea8f41f2df88a467b5e2946bba4d1c5
Reviewed-on: https://go-review.googlesource.com/c/154742
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-12-20 19:13:07 +00:00
Rebecca Stambler
6e267b5cc7 internal/lsp: add additional tests for completion
New tests include cases for anonymous structs, composite literals,
ranking of results in binary expressions, and import cycles.

Change-Id: Ic02e84e09101bb9873fc1705bba2594d655bb45b
Reviewed-on: https://go-review.googlesource.com/c/153443
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-12-19 22:27:14 +00:00
Rebecca Stambler
3832e276fb internal/lsp: implement type definitions
Extend definition tests to add typdef test.

Change-Id: Ibad988ae68f91d18f2c6b4739d758a536172fb35
Reviewed-on: https://go-review.googlesource.com/c/152239
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-12-04 18:51:09 +00:00
Rebecca Stambler
b5f2cae84d internal/lsp: fix a bug stopped package names from being printed
Also, trigger signature help on completion of a function (the "(" as a
trigger character doesn't work if it's part of a completion).

Change-Id: I952cb875fa72a741d7952178f85e20f9efa3ebff
Reviewed-on: https://go-review.googlesource.com/c/150638
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-11-20 23:48:46 +00:00
Rebecca Stambler
fc4f04983f internal/lsp: add more testdata for completion and diagnostics
Change-Id: I2a73e51b60f76a2af0f8ff4d34220b551e0cd378
Reviewed-on: https://go-review.googlesource.com/c/150041
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-11-20 06:06:34 +00:00
Ian Cottrell
6dfe7efaa9 internal/lsp: add definition tests from godef
This makes our internal version of go to definition be tested with the
same test data that godef now uses

Change-Id: I04e488b6b9b2d891181f202ea1125b823a079c50
Reviewed-on: https://go-review.googlesource.com/c/150045
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2018-11-19 18:17:22 +00:00
Ian Cottrell
68f7e630ce internal/lsp: make all the tests work on 1.10
Also improve the error messages from a failing diagnostic tests so you can read
them.

Change-Id: I3554ce5a029de22a55a9636ed26ba02d95fc3246
Reviewed-on: https://go-review.googlesource.com/c/150042
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2018-11-19 17:55:51 +00:00
Rebecca Stambler
f87c222f14 internal/lsp: fix and add tests for formatting
The go/format.Node function fails silently on malformed ASTs, even
though it writes out an invalid tree containing the strings "BadExpr"
and "BadStmt". We fix this by checking for *ast.Bad{Expr,Decl,Stmt}
before running the function. Ultimately, this should be fixed upstream
and just return an error from format.Node.

Change-Id: I2ba25551f0e97c0321d8e757de67360af44044d7
Reviewed-on: https://go-review.googlesource.com/c/149613
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-11-15 19:42:43 +00:00
Ian Cottrell
6778892796 internal/lsp: use the new marker support
We use the custom marker support to allow us to simplify the
annotations, making it much easier to understand the tests.

Change-Id: Id818a286e4e85f48cfe505f14ec82a80498e494c
Reviewed-on: https://go-review.googlesource.com/c/149611
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-11-15 01:11:27 +00:00
Rebecca Stambler
806e1cfd89 internal/lsp: add a preliminary test for completion
Use the packagestest framework to test completion. Add support for a
slice of token.Position to packagestest to support this.

Change-Id: Ie5ddece4446a3c74419727461a77faa3788cb040
Reviewed-on: https://go-review.googlesource.com/c/148197
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
2018-11-12 19:56:38 +00:00
Rebecca Stambler
ebdbadb46e internal/lsp: fix LSP tests to be compatible with Go 1.10
Change golang/go#145697 added tests for diagnostics in the LSP implementation,
but these test did not work with Go 1.10. This change skips tests that
require Go 1.11.

Change-Id: I52bd2df484b5786395edac2c1c8592c83ac1aaa4
Reviewed-on: https://go-review.googlesource.com/c/147439
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-11-05 19:42:43 +00:00
Rebecca Stambler
f7a8a58e8d internal/lsp: use packagestest markers to test diagnostics
Add some basic tests for diagnostics using the new
go/packages/packagestest framework.

Change-Id: I6a7bfba6c392928a9eb123ab71ceb73785c12600
Reviewed-on: https://go-review.googlesource.com/c/145697
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-11-02 21:57:01 +00:00