public static IEnumerable <AttributeListSyntax> SplitAttributes(AttributeListSyntax attributeList) { if (attributeList == null) { throw new ArgumentNullException(nameof(attributeList)); } SeparatedSyntaxList <AttributeSyntax> attributes = attributeList.Attributes; for (int i = 0; i < attributes.Count; i++) { AttributeListSyntax list = AttributeList(attributes[i]); if (i == 0) { list = list.WithLeadingTrivia(attributeList.GetLeadingTrivia()); } if (i == attributes.Count - 1) { list = list.WithTrailingTrivia(attributeList.GetTrailingTrivia()); } yield return(list.WithFormatterAnnotation()); } }