int (InsertionContext context, int startOffset, PsiMethod method, StringBuffer buffer) { Document document = context.getEditor().getDocument(); int offset = startOffset + method.getName().length(); String paramText = buffer.toString(); document.insertString(offset, paramText); int endOffset = offset + paramText.length(); final Project project = context.getProject(); PsiDocumentManager.getInstance(project).commitDocument(document); PsiReference ref = context.getFile().findReferenceAt(startOffset); if (ref instanceof GrDocMethodReference methodReference) { GrDocMethodParams list = methodReference.getParameterList(); for (GrDocMethodParameter parameter : list.getParameters()) { JavaCodeStyleManager.getInstance(project).shortenClassReferences(parameter); } endOffset = methodReference.getTextRange().getEndOffset() + 1; } return endOffset; }