Open
Description
This issue tracks all of the workarounds implemented in gopls
to handle places where go/parser loses information. Most of this code can be found in golang.org/x/tools/internal/lsp/cache/parse.go
and was written by @muirdm.
The current list of workarounds includes handling:
- Missing curly braces in
if
statements (if foo
->if foo {}
) - Missing selectors (
x.
->x._
) - Partial identifiers that are keywords (
foo.var
->foo._
) - Missing conditional statements in
if
statements with initialization statements (if i := 0
) - Unexpected array types (
[]int
->[]int{}
) - Incomplete
go
ordefer
statements (go foo
->go foo()
). - Dangling selectors in
go
ordefer
statements
go foo.
y := 1
becomes
go foo._
y := 1