是否有 Eclipse 线宽标记?
我有一个特定的项目,我需要将每个代码行包装为 65 个字符.我已经为此正确设置了 eclipse Java 代码格式化程序.但我真正想要的是在编辑器中绘制一条垂直线,显示我打字时的最大线宽,而不仅仅是在我运行格式化程序时.我知道此功能在某些方面可用,因为它显示在代码格式化程序属性页中.
I have a specific project where I need to wrap every code line at 65 characters. I have set up the eclipse Java code formatter properly for this. But what I really want is a vertical line to be drawn in the editor showing where the max line width while I am typing, not just when I run the formmater. I know this feature is available in some capacity because it is displayed in the code formatter property page.
我在 Eclipse 中没有看到任何打开它的选项,我也没有在 Eclipse Plugin Central 上看到任何插件
I don't see any option in eclipse to turn this on and I didn't see any plug-ins that do it on Eclipse Plugin Central
推荐答案
查看 Windows/Preferences(至少在 Windows - IIRC 上它会针对不同的操作系统移动)然后:
Look in Windows / Preferences (at least on Windows - IIRC it moves around for different operating systems) then:
General -> Editors -> Text Editors -> Show Print Margin
勾选它,它应该会显示该行.
Tick this and it should show the line.
作为一种快速查找方法,请使用顶部的搜索过滤器并过滤边距".
As a quick way of finding this, use the search filter in the top and filter on "margin".
评论中的注释 - 未经我验证,但我没有理由怀疑它们:
Notes from the comments - unverified by me, but I have no reason to doubt them:
它在 2016 年发生了某种变化:有关详细信息,请参阅 [这里] (https://bugs.eclipse.org/bugs/show_bug.cgi?id=495490#c2) 你必须在格式化程序中设置它:从菜单 [Window]-->[Preferences],选择 [Java]-->[Code Style]-->[Formatter],然后编辑您的格式化程序配置文件.在标签页[换行]中,您可以找到名为最大线宽"的设置.更改此设置,Java 源代码编辑器中的打印边距也将更改.
It has changed somehow in 2016: For details see [here] (https://bugs.eclipse.org/bugs/show_bug.cgi?id=495490#c2) You have to set it in the formatter: From menu [Window]-->[Preferences], select [Java]-->[Code Style]-->[Formatter], and then edit your formatter profile. In the tab page [Line wrapping], you can find a setting named "Maximum line width". Change this setting, and the print margin in Java source editor will be changed too.
相关文章