PY-10972 Properly align elements of expressions without closing bracket on enter

instead of using artificially built indentation. It also covers all
collection literals, comprehensions and glued string literals in
parentheses most of which were overlooked in the previous implementation.
This commit is contained in:
Mikhail Golubev
2018-04-03 18:45:43 +03:00
parent 95506492ed
commit 0e9810168a
21 changed files with 109 additions and 47 deletions
@@ -365,7 +365,8 @@ public class PyEditingTest extends PyTestCase {
public void testEndOfStringInParenth() {
doTestEnter("print (\"foo\"<caret>\n" +
" \"bar\")",
"print (\"foo\"\n\n" +
"print (\"foo\"\n" +
" \n" +
" \"bar\")");
}
@@ -596,4 +597,49 @@ public class PyEditingTest extends PyTestCase {
public void testIncompleteFunctionTypeComment() {
doTypingTest('.');
}
// PY-10972
public void testEnterInIncompleteTupleLiteral() {
doTypingTest("\n'baz'");
}
// PY-10972
public void testEnterInIncompleteListLiteral() {
doTypingTest("\n'baz'");
}
// PY-10972
public void testEnterInIncompleteSetLiteral() {
doTypingTest("\n'baz'");
}
// PY-10972
public void testEnterInIncompleteDictLiteral() {
doTypingTest("\n'baz'");
}
// PY-10972
public void testEnterInIncompleteGluedStringLiteralInParentheses() {
doTypingTest("\n'bar'");
}
// PY-10972
public void testEnterInIncompleteListComprehension() {
doTypingTest("\nfoo");
}
// PY-10972
public void testEnterInIncompleteSetComprehension() {
doTypingTest("\nfoo");
}
// PY-10972
public void testEnterInIncompleteDictComprehension() {
doTypingTest("\nfoo");
}
// PY-10972
public void testEnterInIncompleteParenthesizedGenerator() {
doTypingTest("\nfoo");
}
}