Joey Joey - 7 months ago 13
Javascript Question

Set the beginning of a curly brace to a new line in Visual Studio 2015?

I am writing/debugging Javascript code in Visual Studio 2015 and hate to have the curly braces of a function starting at the end of an expression (btw: why is it like this as it is way less clearly arranged?) like:

$scope.adjusted = function () {
console.log(adjustedYesNo);
}


Instead I want to have it started by default (and after each change) in the beginning of a line like:

$scope.adjusted = function ()
{
console.log(adjustedYesNo);
}


Where to set such a setting in Visual Studio 2015?

Answer

In the menu go to...

Tools > Options > Text Editor > JavaScript > Formatting > New Lines

Set the options as required in there. You can do this individually for each of the supported languages.