mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-17674 Add linefeed before right brace in dict literals when it's preceded by colon
Rules about literal braces is considered earlier than those for colons in spacing builder.
This commit is contained in:
@@ -99,6 +99,8 @@ public class PythonFormattingModelBuilder implements FormattingModelBuilderEx, C
|
||||
.afterInside(RARROW, ANNOTATION).spaces(1)
|
||||
|
||||
.between(allButLambda(), PARAMETER_LIST).spaceIf(commonSettings.SPACE_BEFORE_METHOD_PARENTHESES)
|
||||
.afterInside(LBRACE, DICT_LITERAL_EXPRESSION).spaceIf(pySettings.SPACE_WITHIN_BRACES, pySettings.DICT_NEW_LINE_AFTER_LEFT_BRACE)
|
||||
.beforeInside(RBRACE, DICT_LITERAL_EXPRESSION).spaceIf(pySettings.SPACE_WITHIN_BRACES, pySettings.DICT_NEW_LINE_BEFORE_RIGHT_BRACE)
|
||||
|
||||
.before(COLON).spaceIf(pySettings.SPACE_BEFORE_PY_COLON)
|
||||
.after(COMMA).spaceIf(commonSettings.SPACE_AFTER_COMMA)
|
||||
@@ -115,8 +117,6 @@ public class PythonFormattingModelBuilder implements FormattingModelBuilderEx, C
|
||||
.withinPairInside(LPAR, RPAR, PARENTHESIZED_EXPRESSION).spaces(0)
|
||||
.before(LBRACKET).spaceIf(pySettings.SPACE_BEFORE_LBRACKET)
|
||||
|
||||
.afterInside(LBRACE, DICT_LITERAL_EXPRESSION).spaceIf(pySettings.SPACE_WITHIN_BRACES, pySettings.DICT_NEW_LINE_AFTER_LEFT_BRACE)
|
||||
.beforeInside(RBRACE, DICT_LITERAL_EXPRESSION).spaceIf(pySettings.SPACE_WITHIN_BRACES, pySettings.DICT_NEW_LINE_BEFORE_RIGHT_BRACE)
|
||||
.withinPair(LBRACE, RBRACE).spaceIf(pySettings.SPACE_WITHIN_BRACES)
|
||||
.withinPair(LBRACKET, RBRACKET).spaceIf(commonSettings.SPACE_WITHIN_BRACKETS)
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
incoming_invite_post_schema = {
|
||||
"definitions": {
|
||||
"player": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
}
|
||||
},}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
incoming_invite_post_schema = {
|
||||
"definitions": {
|
||||
"player": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -612,6 +612,12 @@ public class PyFormatterTest extends PyTestCase {
|
||||
getPythonCodeStyleSettings().DICT_NEW_LINE_BEFORE_RIGHT_BRACE = true;
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-17674
|
||||
public void testForceNewLineBeforeRightBraceInDictAfterColon() {
|
||||
getPythonCodeStyleSettings().DICT_NEW_LINE_BEFORE_RIGHT_BRACE = true;
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-16393
|
||||
public void testHangingIndentDetectionIgnoresComments() {
|
||||
|
||||
Reference in New Issue
Block a user