From d1eafe2c9b473f7ab03fe7c3bb548b17fe91cfeb Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Sat, 28 Mar 2026 19:30:24 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix(generator):=20=E4=BF=AE=E5=A4=8DContext?= =?UTF-8?q?GetGenerator=E4=B8=AD=E7=9A=84=E6=9C=8D=E5=8A=A1=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E6=8E=A8=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了对引用类型的自动服务绑定推断,避免将非上下文服务字段误判为服务依赖 - 更新了GetAll特性的行为描述,明确Service和Services绑定不会自动推断 - 添加了显式GetService特性的测试用例验证正确的绑定行为 - 从测试代码中移除了未使用的GetService扩展方法声明 - 为BattlePanel测试类添加了IStrategy服务集合字段以完善测试覆盖 --- .../Rule/ContextGetGeneratorTests.cs | 92 ++++++++++++++++++- GFramework.SourceGenerators/README.md | 5 +- .../Rule/ContextGetGenerator.cs | 23 ++--- 3 files changed, 101 insertions(+), 19 deletions(-) diff --git a/GFramework.SourceGenerators.Tests/Rule/ContextGetGeneratorTests.cs b/GFramework.SourceGenerators.Tests/Rule/ContextGetGeneratorTests.cs index daae4e6..a69a6f1 100644 --- a/GFramework.SourceGenerators.Tests/Rule/ContextGetGeneratorTests.cs +++ b/GFramework.SourceGenerators.Tests/Rule/ContextGetGeneratorTests.cs @@ -234,7 +234,6 @@ public class ContextGetGeneratorTests public static IReadOnlyList GetModels(this object contextAware) => default!; public static T GetSystem(this object contextAware) => default!; public static T GetUtility(this object contextAware) => default!; - public static T GetService(this object contextAware) => default!; } } @@ -258,6 +257,7 @@ public class ContextGetGeneratorTests private ICombatSystem _system = null!; private IUiUtility _utility = null!; private IStrategy _service = null!; + private IReadOnlyList _services = null!; private Godot.Node _node = null!; } } @@ -279,6 +279,96 @@ public class ContextGetGeneratorTests _models = this.GetModels(); _system = this.GetSystem(); _utility = this.GetUtility(); + } + } + + """; + + await GeneratorTest.RunAsync( + source, + ("TestApp_BattlePanel.ContextGet.g.cs", expected)); + Assert.Pass(); + } + + [Test] + public async Task Generates_Explicit_Service_Binding_For_GetAll_Class() + { + var source = """ + using System; + using GFramework.SourceGenerators.Abstractions.Rule; + + namespace GFramework.SourceGenerators.Abstractions.Rule + { + [AttributeUsage(AttributeTargets.Class, Inherited = false)] + public sealed class GetAllAttribute : Attribute { } + + [AttributeUsage(AttributeTargets.Field, Inherited = false)] + public sealed class GetServiceAttribute : Attribute { } + } + + namespace GFramework.Core.Abstractions.Rule + { + public interface IContextAware { } + } + + namespace GFramework.Core.Rule + { + public abstract class ContextAwareBase : GFramework.Core.Abstractions.Rule.IContextAware { } + } + + namespace GFramework.Core.Abstractions.Model + { + public interface IModel { } + } + + namespace GFramework.Core.Abstractions.Systems + { + public interface ISystem { } + } + + namespace GFramework.Core.Abstractions.Utility + { + public interface IUtility { } + } + + namespace GFramework.Core.Extensions + { + public static class ContextAwareServiceExtensions + { + public static T GetModel(this object contextAware) => default!; + public static T GetService(this object contextAware) => default!; + } + } + + namespace TestApp + { + public interface IInventoryModel : GFramework.Core.Abstractions.Model.IModel { } + public interface IStrategy { } + + [GetAll] + public partial class BattlePanel : GFramework.Core.Rule.ContextAwareBase + { + private IInventoryModel _model = null!; + + [GetService] + private IStrategy _service = null!; + } + } + """; + + const string expected = """ + // + #nullable enable + + using GFramework.Core.Extensions; + + namespace TestApp; + + partial class BattlePanel + { + private void __InjectContextBindings_Generated() + { + _model = this.GetModel(); _service = this.GetService(); } } diff --git a/GFramework.SourceGenerators/README.md b/GFramework.SourceGenerators/README.md index 59e3d47..94ace29 100644 --- a/GFramework.SourceGenerators/README.md +++ b/GFramework.SourceGenerators/README.md @@ -43,4 +43,7 @@ public partial class InventoryPanel } ``` -`[GetAll]` 作用于类本身,会自动扫描字段并推断对应的 `GetX` 调用;已显式标记字段的优先级更高。 +`[GetAll]` 作用于类本身,会自动扫描字段并推断 `Model`、`System`、`Utility` 相关的 `GetX` 调用;已显式标记字段的优先级更高。 + +`Service` 和 `Services` 绑定不会在 `[GetAll]` 下自动推断。对于普通引用类型字段,请显式使用 `[GetService]` 或 +`[GetServices]`,避免将非上下文服务字段误判为服务依赖。 diff --git a/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs b/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs index 55a9537..6e11580 100644 --- a/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs +++ b/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs @@ -582,12 +582,7 @@ public sealed class ContextGetGenerator : IIncrementalGenerator return true; } - if (elementType.IsReferenceType) - { - binding = new BindingInfo(fieldSymbol, BindingKind.Services, elementType); - return true; - } - + // Service collections stay opt-in for the same reason as single services. return false; } @@ -609,12 +604,7 @@ public sealed class ContextGetGenerator : IIncrementalGenerator return true; } - if (fieldSymbol.Type.IsReferenceType) - { - binding = new BindingInfo(fieldSymbol, BindingKind.Service, fieldSymbol.Type); - return true; - } - + // Service bindings stay opt-in because arbitrary reference types are too ambiguous to infer safely. return false; } @@ -721,12 +711,11 @@ public sealed class ContextGetGenerator : IIncrementalGenerator if (readOnlyList is null || fieldType is not INamedTypeSymbol targetType) return false; - foreach (var candidateType in EnumerateCollectionTypeCandidates(targetType)) - { - if (candidateType.TypeArguments.Length != 1) - continue; + var allTypeCandidates = EnumerateCollectionTypeCandidates(targetType) + .SelectMany(candidateType => candidateType.TypeArguments); - var candidateElementType = candidateType.TypeArguments[0]; + foreach (var candidateElementType in allTypeCandidates) + { var expectedSourceType = readOnlyList.Construct(candidateElementType); if (!expectedSourceType.IsAssignableTo(targetType)) continue; From d72d4ab0bd2236fd944a62d5914fb2c2da58bab8 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Sat, 28 Mar 2026 19:32:23 +0800 Subject: [PATCH 2/5] =?UTF-8?q?refactor(GFramework.SourceGenerators):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96ContextGetGenerator=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E9=9B=86=E5=90=88=E7=B1=BB=E5=9E=8B=E9=81=8D=E5=8E=86=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 重构了EnumerateCollectionTypeCandidates方法的调用方式 - 使用模式匹配简化了类型参数的提取逻辑 - 移除了不必要的SelectMany操作提高代码可读性 - 添加了空值检查增强代码健壮性 - 在方法末尾添加了必要的换行符保持代码格式一致 --- GFramework.SourceGenerators/Rule/ContextGetGenerator.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs b/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs index 6e11580..9248f81 100644 --- a/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs +++ b/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs @@ -711,11 +711,11 @@ public sealed class ContextGetGenerator : IIncrementalGenerator if (readOnlyList is null || fieldType is not INamedTypeSymbol targetType) return false; - var allTypeCandidates = EnumerateCollectionTypeCandidates(targetType) - .SelectMany(candidateType => candidateType.TypeArguments); - - foreach (var candidateElementType in allTypeCandidates) + foreach (var candidateType in EnumerateCollectionTypeCandidates(targetType)) { + if (candidateType is not { TypeArguments: [var candidateElementType] }) + continue; + var expectedSourceType = readOnlyList.Construct(candidateElementType); if (!expectedSourceType.IsAssignableTo(targetType)) continue; @@ -727,6 +727,7 @@ public sealed class ContextGetGenerator : IIncrementalGenerator return false; } + private static IEnumerable EnumerateCollectionTypeCandidates(INamedTypeSymbol typeSymbol) { yield return typeSymbol; From 4fb1da2da608941d226b8959809902b69c9a8603 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Sat, 28 Mar 2026 19:40:02 +0800 Subject: [PATCH 3/5] =?UTF-8?q?refactor(GFramework.SourceGenerators):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=9B=86=E5=90=88=E7=B1=BB=E5=9E=8B=E5=80=99?= =?UTF-8?q?=E9=80=89=E6=9E=9A=E4=B8=BE=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将嵌套循环重构为使用 SelectMany 扁平化集合类型参数 - 简化了候选元素类型的遍历逻辑 - 提高了代码可读性和性能 - 移除了不必要的 continue 语句 - 保持了原有的类型匹配功能不变 --- .../Rule/ContextGetGenerator.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs b/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs index 9248f81..4186e52 100644 --- a/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs +++ b/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs @@ -711,11 +711,11 @@ public sealed class ContextGetGenerator : IIncrementalGenerator if (readOnlyList is null || fieldType is not INamedTypeSymbol targetType) return false; - foreach (var candidateType in EnumerateCollectionTypeCandidates(targetType)) - { - if (candidateType is not { TypeArguments: [var candidateElementType] }) - continue; + var allTypeCandidates = EnumerateCollectionTypeCandidates(targetType) + .SelectMany(candidateType => candidateType.TypeArguments); + foreach (var candidateElementType in allTypeCandidates) + { var expectedSourceType = readOnlyList.Construct(candidateElementType); if (!expectedSourceType.IsAssignableTo(targetType)) continue; @@ -724,10 +724,10 @@ public sealed class ContextGetGenerator : IIncrementalGenerator return true; } + return false; } - private static IEnumerable EnumerateCollectionTypeCandidates(INamedTypeSymbol typeSymbol) { yield return typeSymbol; From 535743e824c23bc61444a73436e28ab75c98ead7 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Sat, 28 Mar 2026 19:45:14 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix(generator):=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E6=BA=90=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E5=99=A8=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E6=8D=A2=E8=A1=8C=E7=AC=A6=E5=85=BC=E5=AE=B9=E6=80=A7?= =?UTF-8?q?=E5=92=8C=E9=9B=86=E5=90=88=E7=B1=BB=E5=9E=8B=E5=80=99=E9=80=89?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在测试中添加换行符标准化功能,确保跨平台测试一致性 - 修复ContextGetGenerator中集合类型候选检测逻辑,跳过无效类型参数 - 添加针对可空服务字段的单元测试用例 - 优化生成器对不同系统换行符的处理机制 --- .../Core/GeneratorTest.cs | 20 +++- .../Core/GeneratorTest.cs | 20 +++- .../Rule/ContextGetGeneratorTests.cs | 96 ++++++++++++++++++- .../Rule/ContextGetGenerator.cs | 16 +--- 4 files changed, 127 insertions(+), 25 deletions(-) diff --git a/GFramework.Godot.SourceGenerators.Tests/Core/GeneratorTest.cs b/GFramework.Godot.SourceGenerators.Tests/Core/GeneratorTest.cs index 8e98e31..cca8546 100644 --- a/GFramework.Godot.SourceGenerators.Tests/Core/GeneratorTest.cs +++ b/GFramework.Godot.SourceGenerators.Tests/Core/GeneratorTest.cs @@ -1,7 +1,4 @@ -using Microsoft.CodeAnalysis.CSharp.Testing; -using Microsoft.CodeAnalysis.Testing; - -namespace GFramework.Godot.SourceGenerators.Tests.Core; +namespace GFramework.Godot.SourceGenerators.Tests.Core; /// /// 提供源代码生成器测试的通用功能。 @@ -30,8 +27,21 @@ public static class GeneratorTest foreach (var (filename, content) in generatedSources) test.TestState.GeneratedSources.Add( - (typeof(TGenerator), filename, content)); + (typeof(TGenerator), filename, NormalizeLineEndings(content))); await test.RunAsync(); } + + /// + /// 将测试内联快照统一为当前平台换行符,避免不同系统上的源生成输出比较出现伪差异。 + /// + /// 原始快照内容。 + /// 使用当前平台换行符的快照内容。 + private static string NormalizeLineEndings(string content) + { + return content + .Replace("\r\n", "\n", StringComparison.Ordinal) + .Replace("\r", "\n", StringComparison.Ordinal) + .Replace("\n", Environment.NewLine, StringComparison.Ordinal); + } } \ No newline at end of file diff --git a/GFramework.SourceGenerators.Tests/Core/GeneratorTest.cs b/GFramework.SourceGenerators.Tests/Core/GeneratorTest.cs index 29138e1..a622d38 100644 --- a/GFramework.SourceGenerators.Tests/Core/GeneratorTest.cs +++ b/GFramework.SourceGenerators.Tests/Core/GeneratorTest.cs @@ -1,7 +1,4 @@ -using Microsoft.CodeAnalysis.CSharp.Testing; -using Microsoft.CodeAnalysis.Testing; - -namespace GFramework.SourceGenerators.Tests.Core; +namespace GFramework.SourceGenerators.Tests.Core; /// /// 提供源代码生成器测试的通用功能 @@ -32,8 +29,21 @@ public static class GeneratorTest // 添加期望的生成源文件到测试状态中 foreach (var (filename, content) in generatedSources) test.TestState.GeneratedSources.Add( - (typeof(TGenerator), filename, content)); + (typeof(TGenerator), filename, NormalizeLineEndings(content))); await test.RunAsync(); } + + /// + /// 将测试快照统一为当前平台换行符,避免不同系统上的源生成输出比较出现伪差异。 + /// + /// 原始快照内容。 + /// 使用当前平台换行符的快照内容。 + private static string NormalizeLineEndings(string content) + { + return content + .Replace("\r\n", "\n", StringComparison.Ordinal) + .Replace("\r", "\n", StringComparison.Ordinal) + .Replace("\n", Environment.NewLine, StringComparison.Ordinal); + } } \ No newline at end of file diff --git a/GFramework.SourceGenerators.Tests/Rule/ContextGetGeneratorTests.cs b/GFramework.SourceGenerators.Tests/Rule/ContextGetGeneratorTests.cs index a69a6f1..0fc78a9 100644 --- a/GFramework.SourceGenerators.Tests/Rule/ContextGetGeneratorTests.cs +++ b/GFramework.SourceGenerators.Tests/Rule/ContextGetGeneratorTests.cs @@ -1,9 +1,5 @@ using GFramework.SourceGenerators.Rule; using GFramework.SourceGenerators.Tests.Core; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Testing; -using Microsoft.CodeAnalysis.Testing; -using NUnit.Framework; namespace GFramework.SourceGenerators.Tests.Rule; @@ -381,6 +377,98 @@ public class ContextGetGeneratorTests Assert.Pass(); } + [Test] + public async Task Skips_Nullable_Service_Like_Field_For_ContextAware_GetAll_Class() + { + var source = """ + using System; + using GFramework.SourceGenerators.Abstractions.Rule; + + namespace GFramework.SourceGenerators.Abstractions.Rule + { + [AttributeUsage(AttributeTargets.Class, Inherited = false)] + public sealed class ContextAwareAttribute : Attribute { } + + [AttributeUsage(AttributeTargets.Class, Inherited = false)] + public sealed class GetAllAttribute : Attribute { } + } + + namespace GFramework.Core.Abstractions.Rule + { + public interface IContextAware { } + } + + namespace GFramework.Core.Abstractions.Model + { + public interface IModel { } + } + + namespace GFramework.Core.Abstractions.Systems + { + public interface ISystem { } + } + + namespace GFramework.Core.Abstractions.Utility + { + public interface IUtility { } + } + + namespace GFramework.Core.Extensions + { + public static class ContextAwareServiceExtensions + { + public static T GetModel(this object contextAware) => default!; + public static T GetSystem(this object contextAware) => default!; + } + } + + namespace Godot + { + public class Control { } + } + + namespace TestApp + { + public interface IGridModel : GFramework.Core.Abstractions.Model.IModel { } + public interface IRunLoopSystem : GFramework.Core.Abstractions.Systems.ISystem { } + public interface IUiPageBehavior { } + + [ContextAware] + [GetAll] + public partial class GameplayHud : Godot.Control + { + private IGridModel _gridModel = null!; + private IUiPageBehavior? _page; + private IRunLoopSystem _runLoopSystem = null!; + } + } + """; + + const string expected = """ + // + #nullable enable + + using GFramework.Core.Extensions; + + namespace TestApp; + + partial class GameplayHud + { + private void __InjectContextBindings_Generated() + { + _gridModel = this.GetModel(); + _runLoopSystem = this.GetSystem(); + } + } + + """; + + await GeneratorTest.RunAsync( + source, + ("TestApp_GameplayHud.ContextGet.g.cs", expected)); + Assert.Pass(); + } + [Test] public async Task Generates_Bindings_For_IContextAware_Class() { diff --git a/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs b/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs index 4186e52..7702aa1 100644 --- a/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs +++ b/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs @@ -1,13 +1,7 @@ -using System.Collections.Immutable; -using System.Text; using GFramework.SourceGenerators.Common.Constants; using GFramework.SourceGenerators.Common.Diagnostics; -using GFramework.SourceGenerators.Common.Extensions; using GFramework.SourceGenerators.Common.Info; using GFramework.SourceGenerators.Diagnostics; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; namespace GFramework.SourceGenerators.Rule; @@ -711,11 +705,12 @@ public sealed class ContextGetGenerator : IIncrementalGenerator if (readOnlyList is null || fieldType is not INamedTypeSymbol targetType) return false; - var allTypeCandidates = EnumerateCollectionTypeCandidates(targetType) - .SelectMany(candidateType => candidateType.TypeArguments); - - foreach (var candidateElementType in allTypeCandidates) + foreach (var candidateType in EnumerateCollectionTypeCandidates(targetType)) { + if (candidateType.TypeArguments.Length != 1) + continue; + + var candidateElementType = candidateType.TypeArguments[0]; var expectedSourceType = readOnlyList.Construct(candidateElementType); if (!expectedSourceType.IsAssignableTo(targetType)) continue; @@ -724,7 +719,6 @@ public sealed class ContextGetGenerator : IIncrementalGenerator return true; } - return false; } From 2f4ba63d327f8e254d8cfc5e5d53c2c2870c22e3 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Sat, 28 Mar 2026 19:49:46 +0800 Subject: [PATCH 5/5] =?UTF-8?q?chore(generators):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=BC=95=E7=94=A8=E5=92=8C=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 GFramework.Godot.SourceGenerators.Tests 中添加 Microsoft.CodeAnalysis 相关引用 - 在 GFramework.SourceGenerators 中添加 ImmutableCollections 和 StringBuilder 引用 - 在 GFramework.SourceGenerators 中添加 Common.Extensions 引用 - 在 GFramework.SourceGenerators.Tests 中添加测试框架相关引用 - 统一全局引用的组织结构 --- GFramework.Godot.SourceGenerators.Tests/GlobalUsings.cs | 6 +++++- GFramework.SourceGenerators.Tests/GlobalUsings.cs | 6 +++++- GFramework.SourceGenerators/GlobalUsings.cs | 4 +++- GFramework.SourceGenerators/Rule/ContextGetGenerator.cs | 3 +++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/GFramework.Godot.SourceGenerators.Tests/GlobalUsings.cs b/GFramework.Godot.SourceGenerators.Tests/GlobalUsings.cs index 4d27181..e8da86b 100644 --- a/GFramework.Godot.SourceGenerators.Tests/GlobalUsings.cs +++ b/GFramework.Godot.SourceGenerators.Tests/GlobalUsings.cs @@ -15,4 +15,8 @@ global using System; global using System.Collections.Generic; global using System.Linq; global using System.Threading; -global using System.Threading.Tasks; \ No newline at end of file +global using System.Threading.Tasks; +global using Microsoft.CodeAnalysis; +global using Microsoft.CodeAnalysis.CSharp.Testing; +global using Microsoft.CodeAnalysis.Testing; +global using NUnit.Framework; \ No newline at end of file diff --git a/GFramework.SourceGenerators.Tests/GlobalUsings.cs b/GFramework.SourceGenerators.Tests/GlobalUsings.cs index 4d27181..e8da86b 100644 --- a/GFramework.SourceGenerators.Tests/GlobalUsings.cs +++ b/GFramework.SourceGenerators.Tests/GlobalUsings.cs @@ -15,4 +15,8 @@ global using System; global using System.Collections.Generic; global using System.Linq; global using System.Threading; -global using System.Threading.Tasks; \ No newline at end of file +global using System.Threading.Tasks; +global using Microsoft.CodeAnalysis; +global using Microsoft.CodeAnalysis.CSharp.Testing; +global using Microsoft.CodeAnalysis.Testing; +global using NUnit.Framework; \ No newline at end of file diff --git a/GFramework.SourceGenerators/GlobalUsings.cs b/GFramework.SourceGenerators/GlobalUsings.cs index 4d27181..32c7b84 100644 --- a/GFramework.SourceGenerators/GlobalUsings.cs +++ b/GFramework.SourceGenerators/GlobalUsings.cs @@ -15,4 +15,6 @@ global using System; global using System.Collections.Generic; global using System.Linq; global using System.Threading; -global using System.Threading.Tasks; \ No newline at end of file +global using System.Threading.Tasks; +global using Microsoft.CodeAnalysis; +global using Microsoft.CodeAnalysis.CSharp.Syntax; \ No newline at end of file diff --git a/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs b/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs index 7702aa1..4180f38 100644 --- a/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs +++ b/GFramework.SourceGenerators/Rule/ContextGetGenerator.cs @@ -1,5 +1,8 @@ +using System.Collections.Immutable; +using System.Text; using GFramework.SourceGenerators.Common.Constants; using GFramework.SourceGenerators.Common.Diagnostics; +using GFramework.SourceGenerators.Common.Extensions; using GFramework.SourceGenerators.Common.Info; using GFramework.SourceGenerators.Diagnostics;