mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-2518 Join 2 ifs: merge comments if both presented
This commit is contained in:
-2
@@ -59,8 +59,6 @@ public class PyConvertLambdaToFunctionIntention extends BaseIntentionAction {
|
||||
functionBuilder.statement("return " + body.getText());
|
||||
PyFunction function = functionBuilder.buildFunction(project);
|
||||
|
||||
|
||||
|
||||
PyFunction parentFunction = PsiTreeUtil.getTopmostParentOfType(lambdaExpression, PyFunction.class);
|
||||
if (parentFunction != null ) {
|
||||
PyClass parentClass = PsiTreeUtil.getTopmostParentOfType(parentFunction, PyClass.class);
|
||||
|
||||
@@ -75,12 +75,13 @@ public class PyJoinIfIntention extends BaseIntentionAction {
|
||||
|
||||
List<PsiComment> comments = PsiTreeUtil.getChildrenOfTypeAsList(ifStatement.getIfPart(), PsiComment.class);
|
||||
comments.addAll(PsiTreeUtil.getChildrenOfTypeAsList(((PyIfStatement)firstStatement).getIfPart(), PsiComment.class));
|
||||
comments.addAll(PsiTreeUtil.getChildrenOfTypeAsList(ifStatementList, PsiComment.class));
|
||||
comments.addAll(PsiTreeUtil.getChildrenOfTypeAsList(stList, PsiComment.class));
|
||||
|
||||
for (PsiElement comm : comments) {
|
||||
ifStatement.getIfPart().addBefore(comm, ifStatementList);
|
||||
comm.delete();
|
||||
}
|
||||
|
||||
ifStatementList.replace(stList);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user