mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Consider option about new line after opening brace in dicts when aligning closing one
Because this setting causes hanging indent to appear on reformat.
This commit is contained in:
@@ -617,7 +617,8 @@ public class PyBlock implements ASTBlock {
|
||||
myContext.getMode() == FormattingMode.ADJUST_INDENT) {
|
||||
return true;
|
||||
}
|
||||
return !hasHangingIndent(myNode.getPsi());
|
||||
return !hasHangingIndent(myNode.getPsi()) && !(myNode.getElementType() == PyElementTypes.DICT_LITERAL_EXPRESSION &&
|
||||
myContext.getPySettings().DICT_NEW_LINE_AFTER_LEFT_BRACE);
|
||||
}
|
||||
if (myNode.getElementType() == PyElementTypes.ARGUMENT_LIST) {
|
||||
if (!myContext.getSettings().ALIGN_MULTILINE_PARAMETERS_IN_CALLS || hasHangingIndent(myNode.getPsi())) {
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
d = {"foo": 1,
|
||||
"bar": 2
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
d = {
|
||||
"foo": 1,
|
||||
"bar": 2
|
||||
}
|
||||
@@ -484,6 +484,11 @@ public class PyFormatterTest extends PyTestCase {
|
||||
public void testAlignmentOfClosingBraceInDictLiteralWhenNoHangingIndent() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNoAlignmentClosingBraceInDictLiteralWhenOpeningBraceIsForcedOnNewLine() {
|
||||
getPythonCodeStyleSettings().DICT_NEW_LINE_AFTER_LEFT_BRACE = true;
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-13004
|
||||
public void testAlignmentOfClosingParenthesisOfArgumentListWhenNoHangingIndent() {
|
||||
|
||||
Reference in New Issue
Block a user