void (@NotNull InsertionContext context, @NotNull String text) { PsiElement newElement = PsiUtilCore.getElementAtOffset(context.getFile(), context.getStartOffset()); PsiExpressionList parameterList = PsiTreeUtil.getParentOfType(newElement, PsiExpressionList.class); if (parameterList != null) { final TextRange range = parameterList.getTextRange(); context.getDocument().replaceString(range.getStartOffset(), range.getEndOffset(), "(" + text + ")"); context.commitDocument(); shortenArgumentsClassReferences(context); } }