VSCode: keeping indents on empty lines

后端 未结 5 1426
日久生厌
日久生厌 2020-12-29 20:41

Is it possible to make VSCode keep indents on empty lines?

Could not find such a setting neither natively nor in \"Beautify\" extension.

Example of desired b

5条回答
  •  無奈伤痛
    2020-12-29 21:03

    The command editor.action.insertLineAfter makes a new line and moves the cursor there preserving the indentation. To bind that command to Enter key, go to your keyboard shortcuts (press ctrl + k ctrl + s) then press the two curly braces button on the far right top.

    add the following command

        {
        "key": "enter",
        "command": "editor.action.insertLineAfter",
        "when": "editorTextFocus && !editorReadonly"
    },
    

    Make sure it's before the end of the Json list.

提交回复
热议问题