mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Unconditionally add alignment to arguments when there is no hanging indent
This commit is contained in:
@@ -29,7 +29,6 @@ import com.jetbrains.python.PyElementTypes;
|
||||
import com.jetbrains.python.PyTokenTypes;
|
||||
import com.jetbrains.python.PythonDialectsTokenSetProvider;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import com.jetbrains.python.psi.impl.PyPsiUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -514,13 +513,7 @@ public class PyBlock implements ASTBlock {
|
||||
if (child.getElementType() == PyTokenTypes.COMMA) {
|
||||
return false;
|
||||
}
|
||||
PyArgumentList argList = (PyArgumentList)_node.getPsi();
|
||||
if (argList != null) {
|
||||
PyExpression[] arguments = argList.getArguments();
|
||||
return arguments.length > 1 || hasLineBreaksBefore(child, 1) || (
|
||||
arguments.length == 1 && PyPsiUtils.getNextComma(arguments[0].getNode()) != null);
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
if (_node.getElementType() == PyElementTypes.PARAMETER_LIST) {
|
||||
return !hasHangingIndent(_node.getPsi()) && myContext.getSettings().ALIGN_MULTILINE_PARAMETERS;
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
with foo(bar(baz(1
|
||||
)
|
||||
)
|
||||
):
|
||||
pass
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
with foo(bar(baz(1
|
||||
)
|
||||
)
|
||||
):
|
||||
pass
|
||||
@@ -477,6 +477,10 @@ public class PyFormatterTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAlignmentOfClosingParenthesisInNestedFunctionCallsWithSingleArgument() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
/**
|
||||
* This test merely checks that call to {@link com.intellij.psi.codeStyle.CodeStyleManager#reformat(com.intellij.psi.PsiElement)}
|
||||
* is possible for Python sources.
|
||||
|
||||
Reference in New Issue
Block a user