My IDE is visual studio 2015 with Resharper 9.2, I want the javascript object array initializer automatically formated like this
var x = [{
a: 1,
b: 2
},{
a: 3,
b: 4
}];
I want the round and square brackets together, Any ideas how can i do this?
It is always formatted like this:
var x = [
{
a: 1,
b: 2
},{
a: 3,
b: 4
}
];
Objects can be initialized using new Object() , Object. create() , or using the literal notation (initializer notation). An object initializer is a comma-delimited list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ( {} ).
Declaring methods and properties using Object Literal syntax The Object literal notation is basically an array of key:value pairs, with a colon separating the keys and values, and a comma after every key:value pair, except for the last, just like a regular array.
JavaScript variables can be objects. Arrays are special kinds of objects. Because of this, you can have variables of different types in the same Array.
You can change the formatting rules of VS as explained here.
The problem should be solved by selecting either block
or smart
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With