Lazar Krstic Lazar Krstic - 1 year ago 174
Javascript Question

How to change code formatting in Visual Studio Code

Hi I'm using VS Code for TypeScript and JavaScript.
Standart autoformat create code like this

if(ind){
// code
}


but I don't like this :), how to set autoformat as

if(ind)
{
// code
}

Answer Source

for TypeScript in settings.json

// Place your settings in this file to overwrite default and user settings.
{
    "typescript.format.placeOpenBraceOnNewLineForControlBlocks": true,
    "typescript.format.placeOpenBraceOnNewLineForFunctions": true
}

and autoformat!