mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-22720 Extract Method does Not Preserve Existing Line Breaks
- keep empty lines between statements - add test GitOrigin-RevId: 276000bdce7ffee22ecd2e03d2ec4831dd8f6725
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cc03cdfb94
commit
dd5b188728
-3
@@ -566,9 +566,6 @@ public final class PyExtractMethodUtil {
|
||||
final PyFunction method = builder.buildFunction();
|
||||
final PyStatementList statementList = method.getStatementList();
|
||||
for (PsiElement element : elementsRange) {
|
||||
if (element instanceof PsiWhiteSpace) {
|
||||
continue;
|
||||
}
|
||||
statementList.add(element);
|
||||
}
|
||||
final PsiElement child = statementList.getFirstChild();
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class Foo:
|
||||
def bar(self):
|
||||
print('hello')
|
||||
|
||||
<caret>self.extracted()
|
||||
|
||||
return self
|
||||
|
||||
def extracted(self):
|
||||
print('awesome')
|
||||
|
||||
print('world')
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class Foo:
|
||||
def bar(self):
|
||||
print('hello')
|
||||
<selection>
|
||||
print('awesome')
|
||||
|
||||
print('world')
|
||||
</selection>
|
||||
return self
|
||||
@@ -348,4 +348,8 @@ public class PyExtractMethodTest extends LightMarkedTestCase {
|
||||
public void testTypedStatements() {
|
||||
doTest("greeting");
|
||||
}
|
||||
|
||||
public void testPreserveWhitespaceBetweenStatements() {
|
||||
doTest("extracted");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user