Skip to content

Option "eol" not working #60

@Matumba2

Description

@Matumba2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions