PY-22720 Extract Method does Not Preserve Existing Line Breaks

- keep empty lines between statements
- add test

(cherry picked from commit 276000bdce7ffee22ecd2e03d2ec4831dd8f6725)

IJ-MR-171066

GitOrigin-RevId: 15660649de5c799be2dee8c5c80e616827ef41db
This commit is contained in:
Marcus Mews
2025-08-05 09:18:03 +00:00
committed by intellij-monorepo-bot
parent 97f9f03382
commit 4e83c0cd74
4 changed files with 25 additions and 3 deletions

View File

@@ -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();