boolean (@NotNull Editor editor, @Nullable PsiElement psiElement) { if (psiElement instanceof PsiReturnStatement) { PsiMethod method = PsiTreeUtil.getParentOfType(psiElement, PsiMethod.class, true, PsiLambdaExpression.class); if (method != null && PsiTypes.voidType().equals(method.getReturnType())) { PsiReturnStatement stmt = (PsiReturnStatement)psiElement; if (stmt.getReturnValue() != null) { Document doc = editor.getDocument(); doc.insertString(stmt.getTextRange().getStartOffset() + "return".length(), ";"); return true; } } } return false; }