Skip to content

Highlight the whole struct literal when unnamed element is present #2819

Open
@wbars

Description

@wbars

I think that current logic of GoStructInitializationInspection could be better: inspection suggests to replace single unnamed element by named, but we have to name all element in the struct literal to get valid code.

So i propose highlight the whole struct literal when at least one unnamed element is present. Quickfix will add names to all unnamed elements.

P.S. Current implementation misses case when several fields in struct declared by one type (see image.Point) as example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions