Bug 241968 - Formatter lacking an option to specify the whitespace in an object initializer
Summary: Formatter lacking an option to specify the whitespace in an object initializer
Status: VERIFIED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: 3.0.4   Edit
Assignee: Chris Jaun CLA
QA Contact: Phil Berkland CLA
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-07-24 09:47 EDT by Jean-Noel Rivasseau CLA
Modified: 2010-03-03 11:18 EST (History)
0 users

See Also:
berkland: review+


Attachments
proposed patch (19.68 KB, patch)
2008-11-13 13:09 EST, Chris Jaun CLA
thatnitind: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Noel Rivasseau CLA 2008-07-24 09:47:53 EDT
The following code:

ShippingController = 
{
        aVariable: "hello",

	shippingDomain: function()
	{
		NavigationEngine.processGenericServerCall(true);
	}
}

will get formatted as:

ShippingController = 
{
        aVariable : "hello",

	shippingDomain : function()
	{
		NavigationEngine.processGenericServerCall(true);
	}
}

with my formatting options. There is no way to specify that there should not be a whitespace after the key name in the object (here aVariable and shippingDomain). I looked everywhere and could not find it.

It would be nice if this option was implemented, as I use this convention (no space before the semicolon).

I am using WTP latest version with Ganymede.
Comment 1 Phil Berkland CLA 2008-10-17 17:21:42 EDT
Nitin,
you might consider this an enhancment, but it is a good way to cover all the formatting code.
Comment 2 Chris Jaun CLA 2008-11-13 11:21:03 EST
Testing a fix now.
Comment 3 Chris Jaun CLA 2008-11-13 13:09:43 EST
Created attachment 117806 [details]
proposed patch
Comment 4 Chris Jaun CLA 2008-11-13 13:17:25 EST
In the patch I added a new option on the whitespace tab of the format page for Object Initializers. Also added four new strings in the FormatterMessages properties file.

In the CodeFormatterVisitor class the visit method for ObjectLiteralField was updated to add spaces around the colon based on user selections.
Comment 5 Phil Berkland CLA 2008-11-14 15:02:31 EST
Looks good.
Comment 6 Phil Berkland CLA 2008-11-14 17:34:10 EST
Patch checked in.
Comment 7 Chris Jaun CLA 2008-11-17 11:02:10 EST
Patch was checked in by Phil.
Comment 8 Jean-Noel Rivasseau CLA 2008-11-17 11:12:11 EST
Thanks guys!
Comment 9 Chris Jaun CLA 2008-12-17 16:56:15 EST
Verified in 20081215095735