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:
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.
Add a Javadoc using automatic commentsType /** before a declaration and press Enter .
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.
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? 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.
Code -> Folding -> Collapse doc comments
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 _
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With