Closed maca88 closed 5 years ago
Tagging @gafter @DustinCampbell for thoughts on this request.
When does RemoveNode add an EOF? Why is RemoveNode ever adding anything?
When does RemoveNode add an EOF?
One example that occurred to me is when KeepUnbalancedDirectives
option is used. In this unit test an EOL is added before #region Fred
.
By changing the NormalizeLineEndings
method to replace all CRLF EOL with LF then the cu
variable prior the RemoveNode
call is:
\nclass C\n{\n// before\n#region Fred\n// more before\nvoid M()\n{\n} // after\n#endregion\n}
and after RemoveNode
call cu2
is:
\nclass C\n{\n\r\n#region Fred\n#endregion\n}
Oh. I misread. I thought it was EOF, not EOL. Yes. EOL should be configurable. SyntaxRemoveOptions would be a good place to put this info.
Version Used: 2.4.0
Currently, the EOL that may be added by RemoveNode or RemoveNodes is CRLF and cannot be changed. By making the EOL configurable, we would be able to preserve the EOL of the original document, as we could do it with NormalizeWhitespace.