Skip to content

Conversation

@CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented Jun 13, 2025

Fixes #34707

}

protected override string EscapeIdentifier(string identifier)
=> identifier.EscapeIdentifier();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused.

@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review June 13, 2025 21:50
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner June 13, 2025 21:50
public static class Extensions
{
public static bool Foo(this string s) => true;
public static bool Foo(this String s) => true;
Copy link
Member Author

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.

@CyrusNajmabadi CyrusNajmabadi requested a review from JoeRobich June 13, 2025 22:00
public CSharpChangeNamespaceService()
{
}
public override AbstractReducer NameReducer { get; } = new CSharpNameReducer();
Copy link
Member Author

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).

return (solutionWithFixedReferences, refLocationGroups.SelectAsArray(g => g.Key));
}

private readonly struct LocationForAffectedSymbol(ReferenceLocation location, bool isReferenceToExtensionMethod)
Copy link
Member Author

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.


return name.Parent is TCrefSyntax ? name.Parent : name;
}
}
Copy link
Member Author

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);
Copy link
Member Author

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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sync namespace to folder reformats the entire document

3 participants