-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move more code down to shared layer #74539
Move more code down to shared layer #74539
Conversation
|
||
namespace Microsoft.CodeAnalysis.ImplementInterface; | ||
|
||
internal interface IImplementInterfaceInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was in a file related to implement-interface, which itself hasn't moved to this layer yet. that will be in followup pr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought implement interface required a VS UI dialog - is that necessary to move to the code style layer? Is there any SDK tool that could use it?
@@ -61,7 +61,7 @@ public override async Task ProvideCompletionsAsync(CompletionContext context) | |||
|
|||
protected override async Task<ISymbol> GenerateMemberAsync(ISymbol member, INamedTypeSymbol containingType, Document document, CompletionItem item, CancellationToken cancellationToken) | |||
{ | |||
var syntaxFactory = document.GetLanguageService<SyntaxGenerator>(); | |||
var syntaxFactory = document.GetRequiredLanguageService<SyntaxGenerator>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i ended up getting NRT warnings. not sure how htat started happening.
@@ -54,129 +54,6 @@ public static bool CompatibleSignatureToDelegate(this IMethodSymbol method, INam | |||
return true; | |||
} | |||
|
|||
public static IMethodSymbol RenameTypeParameters(this IMethodSymbol method, ImmutableArray<string> newNames) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helper extensions that moved to shared location
@@ -10,21 +10,6 @@ namespace Microsoft.CodeAnalysis.Shared.Extensions; | |||
|
|||
internal static partial class IParameterSymbolExtensions | |||
{ | |||
public static IParameterSymbol RenameParameter(this IParameterSymbol parameter, string parameterName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helper extensions that moved to shared location
@@ -208,28 +208,6 @@ where SymbolEquivalenceComparer.Instance.Equals(explicitInterfaceMethod, constru | |||
return type?.Accept(new UnnamedErrorTypeRemover(compilation)); | |||
} | |||
|
|||
[return: NotNullIfNotNull(parameterName: nameof(type))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helper extensions that moved to shared location
/// Generates a call to a method *through* an existing field or property symbol. | ||
/// </summary> | ||
/// <returns></returns> | ||
public static SyntaxNode GenerateDelegateThroughMemberStatement( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helper extensions that moved to shared location
|
||
internal static class CodeCleanupOptionsProviders | ||
{ | ||
#if !CODE_STYLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to shared location. was able to remove this IFDEF
@@ -63,40 +63,3 @@ internal static CodeAndImportGenerationOptions GetDefault(LanguageServices langu | |||
}; | |||
#endif | |||
} | |||
|
|||
internal static class CodeGenerationOptionsProviders |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to shared location. was able to remove this IFDEF
@@ -21,10 +21,8 @@ public static bool AllowImportsInHiddenRegions(this Document document) | |||
=> document.Services.GetService<Host.ISpanMappingService>()?.SupportsMappingImportDirectives == true; | |||
#endif | |||
|
|||
#if !CODE_STYLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
happyhapppy.
|
||
internal static class CodeCleanupOptionsProviders | ||
{ | ||
public static CodeCleanupOptions GetCodeCleanupOptions(this IOptionsReader options, LanguageServices languageServices, bool? allowImportsInHiddenRegions = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a move.
|
||
internal static class CodeGenerationOptionsProviders | ||
{ | ||
public static CodeGenerationOptions GetCodeGenerationOptions(this IOptionsReader options, LanguageServices languageServices) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a move.
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems
Outdated
Show resolved
Hide resolved
…kspaceExtensions.projitems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sharwell is this impacted by the stuff you were looking at about code fixes in the SDK?
Should we be adding more shared code here if we still have issues with API changes between an older SDK and newer VS?
Reference #72811
Answered offline - this is tangential, moving to the code style layer still needs to happen to run code fixes in SDK tools like dotnet format.
src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems
Outdated
Show resolved
Hide resolved
…kspaceExtensions.projitems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks fine - didn't take a close look at everything since it looks like mainly moves.
|
||
namespace Microsoft.CodeAnalysis.ImplementInterface; | ||
|
||
internal interface IImplementInterfaceInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought implement interface required a VS UI dialog - is that necessary to move to the code style layer? Is there any SDK tool that could use it?
|
||
internal static partial class IMethodSymbolExtensions | ||
{ | ||
public static IMethodSymbol EnsureNonConflictingNames( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are odd methods to be extension methods for a very general interface in a non-specific namespace. Why not move these to CodeGenerationSymbolFactory or some other code-generation related type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't care for now. :)
Allows 'implement abstract class' to be a code fixer in the code-style layer.