+ Start a Discussion
NarenKNarenK 

Code formatter for - apex code & visual source pages

Hi All,

 

Typically I write my apex code in eclipse. When I try to format the code using ctrl+shift+f, it is not working. Is there any way to format apex code in eclipse.

 

Please let me know. An help in this regard really appreciated.

 

Regards,

Naren

Damien_Damien_

Code formatter doesn't work with the force.com plugin.

 

1) (Not sure if this one works) Put Eclipse into your java view and try again on the file.

2) Copy/paste your code into another temp file in Eclipse or Notepad++ and do formatting.

3) Use Ctrl + F and use find and replace.  (Only useful when you want to replace spaces with tabs to save for character space on Salesforce.  In order to replace with tab, you need to put a tab into your clipboard and then paste it into the replace section)

NarenKNarenK

Hi Damien,

 

Thank you for replying to my questions.

 

But as you know some times we have to do bulk code formatting. In that case we can't follow 2'nd and 3'rd  approaches you suggested. And the 1'st approach will not work, as I already tried this trick.

 

Regards,

Naren

CodeITCodeIT
i am using this one: http://www.forcextra.com , it formats apex and soql
ToshikiIgaToshikiIga
I released Apex code formatter written in Java. See below:
https://github.com/igapyon/blancoApexFormatter
 
Dhanik Lal SahniDhanik Lal Sahni
You can use http://jsbeautifier.org. It will format all most all required in SFDC development.