Kialandei
Kialandei

Reputation: 394

Is it possible to stop Intellij from formatting comment blocks?

Our company requires that we put a formatted comment block at the top of all our files with copyright information in it. It's easy enough to automate the generation of this through the file templates, but I'm having a problem in that IntelliJ insists on applying code formatting to the comment block and removes a lot of the formatting spaces. So that this:

/************************************************************
 *                                                          *
 * Contents of file Copyright (c) The Company 2015          *
 *                                                          *
 *----------------------------------------------------------*
 *                                                          *
 * WARNING:                                                 *
 * Lorem ipsum dolor sit amet, consectetur adipiscing elit. *
 * Cras imperdiet mi nec urna lacinia, facilisis molestie   *
 * augue lacinia. Curabitur sagittis vestibulum ultrices.   *
 *                                                          *
 * Vestibulum et ante sed libero vestibulum cursus a        *
 * consectetur augue. Pellentesque tristique imperdiet      *
 * lacinia. Fusce ac magna justo. Donec hendrerit nunc ut   *
 * odio fermentum, sit amet fermentum leo tempor. Mauris    *
 * vestibulum dui risus, vel rutrum nulla fermentum quis.   *
 *                                                          *
 * Duis quis iaculis enim, feugiat ultricies mi...          *
 *                                                          *
 ************************************************************/

becomes this:

/************************************************************
 * *
 * Contents of file Copyright (c) The Company 2015          *
 * *
 * ----------------------------------------------------------*
 * *
 * WARNING:                                                 *
 * Lorem ipsum dolor sit amet, consectetur adipiscing elit. *
 * Cras imperdiet mi nec urna lacinia, facilisis molestie   *
 * augue lacinia. Curabitur sagittis vestibulum ultrices.   *
 * *
 * Vestibulum et ante sed libero vestibulum cursus a        *
 * consectetur augue. Pellentesque tristique imperdiet      *
 * lacinia. Fusce ac magna justo. Donec hendrerit nunc ut   *
 * odio fermentum, sit amet fermentum leo tempor. Mauris    *
 * vestibulum dui risus, vel rutrum nulla fermentum quis.   *
 * *
 * Duis quis iaculis enim, feugiat ultricies mi...          *
 * *
 ************************************************************/

Unfortunately I can't change the content of the block, so my only option lies within IntelliJ's configuration (if it even lies there). Everything's formatted fine when I create the file, but if I ever run the code formatting tool, it gets messed up.

Upvotes: 1

Views: 93

Answers (1)

gabbar0x
gabbar0x

Reputation: 4246

Yes. You can disable JavaDoc formatting completely.

Go to Settings -> Editor-> Code Style -> JAVA -> JavaDoc Tab and uncheck Enable JavaDoc Formatting. Hope that does it

Upvotes: 2

Related Questions