Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tmat committed Jul 10, 2024
1 parent fbd1d8a commit 81f28d7
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)

var actions = token.Parent.GetAncestorsOrThis<TypeSyntax>()
.Where(_interfaceName)
.Select(n => service.GetCodeActions(document, context.Options.GetImplementTypeOptions(document.Project.Services), model, n, cancellationToken))
.Select(n => service.GetCodeActions(document, context.Options.GetOptions(document.Project.Services).ImplementTypeOptions, model, n, cancellationToken))
.FirstOrDefault(a => !a.IsEmpty);

if (actions.IsDefaultOrEmpty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
return;

var data = await ImplementAbstractClassData.TryGetDataAsync(
document, classNode, GetClassIdentifier(classNode), context.Options.GetImplementTypeOptions(document.Project.Services), cancellationToken).ConfigureAwait(false);
document, classNode, GetClassIdentifier(classNode), context.Options.GetOptions(document.Project.Services).ImplementTypeOptions, cancellationToken).ConfigureAwait(false);
if (data == null)
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ImplementInterface
Dim service = document.GetLanguageService(Of IImplementInterfaceService)()
Dim actions = service.GetCodeActions(
document,
context.Options.GetImplementTypeOptions(document.Project.Services),
context.Options.GetOptions(document.Project.Services).ImplementTypeOptions,
Await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(False),
typeNode,
cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,13 @@

using System;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.AddImport;
using Microsoft.CodeAnalysis.CodeCleanup;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeFixesAndRefactorings;
using Microsoft.CodeAnalysis.CodeGeneration;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.Diagnostics.Analyzers.NamingStyles;
using Microsoft.CodeAnalysis.ExtractMethod;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.ImplementType;
using Microsoft.CodeAnalysis.OrganizeImports;
using Microsoft.CodeAnalysis.Simplification;
using Microsoft.CodeAnalysis.SymbolSearch;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.CodeActions;

Expand Down Expand Up @@ -89,19 +79,4 @@ internal static CodeActionOptionsProvider GetOptionsProvider(this FixAllContext
internal static CodeActionOptionsProvider GetOptionsProvider(this IFixAllContext context)
=> context.State.CodeActionOptionsProvider;
#endif

#if !CODE_STYLE
public static ImplementTypeOptions GetImplementTypeOptions(this CodeActionOptionsProvider provider, LanguageServices languageServices)
=> provider.GetOptions(languageServices).ImplementTypeOptions;

public static ExtractMethodGenerationOptions GetExtractMethodGenerationOptions(this CodeActionOptionsProvider provider, LanguageServices languageServices)
{
var codeActionOptions = provider.GetOptions(languageServices);
return new()
{
CodeGenerationOptions = codeActionOptions.CodeGenerationOptions,
CodeCleanupOptions = codeActionOptions.CleanupOptions,
};
}
#endif
}

0 comments on commit 81f28d7

Please sign in to comment.