golang/go
View on GitHubx/tools/gopls: bad completion insertion after syntax error
Open
#32,510 opened on Jun 9, 2019
NeedsInvestigationgoplshelp wanted
Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
In this code
package foo
func foo() {
foo(a ...interface{})
f<>
}
Completing "f" to "foo" ends up inserting "ffoo" instead of "foo". This is because the syntax error on the previous line completely obscures the "f" *ast.Ident, so we don't detect it properly as the prefix. Perhaps if we are in a BadExpr we could "manually" detect the surrounding identifier so completion still works to some degree?
/cc @stamblerre