mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
several more cases of inconsistent indentation (PY-1947)
This commit is contained in:
@@ -141,7 +141,7 @@ public class PyBlock implements ASTBlock {
|
||||
childIndent = Indent.getNoneIndent();
|
||||
}
|
||||
else {
|
||||
childIndent = Indent.getContinuationIndent();
|
||||
childIndent = Indent.getNormalIndent();
|
||||
}
|
||||
}
|
||||
else if (parentType == PyElementTypes.ARGUMENT_LIST) {
|
||||
@@ -152,7 +152,7 @@ public class PyBlock implements ASTBlock {
|
||||
childIndent = Indent.getNormalIndent();
|
||||
}
|
||||
}
|
||||
else if (parentType == PyElementTypes.DICT_LITERAL_EXPRESSION) {
|
||||
else if (parentType == PyElementTypes.DICT_LITERAL_EXPRESSION || parentType == PyElementTypes.SET_LITERAL_EXPRESSION) {
|
||||
if (childType == PyTokenTypes.RBRACE) {
|
||||
childIndent = Indent.getNoneIndent();
|
||||
}
|
||||
@@ -211,7 +211,9 @@ public class PyBlock implements ASTBlock {
|
||||
|
||||
private boolean needListAlignment(ASTNode child) {
|
||||
IElementType childType = child.getElementType();
|
||||
if (PyTokenTypes.OPEN_BRACES.contains(childType)) {
|
||||
ASTNode firstGrandchild = child.getFirstChildNode();
|
||||
IElementType firstGrandchildType = firstGrandchild == null ? null : firstGrandchild.getElementType();
|
||||
if (PyTokenTypes.OPEN_BRACES.contains(childType) || PyTokenTypes.OPEN_BRACES.contains(firstGrandchildType)) {
|
||||
return false;
|
||||
}
|
||||
if (PyTokenTypes.CLOSE_BRACES.contains(childType)) {
|
||||
|
||||
@@ -192,6 +192,26 @@ public class PyIndentTest extends PyLightFixtureTestCase {
|
||||
" <caret>params=1)");
|
||||
}
|
||||
|
||||
public void testEnterInSet() { // PY-1947
|
||||
doTest("test_set = {<caret>'some_value'}",
|
||||
"test_set = {\n" +
|
||||
" <caret>'some_value'}");
|
||||
|
||||
}
|
||||
|
||||
public void testEnterInList() { // PY-1947
|
||||
doTest("test_list = [<caret>'some_value']",
|
||||
"test_list = [\n" +
|
||||
" <caret>'some_value']");
|
||||
}
|
||||
|
||||
public void testEnterInDictInTuple() { // PY-1947
|
||||
doTest("td = ({<caret>})",
|
||||
"td = ({\n" +
|
||||
" <caret>\n" +
|
||||
"})");
|
||||
}
|
||||
|
||||
public void testIndentAfterComment() { // PY-641
|
||||
doTest("def foo():\n #some_call()<caret>\n another_call()", "def foo():\n #some_call()\n <caret>\n another_call()");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user