-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highlight the whole struct literal when unnamed element is present #2819
Comments
I made an outline of the reworked inspection to demonstrate the idea. Main change is the object for highlighting - now it is the whole literal. Proposed logic is described above. I think that it will be more natural way of handling unnamed elements since we will not have to name all highlighted elements one by one to get valid code. Also PR includes some missed cases for this inspection, like anonymous field definition, or several field definitions within one declaration. |
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.The text was updated successfully, but these errors were encountered: