Bug 528956 - Add new line wrapping policy: Wrap elements based on first element
Summary: Add new line wrapping policy: Wrap elements based on first element
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-19 09:07 EST by Renaat De Muynck CLA
Modified: 2020-05-14 10:15 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Renaat De Muynck CLA 2017-12-19 09:07:10 EST
When manually formatting code you sometimes make a choice to wrap some array or function arguments to make them more readable. If you then format automatically, your choices are overridden. I propose a new option that detects your choice and respects it.

Suggested fix:
Put every element on a new line only if the first element is on a new line. Otherwise, wrap only when necessary.

So if I have manually put the first item on a new line, the formatter sees this and respects it by wrapping all following items on new lines too. 

Examples
    This stays on the same line:
    var $a = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);

    But these stay wrapped:
    var $a = array(
        'a' => 'list',
        'of' => array(
            'key' => 'value',
            'pairs' => 0
        )
    );