It is quite common to indent the content of arrays in PHP or Javascript this way:
$myArray = array(
1 => "Value 1",
2 => "Value 2",
3 => "Value 3",
4 => "Value 4"
); |
I do that quite a lot myself as it keeps my code easier to read. However if I use the automatic re-indent code feature, it won't stay aligned the way I want it to and becomes:
$myArray = array(
1 => "Value 1",
2 => "Value 2",
3 => "Value 3",
4 => "Value 4"
); |
I also often put very long strings on multiple lines using a concatenation character, and indent all lines at the same level as such:
$mystring = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, ".
"sed do eiusmod tempor incididunt ut labore et dolore magna ".
"aliqua. Ut enim ad minim veniam, quis nostrud exercitation ".
"ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis".
" aute irure dolor in reprehenderit in voluptate velit esse".
" cillum dolore eu fugiat nulla pariatur. Excepteur sint"; |
This is especially useful when combined with MySQL queries. This way to can keep the indents in the query and keep it very readable.
Unfortunately, the re-indent engine realigns it this way:
$mystring = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, ".
"sed do eiusmod tempor incididunt ut labore et dolore magna ".
"aliqua. Ut enim ad minim veniam, quis nostrud exercitation ".
"ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis".
" aute irure dolor in reprehenderit in voluptate velit esse".
" cillum dolore eu fugiat nulla pariatur. Excepteur sint"; |
So all this comes down to 2 feature requests:
1. Array declarations that are broken on multiple lines (where the brackets are in compact style), should be indented the same way a function declaration is.
2. If a string is broken on several lines using a concatenation character, then all subsequent lines should be aligned with the beginning of the first quote after the assignment operator (=, .=, etc..) just like in my example. Since this is perhaps not a behavior that everyone would like, it could be an additional checkbox in the general settings (something like "auto-indent multi-line strings together")[/list][/quote][/code]