Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyboard shortcut to completely hide Java-doc comments so they take no lines in the code anymore

I know the shortcuts:

CTRL + SHIFT + +

CTRL + SHIFT + -

Which expand and minimize Java-doc comments respectively. However this way of line collapsing keeps a line of space:

enter image description here

How do you collapse so that no lines of code are occupied by comments anymore? How I see it is that the java-doc comments from above takes 1 line of code.

I try to work distraction free and thus only want to show my actual code.


Here is the official page of Intellij where their code folding shortcuts are summarised (Android Studio is a fork of Intellij so they have almost the same shortcuts). I can't find the shortcut I am looking for here.

like image 231
Joop Avatar asked Apr 26 '15 10:04

Joop


People also ask

What is the shortcut for creating a Javadoc comment?

Add a Javadoc using automatic commentsType /** before a declaration and press Enter .

How do I block comments in IntelliJ?

Block comments are enclosed in slash-asterisk ( /*) and asterisk-slash ( */ ). To add a block comment in IntelliJ IDEA, press ⌥ ⌘ / macOS or Ctrl + Shift + / on Windows and Linux.

How do you do Javadoc style comments?

Writing Javadoc Comments In general, Javadoc comments are any multi-line comments (" /** ... */ ") that are placed before class, field, or method declarations. They must begin with a slash and two stars, and they can include special tags to describe characteristics like method parameters or return values.

What is Javadoc comments in Java?

What is Javadoc? Javadoc is a tool which comes with JDK and it is used for generating Java code documentation in HTML format from Java source code, which requires documentation in a predefined format. Following is a simple example where the lines inside /*…. */ are Java multi-line comments.


2 Answers

Code -> Folding -> Collapse doc comments

like image 171
Sergey Bulavkin Avatar answered Nov 02 '22 22:11

Sergey Bulavkin


Select the part you want to hide and press ctrl+alt+T. Choose either

//<editor-fold desc="Description">
// part to hide
//</editor-fold>

or

//region Description
// part to hide
//endregion

Change Description to something that won't distract you, for example _.
After collapsing this block you will see only _.

like image 31
Vitaly Zinchenko Avatar answered Nov 02 '22 23:11

Vitaly Zinchenko