From d6cde68a449fee1d22c2cf9b992378c18139889c Mon Sep 17 00:00:00 2001 From: Sinai Date: Fri, 30 Apr 2021 23:43:36 +1000 Subject: [PATCH] Fix namespaces being included for generic parameters --- src/UI/Utility/SignatureHighlighter.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/UI/Utility/SignatureHighlighter.cs b/src/UI/Utility/SignatureHighlighter.cs index ffbe7c5..83e3765 100644 --- a/src/UI/Utility/SignatureHighlighter.cs +++ b/src/UI/Utility/SignatureHighlighter.cs @@ -65,7 +65,9 @@ namespace UnityExplorer.UI.Utility // Namespace - if (includeNamespace && !string.IsNullOrEmpty(type.Namespace)) + bool isGeneric = type.IsGenericParameter || (type.HasElementType && type.GetElementType().IsGenericParameter); + + if (!isGeneric && includeNamespace && !string.IsNullOrEmpty(type.Namespace)) syntaxBuilder.Append($"{type.Namespace}."); // Declaring type @@ -112,8 +114,10 @@ namespace UnityExplorer.UI.Utility public static string ParseFullType(Type type, bool includeNamespace = false, bool includeDllName = false) { string ret = HighlightType(type); - - if (includeNamespace && !string.IsNullOrEmpty(type.Namespace)) + + bool isGeneric = type.IsGenericParameter || (type.HasElementType && type.GetElementType().IsGenericParameter); + + if (!isGeneric && includeNamespace && !string.IsNullOrEmpty(type.Namespace)) ret = $"{type.Namespace}.{ret}"; if (includeDllName)