-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
FIX: CS1574: XML comment has cref attribute 'Enum' that could not be resolved #72
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System; | ||
using Microsoft.CodeAnalysis; | ||
|
||
namespace Supernova.Enum.Generators.Extensions; | ||
|
||
/// <summary> | ||
/// Provides extension methods for <see cref="INamespaceSymbol"/> objects. | ||
/// </summary> | ||
public static class NamespaceSymbolExtensions | ||
{ | ||
/// <summary> | ||
/// Gets the full name of the namespace, including parent namespaces. | ||
/// </summary> | ||
/// <param name="namespaceSymbol">The namespace symbol.</param> | ||
/// <param name="fullName">Optional. The initial full name to start with.</param> | ||
/// <returns>The full name of the namespace.</returns> | ||
public static string FullNamespace(this INamespaceSymbol namespaceSymbol, string fullName = null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this method exist in to SymbolExtensions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original FullNamespace extension in the SymbolExtensions file is replaced by the new extension file. The why I already explained in the other comment. |
||
{ | ||
fullName ??= string.Empty; | ||
|
||
if (namespaceSymbol == null) | ||
{ | ||
return fullName; | ||
} | ||
|
||
if (namespaceSymbol.ContainingNamespace != null) | ||
{ | ||
fullName = namespaceSymbol.ContainingNamespace.FullNamespace(fullName); | ||
} | ||
|
||
if (!fullName.Equals(string.Empty, StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
fullName += "."; | ||
} | ||
|
||
fullName += namespaceSymbol.Name; | ||
|
||
return fullName; | ||
} | ||
} |
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.
It is better to have one extension, not several
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.
Yes, it is better to have a single extension file for a single target, especially if you only have a few methods.
But since this new file targets INamespaceSymbol and not ISymbol like the already existing FullName extension, the new file has a reason to exist.