mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-completion] SemicolonFixer: cosmetic
GitOrigin-RevId: 4cf39ca29f402fad784fde227676a4139b849c41
This commit is contained in:
committed by
intellij-monorepo-bot
parent
65b99c3554
commit
af80b1afd1
+5
-8
@@ -13,15 +13,12 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class SemicolonFixer extends AbstractBasicSemicolonFixer {
|
||||
@Override
|
||||
protected boolean fixReturn(@NotNull Editor editor, @Nullable PsiElement psiElement) {
|
||||
if (psiElement instanceof PsiReturnStatement) {
|
||||
if (psiElement instanceof PsiReturnStatement stmt) {
|
||||
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;
|
||||
}
|
||||
if (method != null && PsiTypes.voidType().equals(method.getReturnType()) && stmt.getReturnValue() != null) {
|
||||
Document doc = editor.getDocument();
|
||||
doc.insertString(stmt.getTextRange().getStartOffset() + "return".length(), ";");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user