HookyQR / VSCodeBeautify

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

CSS formatting, can I disable extra new line before last comment? #278

Closed Gennady-G closed 5 years ago

Gennady-G commented 5 years ago

NOTE: Please provide code snippets instead of screen shots. Your issue needs to be replicated, and we need the failing code (text) to do this.

Provide the settings you use: (VS Code workspace and user settings, .jsbeautifyrc, .editorconfig) eg.: Workspace Settings:

    "git.ignoreMissingGitWarning": true,
    "window.zoomLevel": -1,
    "workbench.sideBar.location": "right",
    "files.autoSave": "off",
    "editor.cursorStyle": "underline",
    "liveServer.settings.donotShowInfoMsg": true,
    "liveServer.settings.donotVerifyTags": true,
    "html.format.contentUnformatted": "pre,code,textarea,li",  
    "emmet.preferences": { "format.forceIndentationForTags": [ "div" ] },
    "liveServer.settings.port": 5558
}

Action performed

Format javascript file with HookyQR.beautifyFile command

@media screen and (min-width: 992px) and (max-width: 1200px) {
  // .. 
}
/* Media 992-1200px ended */   /*  <--- here is comment, right after code */

Expected results

Expected ... to ...

@media screen and (min-width: 992px) and (max-width: 1200px) {
  // .. 
}
/* Media 992-1200px ended */   /*  <--- I want comment here, all to be the same */

Actual results

Details of what happened ...
@media screen and (min-width: 992px) and (max-width: 1200px) {
  // ..
}
/* <---------------       but it adds new line here   */
/* Media 992-1200px ended */  /*  Can I  disable this extra new line?..   */
HookyQR commented 5 years ago

Add "newline_between_rules": false to your .jsbeautifyrc file, or beautify.config VSCode settings.

Gennady-G commented 5 years ago

Thank You for response @HookyQR !

I want this global. Where is this setting, "html.format.newline_between_rules" or what?..

2019-02-01_101227

HookyQR commented 5 years ago

Nope, it's a js-beautify setting, so to put it in your VS Code settings use:

"beautify.config": { "newline_between_rules": false }
Gennady-G commented 5 years ago

Wow, perfect! Thank You much, @HookyQR! :-)