Brace on new line js vscode

A common request!

To format your JavaScript code with a new line after each brace (i.e., { and }) in VSCode, you can use the following settings:

  1. Open the Command Palette in VSCode by pressing Ctrl + Shift + P (Windows/Linux) or Cmd + Shift + P (macOS).
  2. Type "Format On Type" and select "Format On Type: Enable" from the dropdown list.
  3. In the "Format On Type" settings, add the following configuration:
    {
    "editor.formatOnType": {
     "enabled": true,
     "options": {
       "insertSpaceAfterOpenBrace": true
     }
    }
    }

    This will insert a new line after each brace when you type it.

Alternatively, you can also use the "Format Document" command to format your entire document with the desired settings. To do this:

  1. Open the Command Palette in VSCode by pressing Ctrl + Shift + P (Windows/Linux) or Cmd + Shift + P (macOS).
  2. Type "Format Document" and select "Format Document" from the dropdown list.
  3. In the "Format Document" settings, select the "JavaScript" language and choose the "Insert space after open brace" option.

Either of these methods should achieve the desired formatting for your JavaScript code in VSCode.