mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-83278 "Wrapping and Braces -> Keep when reformatting -> Multiple expressions in one line" prevents refactorings/intentions from producing correctly formatted code
Make it possible to use 'multiple expressions on the same line' from tests as well
This commit is contained in:
@@ -20,6 +20,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.lexer.JavaLexer;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
@@ -772,7 +773,8 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
// 1. Call 'introduce variable' refactoring for the code like 'System.out.println(1);';
|
||||
// 2. When KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE is on, the output looks like 'int i = 1; System.out.println(i);';
|
||||
// That's why we process the option only during the explicit reformat (directly invoked by an user).
|
||||
if ((mySettings.KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE && FormatterUtil.isFormatterCalledExplicitly())
|
||||
if ((mySettings.KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE
|
||||
&& (FormatterUtil.isFormatterCalledExplicitly() || ApplicationManager.getApplication().isUnitTestMode()))
|
||||
|| psi != null && PsiTreeUtil.hasErrorElements(psi))
|
||||
{
|
||||
minSpaces = 1;
|
||||
|
||||
Reference in New Issue
Block a user