diff --git a/src/Discord.Net.ComponentDesigner.Generator/Diagnostics.cs b/src/Discord.Net.ComponentDesigner.Generator/Diagnostics.cs index 9110860..f269aee 100644 --- a/src/Discord.Net.ComponentDesigner.Generator/Diagnostics.cs +++ b/src/Discord.Net.ComponentDesigner.Generator/Diagnostics.cs @@ -35,10 +35,10 @@ public static DiagnosticDescriptor CreateParsingDiagnostic(CXDiagnostic diagnost true ); - public static DiagnosticDescriptor OutOfRange(string a, string b) => new( + public static DiagnosticDescriptor OutOfRange(string property, string constraint) => new( "DC0003", - "Type mismatch", - "'{0}' must be {1}", + "Value out of range", + $"'{property}' must be {constraint}", "Components", DiagnosticSeverity.Error, true diff --git a/src/Discord.Net.ComponentDesigner.Parser/CXParser.cs b/src/Discord.Net.ComponentDesigner.Parser/CXParser.cs index 3d28e39..043fc81 100644 --- a/src/Discord.Net.ComponentDesigner.Parser/CXParser.cs +++ b/src/Discord.Net.ComponentDesigner.Parser/CXParser.cs @@ -27,6 +27,11 @@ public sealed partial class CXParser /// /// Gets whether this parser is operating in an incremental mode. /// + /// + /// In incremental mode, the parser reuses unchanged AST nodes from a previous parse, + /// dramatically improving performance for editor scenarios where only small regions change. + /// When false, a complete reparse is performed from scratch. + /// [MemberNotNullWhen(true, nameof(Blender), nameof(_blendedNodes))] public bool IsIncremental => Blender is not null && _blendedNodes is not null; diff --git a/src/Discord.Net.ComponentDesigner.Parser/DebugUtils/ASTFormatter.Structural.cs b/src/Discord.Net.ComponentDesigner.Parser/DebugUtils/ASTFormatter.Structural.cs index 69f3e31..881a5c3 100644 --- a/src/Discord.Net.ComponentDesigner.Parser/DebugUtils/ASTFormatter.Structural.cs +++ b/src/Discord.Net.ComponentDesigner.Parser/DebugUtils/ASTFormatter.Structural.cs @@ -53,7 +53,7 @@ void Write(ICXNode node, int depth = 0, int padding = 2) .Append(": ".Grey()); } - var spacer = "".PadLeft((depth + 1) * padding); + var spacer = string.Empty.PadLeft((depth + 1) * padding); sb.AppendLine("[").Append(spacer); @@ -162,7 +162,7 @@ or nameof(CXValue.Multipart.HasInterpolations) var startPos = sb.Length; - sb.Append("".PadLeft((depth + 1) * padding)).Append($"{name}: "); + sb.Append(string.Empty.PadLeft((depth + 1) * padding)).Append($"{name}: "); var preValuePos = sb.Length; @@ -174,7 +174,7 @@ or nameof(CXValue.Multipart.HasInterpolations) sb.AppendLine(","); } - sb.Append("".PadLeft(depth * padding)).Append("}"); + sb.Append(string.Empty.PadLeft(depth * padding)).Append("}"); break; } } @@ -236,7 +236,7 @@ void WriteValue(object? value, int depth, int padding) .Append(": ".Grey()); } - var spacer = "".PadLeft((depth + 1) * padding); + var spacer = string.Empty.PadLeft((depth + 1) * padding); sb.AppendLine("[").Append(spacer);