Eclipse: Set maximum line length for auto formatting?

前端 未结 10 795
情歌与酒
情歌与酒 2020-12-04 04:22

I am working with Java. If I hit Ctrl+Shift+F in Eclipse Helios, it will auto format my code. At a certain point, it wraps lines. I would li

相关标签:
10条回答
  • 2020-12-04 05:01

    For XHTML files: Web -> HTML Files -> Editor -> Line width

    0 讨论(0)
  • 2020-12-04 05:02

    Comments have their own line length setting at the bottom of the setting page java->code style->formatter-> Edit... ->comments

    0 讨论(0)
  • 2020-12-04 05:02

    For HTML / PHP / JSP / JSPF: Web -> HTML Files -> Editor -> Line width

    0 讨论(0)
  • 2020-12-04 05:08

    I use the Eclipse version called Mars which works with Java 7.

    Go to Preferences -> Java -> Code Style -> Formatter

    Click on the Edit Button shown in the right side of "Active Profile" drop down

    Tabs: "Line wrapping"

    Field: "Maximum line width", Set the desired value (Default value set to 120) to increase/decrease the line length in the editor

    Note: Remember to rename the Active profile to the name of your choice, as the default Eclipse profile won't accept your changes.

    0 讨论(0)
  • 2020-12-04 05:20

    In preferences Java -> Code Style -> Formatter, edit the profile. Under the Line Wrapping tab is the primary option for line width (Maximum line width:). In the Comments tab you have a separate option Maximum line width for comments:, which will also need to be changed to affect comment wrapping.

    You will need to make your own profile to make these changes in if you using one of the [Built-in] ones. Just click "New..." on the formatter preferences page.

    0 讨论(0)
  • 2020-12-04 05:20

    Click Project->preferences. Type format into the search - you should see java->code style->formatter. Click that, then edit - finally, the line wrapping tab - its there :)

    0 讨论(0)
提交回复
热议问题