diff --git a/VSProj~/DirectAttribute.sg/AttributeReceiver.cs b/VSProj~/DirectAttribute.sg/AttributeReceiver.cs index e994a7d..1988c25 100644 --- a/VSProj~/DirectAttribute.sg/AttributeReceiver.cs +++ b/VSProj~/DirectAttribute.sg/AttributeReceiver.cs @@ -14,9 +14,9 @@ internal class AttributeReceiver : ISyntaxReceiver { public class Record { - public TypeDeclarationSyntax TypeDeclaration; + public BaseTypeDeclarationSyntax TypeDeclaration; public bool confirmed = false; - public void Deconstruct(out TypeDeclarationSyntax td,out bool cf) + public void Deconstruct(out BaseTypeDeclarationSyntax td,out bool cf) { td = TypeDeclaration; cf = confirmed; @@ -27,9 +27,9 @@ public void OnVisitSyntaxNode(SyntaxNode syntaxNode) { if(syntaxNode is AttributeListSyntax) { - var t = syntaxNode.FirstAncestorOrSelf(); - //Debugger.Launch(); - if(t != null) + var t = syntaxNode.FirstAncestorOrSelf(); + // Debugger.Launch(); + if (t != null) { Append(t,true); } @@ -39,7 +39,7 @@ public void OnVisitSyntaxNode(SyntaxNode syntaxNode) Append(td,false); } } - void Append(TypeDeclarationSyntax td, bool confirmed) + void Append(BaseTypeDeclarationSyntax td, bool confirmed) { var pre = TypeDeclarations.FirstOrDefault(d => d.TypeDeclaration.IsEquivalentTo(td)); if(pre != null) diff --git a/VSProj~/TestApp/Program.cs b/VSProj~/TestApp/Program.cs index 9cfa2e5..e488bf4 100644 --- a/VSProj~/TestApp/Program.cs +++ b/VSProj~/TestApp/Program.cs @@ -47,6 +47,15 @@ public static void Main() Console.WriteLine($"ga: {attr}"); } } + public enum MyEnum + { + [Inject("Enum One")] + One, + [Inject("Enum 2")] + Two, + [Inject("Enum 3")] + Tytt, + } internal class Foo { //[DirectRetrieve(typeof(Program))] diff --git a/package.json b/package.json index 331ad73..f2204e3 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.bbbirder.directattribute", "description": "Retrieve attributes and subtypes efficiently, meanwhile, retrieve target type and member directly from an attribute", "displayName": "Direct Attribute", - "version": "1.1.5", + "version": "1.1.6", "hideInEditor": false, "author": "bbbirder <502100554@qq.com>" } diff --git a/plugin.unitypackage b/plugin.unitypackage index 234ed5a..3f078a4 100644 Binary files a/plugin.unitypackage and b/plugin.unitypackage differ