private static void RegisterRefactoring(RefactoringContext context, MemberDeclarationSyntax memberDeclaration, DocumentationCommentData data, SemanticModel semanticModel) { context.RegisterRefactoring( GetTitle(), ct => RefactorAsync(context.Document, memberDeclaration, data, semanticModel, ct), RefactoringDescriptors.CopyDocumentationCommentFromBaseMember); string GetTitle() { string s; DocumentationCommentOrigin origin = data.Origin; if (origin == DocumentationCommentOrigin.BaseMember) { s = "base"; } else if (origin == DocumentationCommentOrigin.InterfaceMember) { s = "interface"; } else { Debug.Fail(origin.ToString()); s = "base"; } return($"Add comment from {s} {CSharpFacts.GetTitle(memberDeclaration)}"); } }
private static string GetTitle(MemberDeclarationSyntax memberDeclaration, DocumentationCommentOrigin origin) { string s; if (origin == DocumentationCommentOrigin.BaseMember) { s = "base"; } else if (origin == DocumentationCommentOrigin.InterfaceMember) { s = "interface"; } else { Debug.Fail(origin.ToString()); s = "base"; } return($"Add comment from {s} {CSharpFacts.GetTitle(memberDeclaration)}"); }