mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-21 14:01:44 +07:00
PY-27266 Don't use ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION in Python formatter
It is not actually exposed anywhere in Python code style settings and defaults to false thus affecting parenthesized multiline (chained) qualified references and calls. Previously, oddly enough, this behavior was controlled by ALIGN_COLLECTIONS_AND_COMPREHENSIONS flag.
This commit is contained in:
@@ -321,7 +321,7 @@ public class PyBlock implements ASTBlock {
|
||||
// TODO: merge with needChildAlignment()
|
||||
//Align elements vertically if there is an argument in the first line of parenthesized expression
|
||||
else if (!hasHangingIndent(myNode.getPsi()) &&
|
||||
((parentType == PyElementTypes.PARENTHESIZED_EXPRESSION && myContext.getSettings().ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION) ||
|
||||
(parentType == PyElementTypes.PARENTHESIZED_EXPRESSION ||
|
||||
(parentType == PyElementTypes.ARGUMENT_LIST && myContext.getSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS) ||
|
||||
(parentType == PyElementTypes.PARAMETER_LIST && myContext.getSettings().ALIGN_MULTILINE_PARAMETERS)) &&
|
||||
!isIndentNext(child) &&
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
some_var = (Foo
|
||||
.bar
|
||||
.baz)
|
||||
@@ -0,0 +1,3 @@
|
||||
some_var = (Foo
|
||||
.bar
|
||||
.baz)
|
||||
@@ -0,0 +1,3 @@
|
||||
some_var = (Foo
|
||||
.bar()
|
||||
.baz())
|
||||
@@ -0,0 +1,3 @@
|
||||
some_var = (Foo
|
||||
.bar()
|
||||
.baz())
|
||||
@@ -903,4 +903,14 @@ public class PyFormatterTest extends PyTestCase {
|
||||
public void testVariableAnnotations() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
|
||||
}
|
||||
|
||||
// PY-27266
|
||||
public void testChainedMethodCallsInParentheses() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-27266
|
||||
public void testChainedAttributeAccessInParentheses() {
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user