The old formatter, the code that’s used to format your code from v1 to version 4.1 was based on some pattern matching code and expressions. It was very limited, and didn’t like a lot of syntax and coding styles common in Oracle code.
It also wasn’t very flexible.
So we built a new engine. One that takes advantage of our Oracle parser.
The new formatter (the part you can see like the preferences) looks very much like the old formatter. So you don’t get a new paint job or leather seats, but the engine under the hood is crazy good and the transmission and power train is much better at getting that horsepower to the wheels. Sorry for the car metaphor, but it kinda works here I think.
For the EA, it would be most helpful if you could try the formatter in version 4.2. We’re looking for two things.
1. The parser chokes and the formatter is uanble to format your code.
That will look like this:
WITH t(ID,text) AS ( SELECT 1,'one,two,three' FROM dual UNION ALL SELECT 2,'un,deux,trois' FROM dual UNION ALL SELECT 3,'een,twee,drie' FROM dual ) SELECT id, TRIM(COLUMN_VALUE) text FROM t, xmltable( /*** Syntax Error at line 10, column 12 xmltable(('"' ^^^ Expected: string_literal, ***/('"' || REPLACE(text, ',', '","') || '"')) ;
Please post your code samples to the Forums so we can fix those for the next EA, and of course for the official v4.2 release.
2. The formatter preferences aren’t flexible enough to get the code out the way you want it to look.
Good formatting is a purely subjective point of view. What I like fine you might hate. But we can all agree that the formatter should be flexible enough to not spit out code that no one can use.
Please let us know what additional preferences you would like.
I can say already that we omitted a few Alignment preferences that we shouldn’t have, and we’re going to add them for the next drop.
We’re NOT going to end with 3,000 formatter options by the way. But I can see us definitely adding a few.
The good news is that the new formatting engine is MUCH easier to enhance, and it will get better with each release now as long as folks continue sending in their ideas and requests.
Concrete Examples of Improvements
Exchange request to align a SELECT list.

Before and After – desired effect being the ‘after.’
Exchange request to treat line breaks on commas consistently.

They wanted BEFORE to apply to SELECT lists AND proc arguments.
Exchange request to give more flexibility on text CASE preferences. Upper, lower, InitCap, leave alone. We did that, and have it for both keywords like ‘SELECT’ and ‘LOOP’ and identifiers like ‘HR’ and ‘EMPLOYEES.’

Case options before.
And

Case options after.
Just handle new stuff better – like in-line PL/SQL with your SQL statements.

It just looks better and is easier to read.
Sharing Your Examples
Always please include your sample code along with your parser errors and formatting examples. It will increase your odds of a favorable outcome by about 1,000%.