1
0
mirror of https://github.com/golang/go synced 2024-09-30 22:58:34 -06:00
go/internal/lsp/testdata
Muir Manders 49ba83114e internal/lsp: improve composite literal completion
When the value of a composite literal key/value pair was unparsable,
you were getting completions for the composite literal keys instead of
values. For example "struct { foo int }{foo: []<>" was completing to
the field name "foo". This was because the leaf ast.Node at the cursor
was the composite literal itself, and our go-back-one-character logic
was not happening because the preceding character's node
was *ast.BadExpr, not *ast.Ident. Fix by always generating the ast
path for the character before the cursor's position. I couldn't find
any cases where this broke completion.

I also added expected type detection for the following composite
literal cases:
- array/slice literals
- struct literals (both implicit and explicit field names)
- map keys and values

Fixes golang/go#29153

Change-Id: If8cf678cbd743a970f52893fcf4a9b83ea06d7e9
GitHub-Last-Rev: f385705cc05eb98132e20561451dbb8c39b68519
GitHub-Pull-Request: golang/tools#86
Reviewed-on: https://go-review.googlesource.com/c/tools/+/173099
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-23 22:28:03 +00:00
..
analyzer internal/lsp: fix badly formatted error messages from go vet 2019-04-16 19:41:54 +00:00
anon internal/lsp: add additional tests for completion 2018-12-19 22:27:14 +00:00
bad internal/lsp: connect basic analysis functionality 2019-02-06 21:48:25 +00:00
bar internal/lsp: fix a bug stopped package names from being printed 2018-11-20 23:48:46 +00:00
baz internal/lsp: implement type definitions 2018-12-04 18:51:09 +00:00
builtins internal/lsp: add a test for completion of builtin types and functions 2019-01-16 00:24:28 +00:00
cast internal/lsp: add more testdata for completion and diagnostics 2018-11-20 06:06:34 +00:00
complit internal/lsp: improve composite literal completion 2019-04-23 22:28:03 +00:00
errors internal/lsp: add additional tests for completion 2018-12-19 22:27:14 +00:00
foo internal/lsp: do not complete inside comments in functions 2019-01-22 18:08:10 +00:00
format internal/lsp: adding golden file support to the test harness 2019-04-23 21:54:59 +00:00
func_rank internal/lsp: rank types higher when completing in return of a function 2019-02-02 23:51:57 +00:00
godef internal/lsp: handle embedded struct pointer definitions 2019-04-20 18:18:00 +00:00
good internal/lsp: connect basic analysis functionality 2019-02-06 21:48:25 +00:00
highlights internal/lsp: add support for document highlight 2019-03-26 19:08:20 +00:00
nested_complit internal/lsp: improve composite literal completion 2019-04-23 22:28:03 +00:00
nodisk internal/lsp: a cleaner way of doing overlays 2019-04-17 21:35:05 +00:00
noparse internal/lsp: connect basic analysis functionality 2019-02-06 21:48:25 +00:00
noparse_format internal/lsp: adding golden file support to the test harness 2019-04-23 21:54:59 +00:00
rank internal/lsp: add additional tests for completion 2018-12-19 22:27:14 +00:00
selector internal/lsp: add more testdata for completion and diagnostics 2018-11-20 06:06:34 +00:00
signature internal/lsp: improve composite literal completion 2019-04-23 22:28:03 +00:00
stringlit cmd/lsp: skip completion in string literals 2019-03-15 16:51:35 +00:00
symbols internal/lsp: make the symbols tests use the enum names rather than hard coding the values 2019-04-17 00:57:54 +00:00
testy internal/lsp: connect basic analysis functionality 2019-02-06 21:48:25 +00:00
types internal/lsp: add more testdata for completion and diagnostics 2018-11-20 06:06:34 +00:00