- This topic has 1 reply, 2 voices, and was last updated 20 years, 7 months ago by Scott Anderson.
-
AuthorPosts
-
Steve BangMemberWhen I select code formatting (Source > Format Content), the operation is reapplied each time instead of applying some rules and leaving it alone if those rules are met. Thank goodness for Undo (Ctrl-Z). I don’t think this behavior is typical of other IDEs.
Also, is code formatting going to be enhanced in the future? It seems pretty unhelpful right now. Among other things, I wouldn’t expect a series of taglib directives at the top of the page to be split apart by spaces. When I try to apply code formatting to a selected fragment, the entire page is formatted.
In MyEclipse 3.7, when I apply the Format Content to the following code:
<blox:present id=”twogrids1_present”
visible=”false”
height=”400″
width=”400″
chartAvailable=”false”
dataLayoutAvailable=”false”
menubarVisible=”false”><blox:toolbar visible=”false” />
<blox:grid
defaultCellFormat=”#,000.0K” /><blox:chart
chartType=”Bar”
autoAxesPlacement=”true”
XAxis=” ”
axisTitleStyle=”font=Arial:Bold:12″
y1FormatMask=”#,000.0K”
y1AxisTitle=”($ Millions)”
o1AxisTitle=” ”
labelStyle=”font=Arial:Plain:11″/><blox:data
bloxRef=”twogrids1_data” /></blox:present>
this is what I get:
<blox:present id=”twogrids1_present”
visible=”false”
height=”400″
width=”400″
chartAvailable=”false”
dataLayoutAvailable=”false”
menubarVisible=”false”><blox:toolbar visible=”false” />
<blox:grid
defaultCellFormat=”#,000.0K” /><blox:chart
chartType=”Bar”
autoAxesPlacement=”true”
XAxis=” ”
axisTitleStyle=”font=Arial:Bold:12″
y1FormatMask=”#,000.0K”
y1AxisTitle=”($ Millions)”
o1AxisTitle=” ”
labelStyle=”font=Arial:Plain:11″/><blox:data
bloxRef=”twogrids1_data” /></blox:present>
The formatter is adding lots of extra row space and eliminates some indented code, but not all. I would think it should preserve all of my indenting. Interestingly, in Dreamweaver, their command just collapses the code together, taking out all row spacing but leaving the formatting intact. And, it can be applied to an entire page or just the selected fragment.
I understand that code formatting is a tough nut to crack since almost everyone has their own idiosyncratic formatting behavior, but I’m hoping for a bit more improvement. And, I know that a few settings are available in the preferences.
It doesn’t seem possible to switch back to Eclipse’s default perspective and use the Java code formatter. I’d like to be able to do that. Then, I could select a chunk of HTML or Java code and have their formatting options applied. Is that possible?
Thanks,
Steve
Scott AndersonParticipantSteve,
Thanks for the input. Yes, formatting is a tough nut, especially on JSP pages since they don’t conform to a particular grammar. XML, Java, and the like are actually much easier since at least they’re predictable. Formatting of JSP’s is a work in progress.
It doesn’t seem possible to switch back to Eclipse’s default perspective and use the Java code formatter.
The java formatter won’t be able to understand JSP’s so it can’t format them as a whole. You could try explicitly opening your JSP in the java editor, selecting a chunk of code and formatting just that but it seems a long way to go for a block at a time formatting.
-
AuthorPosts