Eclipse:设置自动格式化的最大行长度?

本文翻译自:Eclipse: Set maximum line length for auto formatting?

I am working with Java. 我正在使用Java。 If I hit Ctrl + Shift + F in Eclipse Helios, it will auto format my code. 如果我在Eclipse Helios中按Ctrl + Shift + F ,它将自动格式化我的代码。 At a certain point, it wraps lines. 在某一点上,它包裹着线条。 I would like to increase the maximum line length. 我想增加最大线长。 How can I do this? 我怎样才能做到这一点?


#1楼

参考:https://stackoom.com/question/FVpf/Eclipse-设置自动格式化的最大行长度


#2楼

Take a look of following image: 看一下下面的图片:

Java->Code style->Formatter-> Edit

在此输入图像描述


#3楼

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


#4楼

对于XHTML文件: Web -> HTML Files -> Editor -> Line width


#5楼

Preferences -> Java -> Code Style -> Formatter / "Edit..." 首选项 - > Java - >代码样式 - >格式化程序/“编辑...”

Tabs: "Line wrapping" , "Comments" 标签:“换行”,“评论”

Field: "Maximum line width" 字段:“最大线宽”

Set both to make comments have the same length too. 设置两者以使注释具有相同的长度。 You might need to create a new profile if you don't have one already. 如果您还没有新配置文件,则可能需要创建新配置文件。


#6楼

In preferences Java -> Code Style -> Formatter , edit the profile. 在首选项Java - >代码样式 - >格式化程序中 ,编辑配置文件。 Under the Line Wrapping tab is the primary option for line width (Maximum line width:). Line Wrapping选项卡下是线宽(最大线宽:)的主要选项。 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. 如果您使用[Built-in]之一,则需要创建自己的配置文件以进行这些更改。 Just click "New..." on the formatter preferences page. 只需在格式化程序首选项页面上单击“新建...”即可。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值