js-beautify(在 VSCode 下使用)通过在注释后添加额外的行让我很恼火:
我的示例.scss
/* a fancy comment */
.foo-bars {
background: $gray;
display: block;
width: 26px !important;
}
……变成……
/* a fancy comment */
<-- annoying empty line inserted
.foo-bars {
background: $gray;
display: block;
<--- (this is fine. I like it being preserved)
width: 26px !important;
}
这是我的.jsbeautifyrc
(验证有效,即通过测试"indent_char": "#"
)
{
"indent_char": " ",
"preserve_newlines": true,
"max_preserve_newlines": 8,
"keep-array-indentation": true,
"break_chained_methods": false,
"newline_between_rules": false,
"selector_separator_newline": false,
"end_with_newline": false
}
更新:/* block comments */
仅影响,不影响// line comments
。