mike7515 / code-beautifier

MIT License
19 stars 5 forks source link

options selector-separator-newline and newline-between-rules not working in sass file #7

Closed RickyMarou closed 7 years ago

RickyMarou commented 7 years ago

here is what i have in my settings :

"beautify.options": {
    "indent_size": 2,
    "indent_char": " ",
    "indent_with_tabs": false,
    "eol": "\n",
    "selector-separator-newline": false,
    "newline-between-rules": true
  }

No new lines are being added inside my nested rules, for an exemple after running the beautifier i get this :

.test,
.test2 {
  display: block;
  .test3 {
    display: block;
  }
}

instead of :

.test, .test2 {
  display: block;
  .test3 {
    display: block;
  }

  .test4 { 
    display: block;
  }
}

After briefly looking at the source this might be a possible source of the problem.

const options = vscode.workspace.getConfiguration('beautify').get<number>("options");

should probably be

const options = vscode.workspace.getConfiguration('beautify').get<object>("options");

but considering that the indent_size works correctly I have that this is the problem.

Cheers and thanks for this extension anyways :)

RickyMarou commented 7 years ago

Sorry, after more research it appears that this is an issue with jsbeautify itself and that they are close to fixing it : https://github.com/beautify-web/js-beautify/issues/657

TwitchBronBron commented 6 years ago

It looks like beautify-web/js-beautify#657 was finally fixed back in August 2018, and arrived in js-beautify versoin 1.8.0.

@mike7515 could you upgrade this extension to use the latest version of js-beautify so we can get this feature?