Skip to content

[Formatter/ObjC] In ObjC dict literals, breaking after ',' should be preferred over breaking before ':' #15602

@nico

Description

@nico
Bugzilla Link 15230
Resolution FIXED
Resolved on May 26, 2013 01:21
Version unspecified
OS All

Extended Description

return @{
kTitleKey: title,
kIsGroupItemKey: [NSNumber numberWithBool:isGroupItem],
kChildrenKey: children,
kCanExpandKey: [NSNumber numberWithBool:canExpand]
};

is formatted as

return @{ kTitleKey : title, kIsGroupItemKey
: [NSNumber numberWithBool:isGroupItem], kChildrenKey : children,
kCanExpandKey : [NSNumber numberWithBool:canExpand] };

Better would be

return @{ kTitleKey : title,
kIsGroupItemKey : [NSNumber numberWithBool:isGroupItem],
kChildrenKey : children,
kCanExpandKey : [NSNumber numberWithBool:canExpand] };

(Possibly even better: The original formatting.)

Note to self: The fix probably involves adding a "ColonIsObjCDictKeySeparator" bool, setting that in parseBraces() if parent is '@', giving ':' a TT_ObjCKeySeparator token type, and then assigning a fairly high splitPenalty() to tokens with type TT_ObjCKeySeparator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions