Js-beautify: beautify.js doesn't have indent_level option

Created on 24 Jun 2015  ·  3Comments  ·  Source: beautify-web/js-beautify

In the options documentation I found the setting indent_level as _Initial indentation level_ for both CLI and underscored option.

However when using it in the js version, the setting seems to be ignored.
When checking the code, it seems like it should be included somewhere here, but it isn't.

bug

Most helpful comment

I've just submitted a PR addressing this issue. One aspect (the ability to set the indent level at zero in the CSS and JavaScript); however, is not functional. I'll be filing an issue for this specific issue.

All 3 comments

Another good report, thanks!
Until this is fixed, you can do workaround this by adding the text of the indent you want to the beginning of the file(s).

For example, before:

    // Top of file
    if (test) 
a();
b();

After:

    // Top of file
    if (test)
        a();
    b();

FWIW, this is also applicable to the python CLI. It also accepts the -l / --indent-level option, but ignores it completely.

I've just submitted a PR addressing this issue. One aspect (the ability to set the indent level at zero in the CSS and JavaScript); however, is not functional. I'll be filing an issue for this specific issue.

Was this page helpful?
0 / 5 - 0 ratings