-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Do not make unnecessarily simplification changes in sync-namespace. #78969
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
Conversation
@@ -58,7 +54,4 @@ public CSharpSyncNamespaceCodeRefactoringProvider() | |||
|
|||
return null; | |||
} | |||
|
|||
protected override string EscapeIdentifier(string identifier) | |||
=> identifier.EscapeIdentifier(); |
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.
unused.
@@ -2169,7 +2235,7 @@ namespace {{defaultNamespace}} | |||
{ | |||
public static class Extensions | |||
{ | |||
public static bool Foo(this string s) => true; | |||
public static bool Foo(this String s) => true; |
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.
desirable change in behavior. we were unnecessarily changing this here, despite it having nothing to do with the namespaces being changed.
public CSharpChangeNamespaceService() | ||
{ | ||
} | ||
public override AbstractReducer NameReducer { get; } = new CSharpNameReducer(); |
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.
general idea is htat we go find the locations of interest, and only simplify them with the language's name simplifier (not all the other simplifiers).
@@ -501,15 +503,6 @@ private static SyntaxNode CreateImport(SyntaxGenerator syntaxGenerator, string n | |||
return (solutionWithFixedReferences, refLocationGroups.SelectAsArray(g => g.Key)); | |||
} | |||
|
|||
private readonly struct LocationForAffectedSymbol(ReferenceLocation location, bool isReferenceToExtensionMethod) |
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 its own file.
name = parentName; | ||
|
||
return name.Parent is TCrefSyntax ? name.Parent : name; | ||
} | ||
} |
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.
crux of the change. we only go fixup names that were using one of hte namespace names in either the old namespace name, or the new namespace name.
/// declaration in global namespace and there's no namespace declaration in this document. | ||
/// (3) otherwise, null. | ||
/// </returns> | ||
protected abstract Task<SyntaxNode?> TryGetApplicableInvocationNodeAsync(Document document, TextSpan span, CancellationToken cancellationToken); |
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 up from bottom.
/// </returns> | ||
protected abstract Task<SyntaxNode?> TryGetApplicableInvocationNodeAsync(Document document, TextSpan span, CancellationToken cancellationToken); | ||
|
||
protected abstract string EscapeIdentifier(string identifier); |
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.
removed.
Fixes #34707