How to disable IntelliJ auto-formatting for static arrays?

In some TestNG data providers, I have a static array initialization that looks like this:

return new Object[][] {
    {"Foo", "Bar"},
    {"Baz", "Quux"}
};

Since these are short lines, IntelliJ continues to reformat it on one line, but I want to keep it as it is for readability and future differences. Which option will Editor > Code Style > Javasave this for me?

+4
source share
1 answer

According to your requirement, the best option for you should be

Wrap and Braces β†’ Array Initializer

  • Put Wrap always .
  • () | '{' | '}' .

enter image description here

+3

Source: https://habr.com/ru/post/1660353/


All Articles