Skip to content

Split a copyright at NEL, LINE SEPARATOR and PARAGRAPH SEPARATOR too [patch] - #56

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/39-unicode-copyright-line-breaks
Oct 30, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/39-unicode-copyright-line-breaks

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #39

What changed

GeneratorBase.WriteFileHeader adds a // comment marker to each line of the copyright text. It split the text into lines only at CR, LF and CRLF. The C# lexer also ends a line at U+0085 (NEL), U+2028 (LINE SEPARATOR) and U+2029 (PARAGRAPH SEPARATOR). Any text after one of those characters fell outside the comment, so the generated file did not compile (CS1003/CS1002).

CopyrightLineBreaks now contains all six terminators. CRLF stays first, so it still counts as one line break, not two. The doc comments now list the six terminators.

Tests

AMultiLineCopyrightIsCommentedOnEveryLine gains a DataRow for each of U+0085, U+2028 and U+2029. The test checks the exact header text, and that the output parses with no diagnostics.

With the GeneratorBase.cs change reverted, the three new rows fail. With it, the full suite passes (net10.0, Linux).

ktsu-dev/CodeBlocker#152 fixes the same class of bug in CodeBlocker's WriteAutoGeneratedHeader.


Generated by Claude Code

…[patch]

WriteFileHeader split the copyright only at CR, LF and CRLF. The C# lexer
also ends a line at U+0085, U+2028 and U+2029, so text after one of them
left the // comment and the generated file failed to compile. The header
is now split at all six terminators.

Fixes #39

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW67iMrjvYtnNY3p2qt
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A copyright containing U+2028, U+2029 or U+0085 makes WriteFileHeader emit code that fails to compile (CS1003/CS1002)

2 participants