Skip to content

x/tools/gopls: handle completion after defer and go statements #29313

Closed
@stamblerre

Description

@stamblerre

A defer or go statement is expected to be followed by an *ast.CallExpr. If they are not, the parser treats them as *ast.BadExprs, causing completion to fail. We need to handle this particular case.

Repro:

package main

import "fmt"

func main() {
    defer fmt.<>
}

Triggering a completion here will result in lexical completions, rather than the expected selector completions for package "fmt".

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions