+ Start a Discussion

Visualforce code is automatically re-formatted

Every now and then, when I save a Visualforce page's code in the IDE, I find that it has been re-formatted. For example, if the code originally defined a style like this:


.myClassName {border:none;width:200px;}


I'll suddenly find that the code looks like this:


.myClassName {


  width: 200px;



One could argue over which style is better, but the point is that I wrote it the first way, and I don't appreciate having something (the IDE? the compiler?) format it differently.


Any idea what's causing this to happen and what I can do to stop it?


FWIW, I know that I'm the only developer in this org -- there's no person who's changing this. I've seen it happen in several orgs - it's not in just one org. Also, it doesn't happen every time I save -- just sometimes.


If you mean Eclipse IDE, I suspect you've got the "smart edit" options enabled that is supposed to fix CSS styles and so on. I don't recall how to turn that feature off, but it should be an option under the Editor sub-section. I personally rarely use the IDE, as I find Programmer's Notepad ( pnotepad.org ) coupled with Apache Ant ( ant.apache.org ) to be more of a lower-level mechanism that gives me better control over my code and deployment process. Looking it up, it seems there's a auto-format on save feature you might be tripping over as well. I'd recommend a look-see at the toggle options available.


Thanks for your reply!


It makes sense that this would be a generic Elipse option, but I've just been all through the Preferences dialog, and I can't find anything that looks related to this. Does anybody know what this option is called or where in Preferences to find it?