diff --git a/python/src/com/jetbrains/python/codeInsight/editorActions/moveUpDown/StatementMover.java b/python/src/com/jetbrains/python/codeInsight/editorActions/moveUpDown/StatementMover.java index 2d5f5715b2ab..513d5d06b781 100644 --- a/python/src/com/jetbrains/python/codeInsight/editorActions/moveUpDown/StatementMover.java +++ b/python/src/com/jetbrains/python/codeInsight/editorActions/moveUpDown/StatementMover.java @@ -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; } diff --git a/python/testData/mover/commentOut.py b/python/testData/mover/commentOut.py new file mode 100644 index 000000000000..5131d71cf8db --- /dev/null +++ b/python/testData/mover/commentOut.py @@ -0,0 +1,5 @@ +if True: + a = 1 +else: + #comment + a = 2 \ No newline at end of file diff --git a/python/testData/mover/commentOut_afterDown.py b/python/testData/mover/commentOut_afterDown.py new file mode 100644 index 000000000000..279856eca063 --- /dev/null +++ b/python/testData/mover/commentOut_afterDown.py @@ -0,0 +1,5 @@ +if True: + a = 1 +else: + a = 2 + #comment diff --git a/python/testData/mover/commentOut_afterUp.py b/python/testData/mover/commentOut_afterUp.py new file mode 100644 index 000000000000..c0dc51720469 --- /dev/null +++ b/python/testData/mover/commentOut_afterUp.py @@ -0,0 +1,5 @@ +if True: + a = 1 + #comment +else: + a = 2 \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/PyStatementMoverTest.java b/python/testSrc/com/jetbrains/python/PyStatementMoverTest.java index 39a524e74cad..b345b346ef82 100644 --- a/python/testSrc/com/jetbrains/python/PyStatementMoverTest.java +++ b/python/testSrc/com/jetbrains/python/PyStatementMoverTest.java @@ -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(); }