skip to Main Content

I’m looking for extensions or JSON settings to format my code given below:

if(true)
{
}
else
{
}

and not like below:

if(true){
} else {
}

2

Answers


  1. Chosen as BEST ANSWER

    I found my answer modified the json setting:

    "typescript.format.placeOpenBraceOnNewLineForControlBlocks": true,
    "typescript.format.enable": true,
    "javascript.format.placeOpenBraceOnNewLineForControlBlocks": true, 
    "javascript.format.placeOpenBraceOnNewLineForFunctions": true,
    
    "typescript.format.placeOpenBraceOnNewLineForControlBlocks": true,
    "typescript.format.placeOpenBraceOnNewLineForFunctions": true,
    

  2. You can add these lines in your settings.json.

    {
      "[javascript][typescript]": {
        "editor.defaultFormatter": "vscode.typescript-language-features"
      },
      "javascript.format.placeOpenBraceOnNewLineForControlBlocks": true,
      "javascript.format.placeOpenBraceOnNewLineForFunctions": true,
      "typescript.format.placeOpenBraceOnNewLineForControlBlocks": true,
      "typescript.format.placeOpenBraceOnNewLineForFunctions": true,
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search