diff --git a/CodeDocumentor.Test/Classes/ClassUnitTests.cs b/CodeDocumentor.Test/Classes/ClassUnitTests.cs
index 34507d4..dd883c9 100644
--- a/CodeDocumentor.Test/Classes/ClassUnitTests.cs
+++ b/CodeDocumentor.Test/Classes/ClassUnitTests.cs
@@ -46,7 +46,7 @@ public void NoDiagnosticsShow(string testCode)
/// The column.
[Theory]
[InlineData("ClassTester.cs", "ClassTesterFix.cs", 7, 19, TestFixure.DIAG_TYPE_PRIVATE)]
- [InlineData("PublicClassTester.cs", "PublicClassTesterFix.cs", 7, 26, TestFixure.DIAG_TYPE_PUBLIC)]
+ [InlineData("PublicClassTester.cs", "PublicClassTesterFix.cs", 7, 26, TestFixure.DIAG_TYPE_PUBLIC_ONLY)]
public void ShowDiagnosticAndFix(string testCode, string fixCode, int line, int column, string diagType)
{
var fix = _fixture.LoadTestFile($@"./Classes/{fixCode}");
@@ -88,7 +88,10 @@ protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer(string diagTyp
CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = false;
return new NonPublicClassAnalyzer();
}
- CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = true;
+ if (diagType == TestFixure.DIAG_TYPE_PUBLIC_ONLY)
+ {
+ CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = true;
+ }
return new ClassAnalyzer();
}
}
diff --git a/CodeDocumentor.Test/ConstructorUnitTests.cs b/CodeDocumentor.Test/ConstructorUnitTests.cs
index a2176d1..4d18050 100644
--- a/CodeDocumentor.Test/ConstructorUnitTests.cs
+++ b/CodeDocumentor.Test/ConstructorUnitTests.cs
@@ -186,9 +186,9 @@ public void NoDiagnosticsShow(string testCode)
/// The line.
/// The column.
[Theory]
- [InlineData(PublicConstructorTestCode, PublicContructorTestFixCode, 10, 10, TestFixure.DIAG_TYPE_PUBLIC)]
+ [InlineData(PublicConstructorTestCode, PublicContructorTestFixCode, 10, 10, TestFixure.DIAG_TYPE_PUBLIC_ONLY)]
[InlineData(PrivateConstructorTestCode, PrivateContructorTestFixCode, 10, 11, TestFixure.DIAG_TYPE_PRIVATE)]
- [InlineData(PublicConstructorWithBooleanParameterTestCode, PublicContructorWithBooleanParameterTestFixCode, 10, 10, TestFixure.DIAG_TYPE_PUBLIC)]
+ [InlineData(PublicConstructorWithBooleanParameterTestCode, PublicContructorWithBooleanParameterTestFixCode, 10, 10, TestFixure.DIAG_TYPE_PUBLIC_ONLY)]
public void ShowDiagnosticAndFix(string testCode, string fixCode, int line, int column, string diagType)
{
var expected = new DiagnosticResult
@@ -227,7 +227,10 @@ protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer(string diagTyp
CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = false;
return new NonPublicConstructorAnalyzer();
}
- CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = true;
+ if (diagType == TestFixure.DIAG_TYPE_PUBLIC_ONLY)
+ {
+ CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = true;
+ }
return new ConstructorAnalyzer();
}
}
diff --git a/CodeDocumentor.Test/EnumUnitTests.cs b/CodeDocumentor.Test/EnumUnitTests.cs
index 32d6f40..5449c2d 100644
--- a/CodeDocumentor.Test/EnumUnitTests.cs
+++ b/CodeDocumentor.Test/EnumUnitTests.cs
@@ -93,9 +93,9 @@ public void ShowDiagnosticAndFix(string testCode, string fixCode, int line, int
}
};
- this.VerifyCSharpDiagnostic(testCode, TestFixure.DIAG_TYPE_PUBLIC, expected);
+ this.VerifyCSharpDiagnostic(testCode, TestFixure.DIAG_TYPE_PUBLIC_ONLY, expected);
- this.VerifyCSharpFix(testCode, fixCode, TestFixure.DIAG_TYPE_PUBLIC);
+ this.VerifyCSharpFix(testCode, fixCode, TestFixure.DIAG_TYPE_PUBLIC_ONLY);
}
///
diff --git a/CodeDocumentor.Test/FieldUnitTests.cs b/CodeDocumentor.Test/FieldUnitTests.cs
index 88f1fa3..c7cfc9b 100644
--- a/CodeDocumentor.Test/FieldUnitTests.cs
+++ b/CodeDocumentor.Test/FieldUnitTests.cs
@@ -126,9 +126,9 @@ public void ShowDiagnosticAndFix(string testCode, string fixCode, int line, int
}
};
- this.VerifyCSharpDiagnostic(testCode, TestFixure.DIAG_TYPE_PUBLIC, expected);
+ this.VerifyCSharpDiagnostic(testCode, TestFixure.DIAG_TYPE_PUBLIC_ONLY, expected);
- this.VerifyCSharpFix(testCode, fixCode, TestFixure.DIAG_TYPE_PUBLIC);
+ this.VerifyCSharpFix(testCode, fixCode, TestFixure.DIAG_TYPE_PUBLIC_ONLY);
}
///
@@ -151,7 +151,10 @@ protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer(string diagTyp
CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = false;
return new NonPublicFieldAnalyzer();
}
- CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = true;
+ if (diagType == TestFixure.DIAG_TYPE_PUBLIC_ONLY)
+ {
+ CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = true;
+ }
return new FieldAnalyzer();
}
}
diff --git a/CodeDocumentor.Test/InterfaceUnitTests.cs b/CodeDocumentor.Test/InterfaceUnitTests.cs
index 6c984b3..c35a120 100644
--- a/CodeDocumentor.Test/InterfaceUnitTests.cs
+++ b/CodeDocumentor.Test/InterfaceUnitTests.cs
@@ -93,9 +93,9 @@ public void ShowDiagnosticAndFix(string testCode, string fixCode, int line, int
}
};
- this.VerifyCSharpDiagnostic(testCode, TestFixure.DIAG_TYPE_PUBLIC, expected);
+ this.VerifyCSharpDiagnostic(testCode, TestFixure.DIAG_TYPE_PUBLIC_ONLY, expected);
- this.VerifyCSharpFix(testCode, fixCode, TestFixure.DIAG_TYPE_PUBLIC);
+ this.VerifyCSharpFix(testCode, fixCode, TestFixure.DIAG_TYPE_PUBLIC_ONLY);
}
///
diff --git a/CodeDocumentor.Test/MethodUnitTests.cs b/CodeDocumentor.Test/MethodUnitTests.cs
index 2d42c8a..d61eeb0 100644
--- a/CodeDocumentor.Test/MethodUnitTests.cs
+++ b/CodeDocumentor.Test/MethodUnitTests.cs
@@ -606,9 +606,9 @@ public void ShowDiagnosticAndFix(string testCode, string fixCode, int line, int
}
};
- this.VerifyCSharpDiagnostic(testCode, TestFixure.DIAG_TYPE_PUBLIC, expected);
+ this.VerifyCSharpDiagnostic(testCode, TestFixure.DIAG_TYPE_PUBLIC_ONLY, expected);
- this.VerifyCSharpFix(testCode, fixCode, TestFixure.DIAG_TYPE_PUBLIC);
+ this.VerifyCSharpFix(testCode, fixCode, TestFixure.DIAG_TYPE_PUBLIC_ONLY);
}
///
@@ -631,7 +631,10 @@ protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer(string diagTyp
CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = false;
return new NonPublicMethodAnalyzer();
}
- CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = true;
+ if (diagType == TestFixure.DIAG_TYPE_PUBLIC_ONLY)
+ {
+ CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = true;
+ }
return new MethodAnalyzer();
}
diff --git a/CodeDocumentor.Test/PropertyUnitTests.cs b/CodeDocumentor.Test/PropertyUnitTests.cs
index 82c737f..466af51 100644
--- a/CodeDocumentor.Test/PropertyUnitTests.cs
+++ b/CodeDocumentor.Test/PropertyUnitTests.cs
@@ -309,6 +309,80 @@ public class PropertyTester
}";
+
+ ///
+ /// The public property test code.
+ ///
+ private const string PublicPropertyInterfaceTestCode = @"
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ConsoleApp4
+{
+ public interface PropertyTester
+ {
+ public string PersonName => ""Person Name"";
+ }
+}";
+
+ ///
+ /// The public property test fix code.
+ ///
+ private const string PublicPropertyInterfaceTestFixCode = @"
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ConsoleApp4
+{
+ public interface PropertyTester
+ {
+ ///
+ /// Gets the person name.
+ ///
+ public string PersonName => ""Person Name"";
+ }
+}";
+
+
+
+
+ ///
+ /// The public property test code.
+ ///
+ private const string PrivatePropertyInterfaceTestCode = @"
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ConsoleApp4
+{
+ public interface PropertyTester
+ {
+ string PersonName => ""Person Name"";
+ }
+}";
+
+ ///
+ /// The public property test fix code.
+ ///
+ private const string PrivatePropertyInterfaceTestFixCode = @"
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ConsoleApp4
+{
+ public interface PropertyTester
+ {
+ ///
+ /// Gets the person name.
+ ///
+ string PersonName => ""Person Name"";
+ }
+}";
+
}
///
/// The property unit test.
@@ -344,15 +418,17 @@ public void NoDiagnosticsShow(string testCode)
/// The line.
/// The column.
[Theory]
- [InlineData(PropertyWithGetterSetterTestCode, PropertyWithGetterSetterTestFixCode, 10, 17)]
- [InlineData(PropertyOnlyGetterTestCode, PropertyOnlyGetterTestFixCode, 10, 17)]
- [InlineData(PropertyPrivateGetterTestCode, PropertyPrivateGetterTestFixCode, 10, 23)]
- [InlineData(PropertyInternalGetterTestCode, PropertyInternalGetterTestFixCode, 10, 23)]
- [InlineData(BooleanPropertyTestCode, BooleanPropertyTestFixCode, 10, 15)]
- [InlineData(NullableBooleanPropertyTestCode, NullableBooleanPropertyTestFixCode, 10, 16)]
- [InlineData(ExpressionBodyPropertyTestCode, ExpressionBodyPropertyTestFixCode, 10, 17)]
- [InlineData(NullableDateTimePropertyTestCode, NullableDateTimePropertyTestFixCode, 10, 20)]
- public void ShowDiagnosticAndFix(string testCode, string fixCode, int line, int column)
+ [InlineData(PropertyWithGetterSetterTestCode, PropertyWithGetterSetterTestFixCode, 10, 17, TestFixure.DIAG_TYPE_PUBLIC_ONLY)]
+ [InlineData(PropertyOnlyGetterTestCode, PropertyOnlyGetterTestFixCode, 10, 17, TestFixure.DIAG_TYPE_PUBLIC_ONLY)]
+ [InlineData(PropertyPrivateGetterTestCode, PropertyPrivateGetterTestFixCode, 10, 23, TestFixure.DIAG_TYPE_PUBLIC_ONLY)]
+ [InlineData(PropertyInternalGetterTestCode, PropertyInternalGetterTestFixCode, 10, 23, TestFixure.DIAG_TYPE_PUBLIC_ONLY)]
+ [InlineData(BooleanPropertyTestCode, BooleanPropertyTestFixCode, 10, 15, TestFixure.DIAG_TYPE_PUBLIC_ONLY)]
+ [InlineData(NullableBooleanPropertyTestCode, NullableBooleanPropertyTestFixCode, 10, 16, TestFixure.DIAG_TYPE_PUBLIC_ONLY)]
+ [InlineData(ExpressionBodyPropertyTestCode, ExpressionBodyPropertyTestFixCode, 10, 17, TestFixure.DIAG_TYPE_PUBLIC_ONLY)]
+ [InlineData(NullableDateTimePropertyTestCode, NullableDateTimePropertyTestFixCode, 10, 20, TestFixure.DIAG_TYPE_PUBLIC_ONLY)]
+ [InlineData(PublicPropertyInterfaceTestCode, PublicPropertyInterfaceTestFixCode, 10, 17, TestFixure.DIAG_TYPE_PUBLIC)]
+ [InlineData(PrivatePropertyInterfaceTestCode, PrivatePropertyInterfaceTestFixCode, 10, 10, TestFixure.DIAG_TYPE_PRIVATE)]
+ public void ShowDiagnosticAndFix(string testCode, string fixCode, int line, int column, string diagType)
{
var expected = new DiagnosticResult
{
@@ -365,9 +441,9 @@ public void ShowDiagnosticAndFix(string testCode, string fixCode, int line, int
}
};
- this.VerifyCSharpDiagnostic(testCode, TestFixure.DIAG_TYPE_PUBLIC, expected);
+ this.VerifyCSharpDiagnostic(testCode, diagType, expected);
- this.VerifyCSharpFix(testCode, fixCode, TestFixure.DIAG_TYPE_PUBLIC);
+ this.VerifyCSharpFix(testCode, fixCode, diagType);
}
///
@@ -385,12 +461,15 @@ protected override CodeFixProvider GetCSharpCodeFixProvider()
/// A DiagnosticAnalyzer.
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer(string diagType)
{
- if (diagType == "private")
+ if (diagType == TestFixure.DIAG_TYPE_PRIVATE)
{
CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = false;
return new NonPublicPropertyAnalyzer();
}
- CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = true;
+ if (diagType == TestFixure.DIAG_TYPE_PUBLIC_ONLY)
+ {
+ CodeDocumentorPackage.Options.IsEnabledForPublishMembersOnly = true;
+ }
return new PropertyAnalyzer();
}
}
diff --git a/CodeDocumentor.Test/TestFixure.cs b/CodeDocumentor.Test/TestFixure.cs
index 1e46a0f..5be0030 100644
--- a/CodeDocumentor.Test/TestFixure.cs
+++ b/CodeDocumentor.Test/TestFixure.cs
@@ -9,6 +9,7 @@ namespace CodeDocumentor.Test
public class TestFixure
{
public const string DIAG_TYPE_PUBLIC = "public";
+ public const string DIAG_TYPE_PUBLIC_ONLY = "publicOnly";
public const string DIAG_TYPE_PRIVATE = "private";
public TestFixure()
diff --git a/CodeDocumentor/Analyzers/Classes/ClassCodeFixProvider.cs b/CodeDocumentor/Analyzers/Classes/ClassCodeFixProvider.cs
index b201858..d575a59 100644
--- a/CodeDocumentor/Analyzers/Classes/ClassCodeFixProvider.cs
+++ b/CodeDocumentor/Analyzers/Classes/ClassCodeFixProvider.cs
@@ -93,7 +93,8 @@ private async Task AddDocumentationHeaderAsync(Document document, Synt
//append to any existing leading trivia [attributes, decorators, etc)
SyntaxTriviaList leadingTrivia = declarationSyntax.GetLeadingTrivia();
- SyntaxTriviaList newLeadingTrivia = leadingTrivia.Insert(leadingTrivia.Count - 1, SyntaxFactory.Trivia(commentTrivia));
+
+ var newLeadingTrivia = DocumentationHeaderHelper.BuildLeadingTrivia(leadingTrivia, commentTrivia);
ClassDeclarationSyntax newDeclaration = declarationSyntax.WithLeadingTrivia(newLeadingTrivia);
SyntaxNode newRoot = root.ReplaceNode(declarationSyntax, newDeclaration);
diff --git a/CodeDocumentor/Analyzers/Constructors/ConstructorCodeFixProvider.cs b/CodeDocumentor/Analyzers/Constructors/ConstructorCodeFixProvider.cs
index 5d09044..fd6504d 100644
--- a/CodeDocumentor/Analyzers/Constructors/ConstructorCodeFixProvider.cs
+++ b/CodeDocumentor/Analyzers/Constructors/ConstructorCodeFixProvider.cs
@@ -77,7 +77,7 @@ private async Task AddDocumentationHeaderAsync(Document document, Synt
SyntaxTriviaList leadingTrivia = declarationSyntax.GetLeadingTrivia();
DocumentationCommentTriviaSyntax commentTrivia = await Task.Run(() => CreateDocumentationCommentTriviaSyntax(declarationSyntax), cancellationToken);
- SyntaxTriviaList newLeadingTrivia = leadingTrivia.Insert(leadingTrivia.Count - 1, SyntaxFactory.Trivia(commentTrivia));
+ var newLeadingTrivia = DocumentationHeaderHelper.BuildLeadingTrivia(leadingTrivia, commentTrivia);
ConstructorDeclarationSyntax newDeclaration = declarationSyntax.WithLeadingTrivia(newLeadingTrivia);
SyntaxNode newRoot = root.ReplaceNode(declarationSyntax, newDeclaration);
diff --git a/CodeDocumentor/Analyzers/Enums/EnumCodeFixProvider.cs b/CodeDocumentor/Analyzers/Enums/EnumCodeFixProvider.cs
index 8909059..fa00b10 100644
--- a/CodeDocumentor/Analyzers/Enums/EnumCodeFixProvider.cs
+++ b/CodeDocumentor/Analyzers/Enums/EnumCodeFixProvider.cs
@@ -75,7 +75,7 @@ private async Task AddDocumentationHeaderAsync(Document document, Synt
string comment = CommentHelper.CreateEnumComment(declarationSyntax.Identifier.ValueText.AsSpan());
DocumentationCommentTriviaSyntax commentTrivia = await Task.Run(() => DocumentationHeaderHelper.CreateOnlySummaryDocumentationCommentTrivia(comment), cancellationToken);
- SyntaxTriviaList newLeadingTrivia = leadingTrivia.Insert(leadingTrivia.Count - 1, SyntaxFactory.Trivia(commentTrivia));
+ var newLeadingTrivia = DocumentationHeaderHelper.BuildLeadingTrivia(leadingTrivia, commentTrivia);
EnumDeclarationSyntax newDeclaration = declarationSyntax.WithLeadingTrivia(newLeadingTrivia);
SyntaxNode newRoot = root.ReplaceNode(declarationSyntax, newDeclaration);
diff --git a/CodeDocumentor/Analyzers/Fields/FieldCodeFixProvider.cs b/CodeDocumentor/Analyzers/Fields/FieldCodeFixProvider.cs
index 69463fc..93e4045 100644
--- a/CodeDocumentor/Analyzers/Fields/FieldCodeFixProvider.cs
+++ b/CodeDocumentor/Analyzers/Fields/FieldCodeFixProvider.cs
@@ -82,7 +82,7 @@ private async Task AddDocumentationHeaderAsync(Document document, Synt
string comment = CommentHelper.CreateFieldComment(field.Identifier.ValueText.AsSpan());
DocumentationCommentTriviaSyntax commentTrivia = await Task.Run(() => DocumentationHeaderHelper.CreateOnlySummaryDocumentationCommentTrivia(comment), cancellationToken);
- SyntaxTriviaList newLeadingTrivia = leadingTrivia.Insert(leadingTrivia.Count - 1, SyntaxFactory.Trivia(commentTrivia));
+ var newLeadingTrivia = DocumentationHeaderHelper.BuildLeadingTrivia(leadingTrivia, commentTrivia);
FieldDeclarationSyntax newDeclaration = declarationSyntax.WithLeadingTrivia(newLeadingTrivia);
SyntaxNode newRoot = root.ReplaceNode(declarationSyntax, newDeclaration);
diff --git a/CodeDocumentor/InterfaceAnalyzer.cs b/CodeDocumentor/Analyzers/Interfaces/InterfaceAnalyzer.cs
similarity index 100%
rename from CodeDocumentor/InterfaceAnalyzer.cs
rename to CodeDocumentor/Analyzers/Interfaces/InterfaceAnalyzer.cs
diff --git a/CodeDocumentor/InterfaceCodeFixProvider.cs b/CodeDocumentor/Analyzers/Interfaces/InterfaceCodeFixProvider.cs
similarity index 96%
rename from CodeDocumentor/InterfaceCodeFixProvider.cs
rename to CodeDocumentor/Analyzers/Interfaces/InterfaceCodeFixProvider.cs
index 1e99418..f57c2bd 100644
--- a/CodeDocumentor/InterfaceCodeFixProvider.cs
+++ b/CodeDocumentor/Analyzers/Interfaces/InterfaceCodeFixProvider.cs
@@ -86,7 +86,7 @@ private async Task AddDocumentationHeaderAsync(Document document, Synt
DocumentationCommentTriviaSyntax commentTrivia = SyntaxFactory.DocumentationCommentTrivia(SyntaxKind.SingleLineDocumentationCommentTrivia, list);
SyntaxTriviaList leadingTrivia = declarationSyntax.GetLeadingTrivia();
- SyntaxTriviaList newLeadingTrivia = leadingTrivia.Insert(leadingTrivia.Count - 1, SyntaxFactory.Trivia(commentTrivia));
+ var newLeadingTrivia = DocumentationHeaderHelper.BuildLeadingTrivia(leadingTrivia, commentTrivia);
InterfaceDeclarationSyntax newDeclaration = declarationSyntax.WithLeadingTrivia(newLeadingTrivia);
SyntaxNode newRoot = root.ReplaceNode(declarationSyntax, newDeclaration);
diff --git a/CodeDocumentor/CodeDocumentor.csproj b/CodeDocumentor/CodeDocumentor.csproj
index 4df7f6f..f2a9eb4 100644
--- a/CodeDocumentor/CodeDocumentor.csproj
+++ b/CodeDocumentor/CodeDocumentor.csproj
@@ -70,8 +70,8 @@
-
-
+
+
diff --git a/CodeDocumentor/Helper/DocumentationHeaderHelper.cs b/CodeDocumentor/Helper/DocumentationHeaderHelper.cs
index ed9c447..cfb8cdf 100644
--- a/CodeDocumentor/Helper/DocumentationHeaderHelper.cs
+++ b/CodeDocumentor/Helper/DocumentationHeaderHelper.cs
@@ -445,6 +445,26 @@ internal static XmlTextSyntax CreateSummaryTextSyntax(string content)
return SyntaxFactory.XmlText(newLine0Token, text1Token, newLine2Token, text2Token);
}
+ ///
+ /// Builds the leading trivia.
+ ///
+ /// The leading trivia.
+ /// The comment trivia.
+ /// A SyntaxTriviaList.
+ internal static SyntaxTriviaList BuildLeadingTrivia(SyntaxTriviaList leadingTrivia, DocumentationCommentTriviaSyntax commentTrivia)
+ {
+ SyntaxTriviaList newLeadingTrivia;
+ if (leadingTrivia.All(a=> a.IsKind(SyntaxKind.EndOfLineTrivia)))
+ {
+ newLeadingTrivia = leadingTrivia.Add(SyntaxFactory.Trivia(commentTrivia));
+ }
+ else
+ {
+ newLeadingTrivia = leadingTrivia.Insert(leadingTrivia.Count - 1, SyntaxFactory.Trivia(commentTrivia));
+ }
+ return newLeadingTrivia;
+ }
+
///
/// Creates line start text syntax.
///
diff --git a/CodeDocumentor/Helper/PrivateMemberVerifier.cs b/CodeDocumentor/Helper/PrivateMemberVerifier.cs
index 87b0016..1c7a9a2 100644
--- a/CodeDocumentor/Helper/PrivateMemberVerifier.cs
+++ b/CodeDocumentor/Helper/PrivateMemberVerifier.cs
@@ -53,7 +53,15 @@ public static bool IsPrivateMember(FieldDeclarationSyntax node)
// If the member is public, we still need to verify whether its parent class is a private class. Since we
// don't want show warnings for public members within a private class.
- return IsPrivateMember(node.Parent as ClassDeclarationSyntax);
+ if (node.Parent is ClassDeclarationSyntax cds)
+ {
+ return IsPrivateMember(cds);
+ }
+ if (node.Parent is InterfaceDeclarationSyntax ids)
+ {
+ return IsPrivateMember(ids);
+ }
+ return false;
}
///
@@ -70,7 +78,15 @@ public static bool IsPrivateMember(ConstructorDeclarationSyntax node)
// If the member is public, we still need to verify whether its parent class is a private class. Since we
// don't want show warnings for public members within a private class.
- return IsPrivateMember(node.Parent as ClassDeclarationSyntax);
+ if (node.Parent is ClassDeclarationSyntax cds)
+ {
+ return IsPrivateMember(cds);
+ }
+ if (node.Parent is InterfaceDeclarationSyntax ids)
+ {
+ return IsPrivateMember(ids);
+ }
+ return false;
}
///
@@ -87,7 +103,15 @@ public static bool IsPrivateMember(PropertyDeclarationSyntax node)
// If the member is public, we still need to verify whether its parent class is a private class. Since we
// don't want show warnings for public members within a private class.
- return IsPrivateMember(node.Parent as ClassDeclarationSyntax);
+ if (node.Parent is ClassDeclarationSyntax cds)
+ {
+ return IsPrivateMember(cds);
+ }
+ if (node.Parent is InterfaceDeclarationSyntax ids)
+ {
+ return IsPrivateMember(ids);
+ }
+ return false;
}
///
@@ -104,7 +128,15 @@ public static bool IsPrivateMember(MethodDeclarationSyntax node)
// If the member is public, we still need to verify whether its parent class is a private class. Since we
// don't want show warnings for public members within a private class.
- return IsPrivateMember(node.Parent as ClassDeclarationSyntax);
+ if (node.Parent is ClassDeclarationSyntax cds)
+ {
+ return IsPrivateMember(cds);
+ }
+ if (node.Parent is InterfaceDeclarationSyntax ids)
+ {
+ return IsPrivateMember(ids);
+ }
+ return false;
}
}
}
diff --git a/Manifests/vs2022/source.extension.vsixmanifest b/Manifests/vs2022/source.extension.vsixmanifest
index 97e74f0..9b39e85 100644
--- a/Manifests/vs2022/source.extension.vsixmanifest
+++ b/Manifests/vs2022/source.extension.vsixmanifest
@@ -1,7 +1,7 @@
-
+
CodeDocumentor
An Extension to generate XML documentation automatically using IntelliSense for interface,class,enum, field, constructor, property and method.
logo.png
diff --git a/TestProject/Sample/Sample/protoTester.cs b/TestProject/Sample/Sample/protoTester.cs
index 15fd753..e1c0a0b 100644
--- a/TestProject/Sample/Sample/protoTester.cs
+++ b/TestProject/Sample/Sample/protoTester.cs
@@ -2,6 +2,7 @@
using ProtoBuf;
namespace Sample;
+
[ProtoContract]
public class protoTester
{
@@ -24,6 +25,9 @@ public class protoTester
private string ManWorker() { return ""; }
}
+///
+/// The field tester.
+///
public class FieldTester
{
@@ -33,6 +37,48 @@ public FieldTester()
{
}
}
+
+
+private class PrivateClass
+{
+
+ const int ConstFieldTester = 666;
+
+ private PrivateClass()
+ {
+ }
+}
+
+///
+/// The Test integer interface.
+///
+public interface TestInt
+{
+ ///
+ /// Gets or Sets the my property public.
+ ///
+ public int MyPropertyPublic { get; set; }
+
+ ///
+ /// Gets or Sets the my property internal.
+ ///
+ internal int MyPropertyInternal { get; set; }
+
+ ///
+ /// Gets or Sets the my property protected.
+ ///
+ protected int MyPropertyProtected { get; set; }
+
+ ///
+ /// Gets or Sets the my property.
+ ///
+ int MyProperty { get; set; }
+
+ ///
+ /// Tests the method.
+ ///
+ void TestMethod();
+}
class privteTester
{
public int MyProperty { get; set; }