Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Discord.Net.ComponentDesigner.Generator/Diagnostics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 '{0}' is out of range: {1}",
"Components",
DiagnosticSeverity.Error,
true
Expand Down
5 changes: 5 additions & 0 deletions src/Discord.Net.ComponentDesigner.Parser/CXParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public sealed partial class CXParser
/// <summary>
/// Gets whether this parser is operating in an incremental mode.
/// </summary>
/// <remarks>
/// 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.
/// </remarks>
[MemberNotNullWhen(true, nameof(Blender), nameof(_blendedNodes))]
public bool IsIncremental => Blender is not null && _blendedNodes is not null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;

Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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);

Expand Down
8 changes: 7 additions & 1 deletion src/Discord.Net.ComponentDesigner.Parser/Nodes/CXNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ public abstract class CXNode : ICXNode
/// <inheritdoc/>
public CXNode? Parent { get; set; }

/// <inheritdoc/>
/// <summary>
/// Gets the number of child slots directly contained within this node.
/// </summary>
/// <remarks>
/// Width counts only direct children (elements in the _slots collection).
/// Use <see cref="GraphWidth"/> to count the entire descendant tree.
/// </remarks>
public int Width { get; private set; }

/// <inheritdoc/>
Expand Down