private static boolean isInVariable(@Nullable PsiElement position) {
    if (position == null) {
      return false;
    }

    final PsiElement parent = position.getParent();
    if (parent instanceof GrVariable) {
      return ((GrVariable)parent).getTypeElementGroovy() == null && position == ((GrVariable)parent).getNameIdentifierGroovy();
    }
    if (parent instanceof GrCatchClause) {
      return ((GrCatchClause)parent).getParameter() == null;
    }

    return false;
  }
private static boolean isInVariable(@Nullable PsiElement position)