Skip to content

Autocomplete incorrectly suggests lowercase fields for uppercase struct fields #4031

@decline-llc

Description

@decline-llc

What version of Go are you using (go version)?

go version go1.25.7 windows/amd64

What version of VS Code and the Go extension are you using?

VS Code: 1.120.0 (user setup)
Go extension: 0.52.2
gopls: not installed (default from extension)

What operating system and processor architecture are you using?

Windows 10/11 x64

What did you do?

I defined a struct with uppercase exported fields:

type Vertex struct {
X int
Y int
}

When I type v. in VS Code, the autocomplete incorrectly suggests lowercase x / y instead of the correct uppercase X / Y.

If I accept the autocomplete, it produces a compile error.

What did you expect to see?

Autocomplete should show the exact casing of the struct fields:
v.X
v.Y

What did you see instead?

Autocomplete shows:
v.x
v.y

This causes a compile error:
undefined: v.x (but field X exists)

Minimal Reproduction Code

package main

import "fmt"

type Vertex struct {
X int
Y int
}

func main() {
v := Vertex{1, 2}
v.X = 4
fmt.Println(v.x) // autocomplete inserts lowercase x
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions