Java 在 Eclipse 中隐藏注释的任何方式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4346859/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 16:17:04  来源:igfitidea点击:

Any way to hide comments in Eclipse

javaeclipse

提问by Jarek

Does anyone know if it would be possible to hide java comments in Eclipse? Is there any trick I could try?

有谁知道是否可以在 Eclipse 中隐藏 Java 注释?有什么技巧可以尝试吗?

回答by Mark Mayo

You can fold most block /* ... */comments to a single line. You can't do that inside code blocks (method bodies, static blocks, etc.) and maybe a few other places. You also can't collapse multiple lines of // ...style comments.

您可以将大多数块/* ... */注释折叠为一行。你不能在代码块(方法体、静态块等)和其他一些地方这样做。您也不能折叠多行// ...样式注释。

You could always change the syntax highlighting colors so the comments are in the background color. ;)

您可以随时更改语法突出显示颜色,以便注释处于背景颜色中。;)

To turn on folding: Windows->Preferences->Java->Editor->Folding

打开折叠:Windows->Preferences->Java->Editor->Folding

回答by wfoster

Enabling 'Folding' in the preferences dialog lets you use the '+' and '-' buttons next to the line numbers to hide comments. Do do this...

在首选项对话框中启用“折叠”可让您使用行号旁边的“+”和“-”按钮来隐藏注释。这样做...

Windows->Preferences->Java->Editor->Folding

Windows->首选项->Java->编辑器->折叠

Then the comments will go away!

然后评论就会消失!