Customizable code formatting

Are you missing a feature? Request its implementation here.
Zearin
Posts: 107
Joined: Mon Jul 30, 2007 11:31 pm
Location: College Park, MD, United States

Customizable code formatting

Post by Zearin »

Currently the control over code formatting isn't as tweakable as I'd like in Oxygen. I was working on a project the other day when I suddenly had an epiphany: rule-based formatting!

Duh! It makes perfect sense. When I found myself wishing for a way to automate formatting of my code, I initially thought to myself, "Well, it will be boring and a diversion from my current projects, but I could write an XSL stylesheet to format code…" That way I would get all the control I need.

But then I realized that the control is coming from XPath. So, I would like to put in a request for XPath-based rules for code formatting. You've already got great XPath support built-in, so if I could just specify rules like, "Normalize all space within the text of <p> elements", then I could just type in "p/text()" and check a box that says "normalize".
-- Zearin
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Customizable code formatting

Post by sorin_ristache »

Hello,

Thank you for your request. We will consider it for a future version but the implementation of formatting of an XML document based on XPath rules seems very hard. You should create your own XSLT stylesheet for your tweaked XML formatting until we implement this type of XML formatting.


Regards,
Sorin
Zearin
Posts: 107
Joined: Mon Jul 30, 2007 11:31 pm
Location: College Park, MD, United States

Re: Customizable code formatting

Post by Zearin »

Awww. :(

Well, dare to dream, I spose.

Thanks for the quick response!
-- Zearin
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Customizable code formatting

Post by sorin_ristache »

If you want only the normalization of some elements specified by an XPath expression you can use the Strip space elements list available in Preferences -> Editor -> Format -> XML. In this list you can add XPath expressions for elements for which the Format and Indent action normalizes the whitespaces.


Regards,
Sorin
Post Reply