Bug 521884 - Code Formatter: comma after final array element for multi-line array definition.
Summary: Code Formatter: comma after final array element for multi-line array definition.
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Thierry BLIND CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-05 12:32 EDT by Anthony Cartmell CLA
Modified: 2020-05-14 13:18 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Cartmell CLA 2017-09-05 12:32:00 EDT
The Drupal coding standards require a comma after the final array item in a multi-line array definition. PDF Code Formatter currently always removes any final comma.

Current formatter does:

$numbers = array(
  1 => "one",
  2 => "two",
  3 => "three"
);

Drupal coding standard needs:

$numbers = array(
  1 => "one",
  2 => "two",
  3 => "three",
);

This is so that the lines can be easily re-ordered, without breaking the array syntax.
Comment 1 Eclipse Genie CLA 2018-03-15 17:24:02 EDT
New Gerrit change created: https://git.eclipse.org/r/119522
Comment 3 Eclipse Genie CLA 2018-03-17 17:18:26 EDT
New Gerrit change created: https://git.eclipse.org/r/119622
Comment 5 Thierry BLIND CLA 2018-03-18 07:28:20 EDT
Hi Anthony,
I've added a new code formatter option, you'll find it in the code formatter profile under "Line Wrapping" -> "Keep trailing comma".
You can try it if you want by downloading latest pdt snapshot (available tomorrow).

Thierry.