<commit_before>﻿// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.ImplementType;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.ImplementType;
using Microsoft.CodeAnalysis.SymbolSearch;

namespace Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.CodeActions
{
    internal readonly record struct OmniSharpCodeActionOptions(
        OmniSharpImplementTypeOptions ImplementTypeOptions)
    {
        internal CodeActionOptions GetCodeActionOptions(HostLanguageServices languageServices)
            => CodeActionOptions.GetDefault(languageServices) with
            {
                ImplementTypeOptions = new()
                {
                    InsertionBehavior = (ImplementTypeInsertionBehavior)ImplementTypeOptions.InsertionBehavior,
                    PropertyGenerationBehavior = (ImplementTypePropertyGenerationBehavior)ImplementTypeOptions.PropertyGenerationBehavior
                }
            };
    }
}<commit_msg>Pass LineFormatting options into OmniSharpCodeAction options<commit_after>﻿// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeCleanup;
using Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.ImplementType;
using Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Options;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.ImplementType;
using Microsoft.CodeAnalysis.SymbolSearch;

namespace Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.CodeActions
{
    internal readonly record struct OmniSharpCodeActionOptions(
        OmniSharpImplementTypeOptions ImplementTypeOptions,
        OmniSharpLineFormattingOptions LineFormattingOptions)
    {
        internal CodeActionOptions GetCodeActionOptions(HostLanguageServices languageServices)
        {
            var defaultOptions = CodeActionOptions.GetDefault(languageServices);
            return defaultOptions with
            {
                CleanupOptions = defaultOptions.CleanupOptions with
                {
                    FormattingOptions = defaultOptions.CleanupOptions.FormattingOptions.With(new LineFormattingOptions
                    {
                        IndentationSize = LineFormattingOptions.IndentationSize,
                        TabSize = LineFormattingOptions.TabSize,
                        UseTabs = LineFormattingOptions.UseTabs,
                        NewLine = LineFormattingOptions.NewLine,
                    })
                },
                ImplementTypeOptions = new()
                {
                    InsertionBehavior = (ImplementTypeInsertionBehavior)ImplementTypeOptions.InsertionBehavior,
                    PropertyGenerationBehavior = (ImplementTypePropertyGenerationBehavior)ImplementTypeOptions.PropertyGenerationBehavior
                }
            };
        }
    }
}
{'fraction_non_alphanumeric': 0.05234159779614325, 'fraction_numerical': 0.0, 'mean_word_length': 2.966019417475728, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '5530188', 'n_tokens_mistral': 721, 'n_tokens_neox': 706, 'n_words': 161}