You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering why the plugin ignores my configuration concerning the option "eol".
If I use "\r\n" as eol, everything works fine except by empty lines at the end of a file.
I took a look at the code. In line 98 - 101 of the file "lib/jsbeautifier.js" you're replacing the empty line at the end of a file. As you can see in line 100, you are using "\n" as the line terminator, without considering if there is any option about which line terminator should be used. The result is that everywhere in my code is "\r\n" used as the line terminator except the empty line at the end of the file.
I would recommend to check if the option "eol" is set instead of using always the same line terminator.
By the way: What is the purpose of this lines? If you set the option "endWithNewline" to true, the beautifier will insert an empty line with the correct line terminator at the end of the file. So in my mind you can cut these lines out because there is no really use...
I also figured out that the option "eol" get's overriden. If you trying to use "\n" as the line terminator, the plugin always use "\r\n". If you insert some bullshit like "\n" it works correctly.
The text was updated successfully, but these errors were encountered:
Appending "\n" was added when jsbeautify didn't supported eol for file of kind js. So had to implement it in this plugin. And it can enable or disable by '''--end-with-newline''' parameter. Caveat I see here is only not using '''eol''' instead of "\n" which was again because eol was added by jsbeautify way later this feature was developed.
I would love the PR for this if you get this working with backward compatibility, remember plugin does support using diff version of "jsbeautify" as per user requirement
I was wondering why the plugin ignores my configuration concerning the option "eol".
If I use "\r\n" as eol, everything works fine except by empty lines at the end of a file.
I took a look at the code. In line 98 - 101 of the file "lib/jsbeautifier.js" you're replacing the empty line at the end of a file. As you can see in line 100, you are using "\n" as the line terminator, without considering if there is any option about which line terminator should be used. The result is that everywhere in my code is "\r\n" used as the line terminator except the empty line at the end of the file.
I would recommend to check if the option "eol" is set instead of using always the same line terminator.
By the way: What is the purpose of this lines? If you set the option "endWithNewline" to true, the beautifier will insert an empty line with the correct line terminator at the end of the file. So in my mind you can cut these lines out because there is no really use...
I also figured out that the option "eol" get's overriden. If you trying to use "\n" as the line terminator, the plugin always use "\r\n". If you insert some bullshit like "\n" it works correctly.
The text was updated successfully, but these errors were encountered: