Skip to content Skip to sidebar Skip to footer

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) {

Solution 1:

This is currently not possible with VsCode, but there is an issue tracking the problem and here's the actual code fix.

Keep in mind that this is from the development branch, so the behavior and settings may change, but I believe the settings you will want are:

javascript.format.placeOpenBraceOnNewLineForControlBlocks and/or javascript.format.placeOpenBraceOnNewLineForFunctions

This feature should make it into an official release shortly, but if you want the try out bleeding edge features you can always build VsCode from the source.

Solution 2:

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!

Post a Comment for "How To Change Code Formatting In Visual Studio Code"