<commit_before>﻿// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.CSharp.Utilities
{
    internal static partial class UsingsAndExternAliasesOrganizer
    {
        private static readonly SyntaxTrivia s_newLine = SyntaxFactory.ElasticCarriageReturnLineFeed;

        public static void Organize(
            SyntaxList<ExternAliasDirectiveSyntax> externAliasList,
            SyntaxList<UsingDirectiveSyntax> usingList,
            bool placeSystemNamespaceFirst, bool separateGroups,
            out SyntaxList<ExternAliasDirectiveSyntax> organizedExternAliasList,
            out SyntaxList<UsingDirectiveSyntax> organizedUsingList)
        {
            OrganizeWorker(
                externAliasList, usingList, placeSystemNamespaceFirst,
                out organizedExternAliasList, out organizedUsingList);

            if (separateGroups)
            {
                if (organizedExternAliasList.Count > 0 && organizedUsingList.Count > 0)
                {
                    var firstUsing = organizedUsingList[0];

                    if (!firstUsing.GetLeadingTrivia().Any(t => t.IsEndOfLine()))
                    {
                        var newFirstUsing = firstUsing.WithPrependedLeadingTrivia(s_newLine);
                        organizedUsingList = organizedUsingList.Replace(firstUsing, newFirstUsing);
                    }
                }

                for (var i = 1; i < organizedUsingList.Count; i++)
                {
                    var lastUsing = organizedUsingList[i - 1];<commit_msg>Change the Using organizer to not use ElasticTrivia for the NewLine<commit_after>﻿// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.CSharp.Utilities
{
    internal static partial class UsingsAndExternAliasesOrganizer
    {
        private static readonly SyntaxTrivia s_newLine = SyntaxFactory.CarriageReturnLineFeed;

        public static void Organize(
            SyntaxList<ExternAliasDirectiveSyntax> externAliasList,
            SyntaxList<UsingDirectiveSyntax> usingList,
            bool placeSystemNamespaceFirst, bool separateGroups,
            out SyntaxList<ExternAliasDirectiveSyntax> organizedExternAliasList,
            out SyntaxList<UsingDirectiveSyntax> organizedUsingList)
        {
            OrganizeWorker(
                externAliasList, usingList, placeSystemNamespaceFirst,
                out organizedExternAliasList, out organizedUsingList);

            if (separateGroups)
            {
                if (organizedExternAliasList.Count > 0 && organizedUsingList.Count > 0)
                {
                    var firstUsing = organizedUsingList[0];

                    if (!firstUsing.GetLeadingTrivia().Any(t => t.IsEndOfLine()))
                    {
                        var newFirstUsing = firstUsing.WithPrependedLeadingTrivia(s_newLine);
                        organizedUsingList = organizedUsingList.Replace(firstUsing, newFirstUsing);
                    }
                }

                for (var i = 1; i < organizedUsingList.Count; i++)
                {
                    var lastUsing = organizedUsingList[i - 1];
{'fraction_non_alphanumeric': 0.06476886915643772, 'fraction_numerical': 0.003656307129798903, 'mean_word_length': 2.416592328278323, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4629546', 'n_tokens_mistral': 965, 'n_tokens_neox': 911, 'n_words': 217}