Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Has anyone gotten code formatting (Ctrl+Shift+F) to work in Eclipse? I know it's basically a Java feature but it would be neat to format Apex code according to rules.

I also can't get some hotkeys like "Insert Block Comment" to work - any specialities there?

share|improve this question

4 Answers 4

up vote 4 down vote accepted

Code formatting (as well as some of the other common Java features) is not supported in the Force.com IDE, unfortunately.

At one point I looked into adding some of the features I miss from Javaland, and determined it wouldn't be tons of work (the Eclipse API is very well documented) but too much time to justify for purely personal use.

share|improve this answer
Would a 3rd party plugin work in Apex? –  Marc Feb 1 '13 at 6:49
It would be in Eclipse, not in Apex per se, so yes. Eclipse is designed with an open plugin architecture. At worst it would require implementing a new type of Editor from scratch that implemented the features you wanted. Still, not worth the individual effort IMO. You may also want to take a look at BrainEngine. –  jkraybill Feb 5 '13 at 1:15
Thanks for the BrainEngine tip! Eclipse is driving me crazy and I'm ready to pay good money for something productive! –  Marc Feb 5 '13 at 10:26

This is currently not supported out of the gate with the Force.com IDE. If you would like it to be supported, I would suggest voting on it in Ideas - http://success.salesforce.com/ideaView?id=087300000006rPZAAY

Although I have no personally gotten this working, this Community post - http://boards.developerforce.com/t5/Apex-Code-Development/Formatting-code-in-Eclipse/td-p/85164 - suggests checking out this - http://stackoverflow.com/questions/8801064/how-can-do-code-alignment-in-eclipse-base-force-com-ide/8811156#8811156

Hopefully some of that can help you out.

share|improve this answer

No. Coding formatting (Ctrl+Shift+F) is not supported by force.com eclipse plugin.

share|improve this answer

Disclaimer - I use both Eclipse and MavensMate plugin and I'm not endorsing either. You might also want to look at the MavensMate plugin if you use SublimeText

It provides code formatting as well as a number of other interesting features.

share|improve this answer
Obviously I would want something which works in Eclipse :-) Most IDEs allow you to run external .exes (e.g. JSHint) on your source. I might follow that up. –  Marc Feb 1 '13 at 13:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.