Generated files are in CRLF #2094
Replies: 2 comments 2 replies
-
Proposal: Configurable Line Endings for Generated Source FilesProblemOn Windows, Mapperly outputs generated source files with CRLF (
Proposed SolutionAdd a Implementation1. New File:
|
| File | Change |
|---|---|
src/Riok.Mapperly.Abstractions/LineEnding.cs |
New - Enum definition |
src/Riok.Mapperly.Abstractions/MapperAttribute.cs |
Add LineEnding property |
src/Riok.Mapperly/Configuration/MapperConfiguration.cs |
Read LineEnding from attribute |
src/Riok.Mapperly/Emit/LineEndingHelper.cs |
New - Helper extension method |
src/Riok.Mapperly/Emit/SourceEmitter.cs |
Apply line ending normalization at output |
Usage
// Use LF for cross-platform compatibility
[Mapper(LineEnding = LineEnding.Lf)]
public partial class MyMapper { }
// Keep current behavior (platform default)
[Mapper]
public partial class MyMapper { }Benefits
- Non-breaking: Default
Platformpreserves current behavior - Efficient: Single allocation using
StringBuilder.Replace()in-place - Non-invasive: Only touches output point, no changes to generation logic
- User choice: Projects can opt-in to consistent LF or CRLF as needed
Beta Was this translation helpful? Give feedback.
-
|
What is the process for formally submitting this as a proposal, or potentially opening a PR if it works? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I hope y'all are doing well!
I like to commit the generated files because then I immediately see if there is a change. The issue I am having is that the repo is in
LF, but the generated files are inCRLFwhich results in a white-space change that shows up in git each time I build. Has anyone encountered this issue and what did you do to solve it?Steps to reproduce
LF.Beta Was this translation helpful? Give feedback.
All reactions