void (InsertionContext context) { PsiFile file = context.getFile(); PsiElement element = file.findElementAt(context.getTailOffset()); if (element instanceof PsiWhiteSpace && (!element.textContains('\n') || CodeStyle.getLanguageSettings(file, JavaLanguage.INSTANCE).METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE )) { element = file.findElementAt(element.getTextRange().getEndOffset()); } if (element != null && PsiUtilCore.getElementType(element) == JavaTokenType.LPARENTH && element.getParent() instanceof PsiExpressionList) { context.getDocument().deleteString(context.getTailOffset(), element.getParent().getTextRange().getEndOffset()); } }