admin管理员组

文章数量:1404927

Is there a way to configure VS Code in order to avoid padding, via format line (Shift + Alt + F)?

For instance the first line after the if statement is empty (padded):

if (a) {

    b()
}

The empty line after the if statement should be removed as following:

if (a) {
    b()
}

This should be done automatic by pressing Shift + Alt + F. Can the settings be configured accordingly in VS Code?

Thanks!

Is there a way to configure VS Code in order to avoid padding, via format line (Shift + Alt + F)?

For instance the first line after the if statement is empty (padded):

if (a) {

    b()
}

The empty line after the if statement should be removed as following:

if (a) {
    b()
}

This should be done automatic by pressing Shift + Alt + F. Can the settings be configured accordingly in VS Code?

Thanks!

Share Improve this question edited Mar 6, 2018 at 16:09 HaaLeo 11.8k5 gold badges49 silver badges58 bronze badges asked Mar 6, 2018 at 14:05 VitaliVitali 6072 gold badges7 silver badges13 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 0

Vscode itself does not provide that settings. You could use the the Beautify extension with its preserve_newlines and max_preserve_newlines settings to achieve this behavior. An overview of all possible settings can be found here.
After you configured your settings you can create a custom shortcut in the keybindings.json to overwrite the default Shift + Alt + F

{
    "key": "shift+alt+f",
    "mand": "HookyQR.beautify",
    "when": "editorFocus"
}

本文标签: javascriptBlock must not be padded by blank lines (paddedblocks)Stack Overflow