Skip to content
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

Allow separation of settings for html, css and js options like sublime. #3

Closed
fabien-h opened this issue Dec 24, 2015 · 4 comments
Closed

Comments

@fabien-h
Copy link

Mac os, visual code up to date, in the .jsbeautifyrc, "space_in_paren": true, has no effect.

@HookyQR
Copy link
Owner

HookyQR commented Dec 24, 2015

@fabien-h could you please share your whole .jsbeautifyrc file, and a sample of code that it isn't workiing on. It seems to work fine for me. Perhaps there is a combination of settings that is affecting the outcome.

@fabien-h
Copy link
Author

When I beautify let f = ( a ) => return a + 1; it becomes :

let f = (a) =>
    return a + 1;

The spaces around the a are removed.

My full.jhsbeautifyrc :

{
    // Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options
    // Documentation: https://github.com/einars/js-beautify/
    "html": {
        "allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg", "hbs"],
        "brace_style": "collapse", // "expand", "end-expand", "expand-strict"
        "indent_char": "\t",
        "indent_handlebars": true, // e.g. {{#foo}}, {{/foo}}
        "indent_inner_html": true,
        "indent_scripts": "keep", // "separate", "normal"
        "indent_size": 4,
        "indent_with_tabs": true,
        "max_preserve_newlines": 10,
        "preserve_newlines": true,
        "unformatted": ["a", "sub", "sup", "b", "i", "u", "pre"],
        "wrap_line_length": 0
    },
    "css": {
        "allowed_file_extensions": ["css", "scss", "sass", "less"],
        "end_with_newline": false,
        "indent_char": "\t",
        "indent_size": 4,
        "selector_separator": " ",
        "selector_separator_newline": true
    },
    "js": {
        "allowed_file_extensions": ["js", "json", "jshintrc", "jsbeautifyrc", "jsx"],
        "brace_style": "collapse", // "expand", "end-expand", "expand-strict", "collapse"
        "break_chained_methods": false,
        "e4x": true,
        "end-with-newline": true,
        "eval_code": false,
        "format_on_save": false,
        "indent_char": " ",
        "indent_level": 0,
        "indent_size": 1,
        "indent_with_tabs": true,
        "jslint_happy": true,
        "keep_array_indentation": false,
        "keep_function_indentation": false,
        "max_preserve_newlines": 3,
        "preserve_newlines": true,
        "space_before_conditional": true,
        "space_in_paren": true,
        "unescape_strings": true,
        "wrap_line_length": 0
    }
}

@HookyQR
Copy link
Owner

HookyQR commented Dec 26, 2015

Your .jsbeautifyrc file is incorrectly formatted. The js-beautify program wouldn't recognise it from the command line either.

That being said, I think that being able to set your options seperately for each of the beautify-able types is a nice addition.

Note that the "allowed_file_estensions" won't be recognised from the file as the config is read at run time instead of when the extension loads. You can duplicate this effect with the beautify.JSfiles,beautify.HTMLfiles and beautify.CSSfiles configuration within VS Code.

@HookyQR HookyQR changed the title "space_in_paren": true does not work Allow separation of settings for html, css and js options like sublime. Dec 26, 2015
@HookyQR
Copy link
Owner

HookyQR commented Dec 26, 2015

Version 0.0.6 released to enable this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants