mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-5527 Move statement: unnecessary pass statement on moving one-line comment out of indented block
This commit is contained in:
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user