using GFramework.SourceGenerators.Common.Constants; using Microsoft.CodeAnalysis; namespace GFramework.Godot.SourceGenerators.Diagnostics; /// /// GetNode 生成器相关诊断。 /// public static class GetNodeDiagnostics { /// /// 嵌套类型不受支持。 /// public static readonly DiagnosticDescriptor NestedClassNotSupported = new( "GF_Godot_GetNode_001", "Nested classes are not supported", "Class '{0}' cannot use [GetNode] inside a nested type", PathContests.GodotNamespace, DiagnosticSeverity.Error, true); /// /// static 字段不受支持。 /// public static readonly DiagnosticDescriptor StaticFieldNotSupported = new( "GF_Godot_GetNode_002", "Static fields are not supported", "Field '{0}' cannot be static when using [GetNode]", PathContests.GodotNamespace, DiagnosticSeverity.Error, true); /// /// readonly 字段不受支持。 /// public static readonly DiagnosticDescriptor ReadOnlyFieldNotSupported = new( "GF_Godot_GetNode_003", "Readonly fields are not supported", "Field '{0}' cannot be readonly when using [GetNode]", PathContests.GodotNamespace, DiagnosticSeverity.Error, true); /// /// 字段类型必须继承自 Godot.Node。 /// public static readonly DiagnosticDescriptor FieldTypeMustDeriveFromNode = new( "GF_Godot_GetNode_004", "Field type must derive from Godot.Node", "Field '{0}' must be a Godot.Node type to use [GetNode]", PathContests.GodotNamespace, DiagnosticSeverity.Error, true); /// /// 无法从字段名推导路径。 /// public static readonly DiagnosticDescriptor CannotInferNodePath = new( "GF_Godot_GetNode_005", "Cannot infer node path", "Field '{0}' does not provide a path and its name cannot be converted to a node path", PathContests.GodotNamespace, DiagnosticSeverity.Error, true); /// /// 现有 _Ready 中未调用生成注入逻辑。 /// public static readonly DiagnosticDescriptor ManualReadyHookRequired = new( "GF_Godot_GetNode_006", "Call generated injection from _Ready", "Class '{0}' defines _Ready(); call __InjectGetNodes_Generated() there or remove _Ready() to use the generated hook", PathContests.GodotNamespace, DiagnosticSeverity.Warning, true); }