Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to hide comments in Eclipse

Tags:

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

like image 723
Jarek Avatar asked Dec 03 '10 15:12

Jarek


People also ask

How do I change the comment style in Eclipse?

Eclipse: Change the block comment style of ctrl+shift+/

How do I set default comments in Eclipse?

Simply go to: Window - Preferences - Java - Code Style - Code Templates - Comments - Types - Edit... and change ${user} to whatever you want. Also go to: Window - Preferences - Java - Editor - Templates - @author - Edit... and change ${user} to whatever you want.

What is the shortcut key for Uncomment in Eclipse?

CTRL + SHIFT + \ –> to uncomment block of code, which is already commented.

How do I get commented code from Eclipse?

Finding comments is easy: search for "/*" or "//". And since comments have no formal relation to code, when is a comment "about" the code nearby, and when is it just a comment ("a sonnet to ...")?


2 Answers

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

like image 111
Mark Mayo Avatar answered Oct 22 '22 10:10

Mark Mayo


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

Then the comments will go away!

like image 21
wfoster Avatar answered Oct 22 '22 10:10

wfoster