diff --git a/SourceGeneratorToolkit.Test/GeneratorBaseTests.cs b/SourceGeneratorToolkit.Test/GeneratorBaseTests.cs index 38ba293..31897a5 100644 --- a/SourceGeneratorToolkit.Test/GeneratorBaseTests.cs +++ b/SourceGeneratorToolkit.Test/GeneratorBaseTests.cs @@ -289,6 +289,9 @@ public void TheHeaderCarriesTheCopyrightAndTheGeneratedMarker() [DataRow("\n")] [DataRow("\r\n")] [DataRow("\r")] + [DataRow("\u0085")] + [DataRow("\u2028")] + [DataRow("\u2029")] public void AMultiLineCopyrightIsCommentedOnEveryLine(string lineBreak) { string source = HeaderProbe.Write($"Copyright (c) Example.{lineBreak}{lineBreak}All rights reserved."); diff --git a/SourceGeneratorToolkit/GeneratorBase.cs b/SourceGeneratorToolkit/GeneratorBase.cs index 0ba1891..4ef50fe 100644 --- a/SourceGeneratorToolkit/GeneratorBase.cs +++ b/SourceGeneratorToolkit/GeneratorBase.cs @@ -110,9 +110,10 @@ protected static CodeBlocker CreateCodeBlocker() => CodeBlocker.Create(CodeBlocker.DefaultIndentString, NewLines.Lf); /// - /// The line breaks a copyright is split on, longest first so CRLF is one break rather than two. + /// Every line terminator the C# compiler recognises, which a copyright is split on so no text escapes its + /// comment. Longest first, so CRLF is one break rather than two. /// - private static readonly string[] CopyrightLineBreaks = ["\r\n", "\n", "\r"]; + private static readonly string[] CopyrightLineBreaks = ["\r\n", "\n", "\r", "\u0085", "\u2028", "\u2029"]; /// /// Writes the header every generated file starts with. @@ -121,7 +122,8 @@ protected static CodeBlocker CreateCodeBlocker() => /// /// The copyright written above the generated-file marker, without its // prefix. /// or empty writes only the marker. A multi-line copyright is commented - /// line by line, whichever line break it uses, so a consumer's multi-line file header template + /// line by line at every line terminator the C# compiler recognises (CR, LF, CRLF, NEL, + /// LINE SEPARATOR and PARAGRAPH SEPARATOR), so a consumer's multi-line file header template /// still compiles. /// ///