1
0
mirror of https://github.com/golang/go synced 2024-11-06 07:26:10 -07:00
go/internal/lsp/analysis
Josh Baum 74a6bbb346 internal/lsp: enhance fillstruct and fillreturns to fill with variables
In the previous implementation, we always created a default
value for each type in the struct or return statement in fillstruct
and fillreturns, respectively. Now, we try to find a variable in scope
that matches the expected type. If we find multiple matches, we choose
the variable that is named most similarly to the type. If we do not
find a variable that matches, we maintain the previous functionality.

Change-Id: I3acb7e27476afaa71aaff9ffb69445913575e2b6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/245130
Run-TryBot: Josh Baum <joshbaum@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-08-10 18:49:36 +00:00
..
fillreturns internal/lsp: enhance fillstruct and fillreturns to fill with variables 2020-08-10 18:49:36 +00:00
fillstruct internal/lsp: enhance fillstruct and fillreturns to fill with variables 2020-08-10 18:49:36 +00:00
nonewvars internal/lsp: add type error fixes to existing diagnostics 2020-04-08 01:45:16 +00:00
noresultvalues internal/lsp: add type error fixes to existing diagnostics 2020-04-08 01:45:16 +00:00
simplifycompositelit internal/lsp: make sure that gofmt -s analyses don't modify AST 2020-04-06 21:01:14 +00:00
simplifyrange internal/lsp: make sure that gofmt -s analyses don't modify AST 2020-04-06 21:01:14 +00:00
simplifyslice internal/lsp: make sure that gofmt -s analyses don't modify AST 2020-04-06 21:01:14 +00:00
undeclaredname internal/lsp: support refactor.extract through commands 2020-07-27 19:25:51 +00:00
unusedparams internal/lsp: move undeclaredname suggested fix out of analysis 2020-07-23 23:54:27 +00:00