fixed PY-5527 Move statement: unnecessary pass statement on moving one-line comment out of indented block

This commit is contained in:
Ekaterina Tuzova
2012-03-22 15:59:49 +04:00
parent 5caf729b30
commit c4928a6bfc
5 changed files with 21 additions and 2 deletions
@@ -129,7 +129,7 @@ public class StatementMover extends LineMover {
PyElement statementPart = getStatementParts(info, editor, file, down).first;
if (statementPart instanceof PyStatementPart) {
PyStatementList statementList = ((PyStatementPart)statementPart).getStatementList();
if (statementList != null && statementList.getStatements().length == 1) {
if (statementList != null && statementList.getStatements().length == 1 && !(myStatementToMove instanceof PsiComment)) {
if (theSameLevel) {
myStatementListToAddPassAfter = statementList;
}
+5
View File
@@ -0,0 +1,5 @@
if True:
a = 1
else:
#comment <caret>
a = 2
@@ -0,0 +1,5 @@
if True:
a = 1
else:
a = 2
#comment <caret>
@@ -0,0 +1,5 @@
if True:
a = 1
#comment <caret>
else:
a = 2
@@ -41,11 +41,15 @@ public class PyStatementMoverTest extends PyTestCase {
doTest();
}
public void testCommentOut() { //PY-5527
doTest();
}
public void testMoveDownOut() {
doTest();
}
public void testComment() {
public void testComment() { //PY-5270
doTest();
}