The command editor.action.insertLineAfter
creates a new line and moves the cursor there, keeping the indent. To attach this command to the Enter key, go to the keyboard shortcuts (press ctrl + k ctrl + s), then click the button with two curly brackets in the upper right corner.

add the following command
{
"key": "enter",
"command": "editor.action.insertLineAfter",
"when": "editorTextFocus && !editorReadonly"
},
Make sure this is to the end of the Json list.
source
share