Disable indentation for Lambda Expressions/Anonymous Classes in Intellij IDEA
intellij-14, intellij-idea
Solution
You need to close the outmost parenthesis right next to the closing bracket for the anonymous class to get the desired indentation.
Instead of:
itemClose.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
}
}
);
Remove the line/space between the last } and ); and you get:
itemClose.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
}
});
Problem
The following image pretty much illustrates the whole issue: I have tried using `// formatter:off` with the appropriate settings, but to no avail. I have also tried looking for indentation rules for lambda expressions/anonymous classes, but I couldn't find those. Any suggestion is much appreciated!