handle overriden method docs and more modifiers
This commit is contained in:
@@ -23,6 +23,9 @@ public static class SymbolInfoComponents
|
|||||||
label.Pop();
|
label.Pop();
|
||||||
label.AddText(" ");
|
label.AddText(" ");
|
||||||
label.AddStaticModifier(methodSymbol);
|
label.AddStaticModifier(methodSymbol);
|
||||||
|
label.AddVirtualModifier(methodSymbol);
|
||||||
|
label.AddAbstractModifier(methodSymbol);
|
||||||
|
label.AddOverrideModifier(methodSymbol);
|
||||||
label.AddMethodReturnType(methodSymbol);
|
label.AddMethodReturnType(methodSymbol);
|
||||||
label.AddText(" ");
|
label.AddText(" ");
|
||||||
label.AddMethodName(methodSymbol);
|
label.AddMethodName(methodSymbol);
|
||||||
@@ -63,6 +66,39 @@ public static class SymbolInfoComponents
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void AddOverrideModifier(this RichTextLabel label, IMethodSymbol methodSymbol)
|
||||||
|
{
|
||||||
|
if (methodSymbol.IsOverride)
|
||||||
|
{
|
||||||
|
label.PushColor(CachedColors.KeywordBlue);
|
||||||
|
label.AddText("override");
|
||||||
|
label.Pop();
|
||||||
|
label.AddText(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddAbstractModifier(this RichTextLabel label, IMethodSymbol methodSymbol)
|
||||||
|
{
|
||||||
|
if (methodSymbol.IsAbstract)
|
||||||
|
{
|
||||||
|
label.PushColor(CachedColors.KeywordBlue);
|
||||||
|
label.AddText("abstract");
|
||||||
|
label.Pop();
|
||||||
|
label.AddText(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddVirtualModifier(this RichTextLabel label, IMethodSymbol methodSymbol)
|
||||||
|
{
|
||||||
|
if (methodSymbol.IsVirtual)
|
||||||
|
{
|
||||||
|
label.PushColor(CachedColors.KeywordBlue);
|
||||||
|
label.AddText("virtual");
|
||||||
|
label.Pop();
|
||||||
|
label.AddText(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void AddMethodReturnType(this RichTextLabel label, IMethodSymbol methodSymbol)
|
private static void AddMethodReturnType(this RichTextLabel label, IMethodSymbol methodSymbol)
|
||||||
{
|
{
|
||||||
if (methodSymbol.ReturnsVoid)
|
if (methodSymbol.ReturnsVoid)
|
||||||
@@ -355,6 +391,7 @@ public static class SymbolInfoComponents
|
|||||||
private static readonly Color HrColour = new Color("4d4d4d");
|
private static readonly Color HrColour = new Color("4d4d4d");
|
||||||
private static void AddDocs(this RichTextLabel label, IMethodSymbol methodSymbol)
|
private static void AddDocs(this RichTextLabel label, IMethodSymbol methodSymbol)
|
||||||
{
|
{
|
||||||
|
if (methodSymbol.IsOverride) methodSymbol = methodSymbol.OverriddenMethod!;
|
||||||
var xmlDocs = methodSymbol.GetDocumentationCommentXml();
|
var xmlDocs = methodSymbol.GetDocumentationCommentXml();
|
||||||
if (string.IsNullOrWhiteSpace(xmlDocs)) return;
|
if (string.IsNullOrWhiteSpace(xmlDocs)) return;
|
||||||
label.AddHr(100, 1, HrColour);
|
label.AddHr(100, 1, HrColour);
|
||||||
|
|||||||
Reference in New Issue
Block a user