Eclipse does not break line when formatting code

Source: Internet
Author: User

Eclipse does not break line when formatting code

Each time you format the code with Eclipse's own ctrl+shift+f, if the original line of code is greater than 80 columns, eclipse will automatically change to multiple lines, which is not very comfortable, a simple try, can be modified in the following ways:
1, Preferences->java->code Style->code formatter->show ..., after opening, select the "Line wrapping" tab, in the "Maximun line width "Specifies that the line is greater than the number of columns, generally around 150.
2, or in the "Line wrapping" tab, you can select "Lines wrapping Policy" can specify the constructor, method body, and so on.
However, the default encoding style recommended by Sun is a 80 column line break.


1.Java Code
Open Eclipse's Window menu, and then Preferences->java->code style->formatter->edit/show (different buttons available depending on the version)->line Wrapping->maximum line width: Change from 80 to 200.


2.Html Code
Window->preferences->myeclipse->files and editors->html->html source->line width-> default is 72, Save after 150 instead.



After the change, the previous class of more than 5,900 lines was formatted once. The discovery code is hundreds of lines short. How many lines of code can a programmer write in a day?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.