@Nullable("is null when called from inspection") final Editor editor,
@NotNull PsiElement startElement, @NotNull PsiElement endElement) {
final PsiElement p = findChildOfClass(findParentOfType(startElement, GoFunctionDeclaration.class), GoBlockStatement.class);
GoPsiElement childOfClass = findChildOfClass(p, GoVarDeclarations.class);
if (childOfClass == null)
childOfClass = findChildOfClass(p, GoVarDeclaration.class);
if (childOfClass == null)
childOfClass = findChildOfClass(p, GoShortVarDeclaration.class);
ArrayList<String> arguments = new ArrayList<String>();
final String fnArguments = CreateFunctionFix.InspectionGenFuncArgs(startElement, arguments);
final int insertPoint;
if (childOfClass == null) {
insertPoint = p.getTextOffset() + 2;
} else {
insertPoint = childOfClass.getTextRange().getEndOffset();
}
Document doc = PsiDocumentManager.getInstance(startElement.getProject()).getDocument(file);