diff --git a/src/ZeroC.CodeBuilder/CodeBlock.cs b/src/ZeroC.CodeBuilder/CodeBlock.cs index ada9ae4561..2b7ca2f5e5 100644 --- a/src/ZeroC.CodeBuilder/CodeBlock.cs +++ b/src/ZeroC.CodeBuilder/CodeBlock.cs @@ -46,6 +46,9 @@ public CodeBlock() /// Adds another code block to this one, separated by newlines. /// The block to add. + /// Adding an empty has no effect — no phantom blank-line gap is + /// inserted. The vertical whitespace between non-empty blocks is normalized by , + /// which collapses runs of blank lines to at most one. public void AddBlock(CodeBlock block) => Write($"\n{block}\n"); /// Creates a new code block with the content indented by 4 spaces. @@ -103,5 +106,11 @@ public void Write(string value) /// Writes the specified value followed by a newline to the code block. /// The value to write. + /// drops empty and whitespace-only strings, so WriteLine("") + /// and WriteLine(" ") are no-ops. This is intentional: it lets callers interpolate values + /// that may be empty without producing stray blank lines (for example + /// WriteLine($" {body.Indent()}") when body is empty). Vertical whitespace in the + /// final output is managed by , which collapses runs of blank lines to at + /// most one. public void WriteLine(string value) => Write($"{value}\n"); }