Skip to content

x/tools/gopls: bad completion insertion after syntax error #32510

Open
@muirdm

Description

@muirdm

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.goplsIssues related to the Go language server, gopls.help wanted

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions