HookyQR / VSCodeBeautify

Enable js-beautify (https://github.com/beautify-web/js-beautify) in VS Code
MIT License
607 stars 178 forks source link

Cannot drop space before "{" #376

Open MintYale opened 3 years ago

MintYale commented 3 years ago

My configuration in settings.json about Beautify is like this:

"editor.defaultFormatter": "HookyQR.beautify",
    "editor.formatOnSave": false,
    "editor.formatOnType": false,
    "beautify.config": {
        "brace_style": "collapse,preserve-inline",
        "space_after_anon_function": false,
        "space_after_named_function": false,
        "space_before_conditional": false,
        // "space_in_empty_paren": false,
        // "space_in_paren": false,
},

After making this config, when I format JS code like this:

for (let index = 0; index < array.length; index++) {
    const element = array[index];

}
if (condition) {

}

function name (params) {

}

IT turns out like this:

for(let index = 0; index < array.length; index++) {
    const element = array[index];

}
if(condition) {

}

function name(params) {

}

However, what I expect is like this:

for(let index = 0; index < array.length; index++){
    const element = array[index];

}
if(condition){

}

function name(params){

}

In other words, I DONOT WANT the space before "{" ...I wonder if I can make it by using Beautify? Or is there some other configuration overwrite the configuration of Beautify? Or can I make it by using some specific vs-code settings?(I tried searching on google about this but didn't find a way(Most of the others want add this space before "{"...So why not make it configurable?)).

0Jumpero commented 2 years ago

I want the same thing, why is it not in settings, is it that niche to not add extra space there?