Bug 12456 - Add formatter options for controlling spaces
Summary: Add formatter options for controlling spaces
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.0 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-28 12:24 EST by Dale King CLA
Modified: 2003-10-13 10:12 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dale King CLA 2002-03-28 12:24:38 EST
The code formatter does not give you much control over how the code within a 
line is formatted. The only control it gives you is whether there is a space 
before an assignment operator.

It will format code like the following:

        if (method((a[i] + 2) * 3)

I cannot begin to tell you how much I hate that formatting. You may like it but 
you should let the user choose how to format it by adding options to control 
spaces in various places.

My style calls for formatting it like this:

    if( method( ( a[ i ] + b() ) * 3  ) )

The options I would like to see are:

- Control whether opening and closing parentheses are separated from the 
expression inside. You might want a separate setting for when the parentheses 
are denoting a cast (for which I don't put spaces).
- Probably a separate control for what to do for empty parenteses.
- The same two settings for brackets for arrays.
- Setting for whether keyword is separated from the parenthesis.
- Setting for whether method name is separated from the parenthesis.

I really suggest looking at Jindent documentation for examples of lots of other 
controls to be added.
Comment 1 Philipe Mulet CLA 2002-03-29 06:13:47 EST
Thanks for suggestion.
Will consider post 2.0.
Comment 2 Philipe Mulet CLA 2002-07-25 06:30:31 EDT
Resurrecting formatter issues in 2.1 stream.
Comment 3 Philipe Mulet CLA 2002-07-25 06:32:29 EDT
Clearing resolution
Comment 4 Dirk Grappendorf CLA 2002-11-08 17:36:19 EST
More space-formatting-control is really needed! The style-guide for my company 
prefers  
  
  foo.someMethod (param);  
  
for calling methods (spaces between method name and opening brace). 
 
This little (missing) space character hinders me from using Eclipse in our software 
production process ;-) 
 
Comment 5 Olivier Thomann CLA 2003-01-15 13:23:00 EST
We need to clear 2.1 bug reports that won't be addressed before 2.1. The new 
implementation is still in the works. Therefore we cannot include it for 2.1. 
Not enough testing and we need to polish the preferences. This will be address 
for 2.2 as stated in the JDT/Core plan.
Comment 6 Philipe Mulet CLA 2003-06-12 06:36:16 EDT
Resurrecting for 3.0
Comment 7 Olivier Thomann CLA 2003-06-12 15:59:04 EDT
Reopen for 3.0 consideration.
Comment 8 Olivier Thomann CLA 2003-10-03 09:50:28 EDT
This is addressed in the new formatter.
Fixed and released in HEAD.
Regression test added.
Comment 9 David Audel CLA 2003-10-13 10:12:26 EDT
Verified.