How do you auto-format code in Eclipse?
相关问题
- Eclipse and Mylyn : how to disable grey files in t
- Installing Pydev for Eclipse throws error
- Error in Scala Compiler: java.lang.AssertionError:
- How to remove unused imports using Eclipse and not
- Assume/switch role in aws toolkit for eclipse 2.0
相关文章
- selenium+eclipse 打开网页时报错
- Eclipse failing to open
- Eclipse how can I indent C++ preprocessor macros
- Why is FindBugs ignoring my check for null?
- Eclipse cleanup - what are the “.index” files - ca
- Eclipse plugin to find out unused methods in a cla
- Spring NamespaceHandler issue when launching Maven
- Google USB Package isn't showing in SDK Manang
right-click on the project > Properties > Java Editor > Save Actions
Another option is to go to Window->Preferences->Java->Editor->SaveActions and check the Format source code option. Then your source code will be formatted truly automatically each time you save it.
Notice: It did not format the document unless I corrected all mistakes. Check your file before pressing CTRLSHIFTF.
You can do with some step bellow
Step 1: press Ctr + A(windows) or cmd + A (Mac os)
Step 2: Ctr + I in windows or cmd + I in Mac os
It will auto format for you
Regards
Press: Ctrl + A or highlight the part of the code you wish to indent and then press ctrl + i.
Update your IDE with the latest PDT version for better code formatting. On the main menu click Help -> Install New Software and then add the following URL in the Work with field:
When asked for the name, give it
PDT4.0.1
and then move along with the update or install.It will see if the appropriate PDT is already installed or if it is a lower version, which then would be updated.
After restarting or applying the changes go to Windows -> Preferences on the side bar and expand PHP -> Code Style. Here you will see an item named Formatter. Select it and choose the active profile for the code formating. Thats it.
The next time you format it, it will choose a format according to the chosen active profile.
Hope it helps.