-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--lineseparator
option to use whatever separator the file is already using
#209
Comments
Currently we have three (fixed) options: native, windows and linux. To implement your idea we would need to implement some sort of checker for separator type before running transformations (and we could call What if line separator are not consistent? Easiest would be just use the first line separator. We could also try to count and pick most popular one (with small hit to performance but nothing noticeable). |
i'm not sure what the best way is, maybe see how other formatters handle this issue? for example prettier: https://prettier.io/docs/en/options.html#end-of-line
|
"The other are doing this" is deciding factor ;) We can go with 'auto' and just check for first line ending. Basically if linesep is set to auto and we're saving the model to disk here: robotframework-tidy/robotidy/app.py Line 98 in d9a7cd6
then we could check the source for line endinds and use it instead. Here usage of 'newlines' attribute: https://stackoverflow.com/questions/2798627/how-can-i-detect-dos-line-breaks-in-a-file |
I can do it - or leave if for you if you want to create PR. |
thanks! sorry i didn't see your comment |
in my team, some people use git
core.autocrlf=true
and others useinput
, which meansrobotidy
will change the line endings unnecessarily. it would be nice if there was an option to make it use whatever line endings the file already hasThe text was updated successfully, but these errors were encountered: