HookyQR / VSCodeBeautify

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

Wrong indentation in switch case #326

Open kien5436 opened 5 years ago

kien5436 commented 5 years ago

vscode:

"beautify.language": {
        "js": {
            "type": [
                "javascript",
                "json",
            ],
            "filename": [
                ".jshintrc",
                ".jsbeautifyrc"
            ]
        },
        "css": [
            "css",
            "scss"
        ],
        "html": [
            "htm",
            "html",
            "php"
        ],
        "php": [
            "php"
        ]
    },
"beautify.config": {
    "brace_style": "end-expand,preserve-inline"
},
"editor.formatOnSave": true,

.jsbeautifyrc

{
    "e4x": true,
    "brace_style": "end-expand,preserve-inline"
}

Action performed

Format javascript file with HookyQR.beautifyFile command

switch (key) {
    case ONE:
        return {
            firstProp: 'value',
            secondProp: 'value',
            thirdProp: 'value'
        };
    default:
        break;
}

Expected results

No change

switch (key) {
    case ONE:
        return {
            firstProp: 'value',
            secondProp: 'value',
            thirdProp: 'value'
        };
    default:
        break;
}

Actual results

Extra indentations, only in switch case statement, that's weird

switch (key) {
    case ONE:
        return {
            firstProp: 'value',
                secondProp: 'value',
                thirdProp: 'value'
        };
    default:
        break;
}