-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Alternative Newline Characters #260
Comments
You have a good starting idea. You need to modify |
FYI, it seems this is may not be an issue on python: jdavisclark/JsFormat#65 |
Ah, and on nodejs we can use |
BTW on Windows Git makes a complaint (as below) about every beautified file warning: LF will be replaced by CRLF in myNowBeautifulFile.js. AFAICT Git expects to see the OS eol marker. Manually resetting CRLF in my editor is fast, but it still makes beautification a bit 'noisy' in my workflow. |
When running in node, use os.eol to choose line endings - windows will use \r\n, linux will use \n. Fixes #260
Nope, that didn't work at all. This is going to be a breaking change of some kind. Pushing to next milestone. |
+1 - unable to incorporate this into our teams workflow due to forcing |
Would it be possible to release a version with this change before |
Sure, I can do that. |
+1 on @gabrielmaldi 's suggestion It would be fantastic if the eol option could come in before 1.6.0, as it is the only bug that currently breaks our code and prevents us from using grunt-jsbeautifier/jsbeautify :-) |
@corgrath +1 |
I've tried this new feature and it works fine 👍 However, I think I found a bug which I reported in #781. |
Secondly, it appears that when jsBeautifier adds new line, it is always with the '\n' character. Is it possible to allow for the windows style '\r\n' newline? I thought I had found where the new line is created, but it seems to break the indentation. Here is what I tried:
// Somewhere around line 170:
opt.eol = options.eol ? options.eol : '\n'; // a new option
// Somewhere around line 370, change to:
if (force_newline || !just_added_newline()) {
output.push(opt.eol); // was output.push("\n");
}
… but I find that if opt.eol is anything other than '\n' all of the tabs get through away.
Thanks,
Mark
The text was updated successfully, but these errors were encountered: