Visual Studio's JavaScript code formatting in for loops
Asked Answered
V

2

9

The default code formatting for JavaScript in Visual Studio 2012 does this with for loops:

for (var a = b; a < c; a++)
{
}
for (var a = b() ; a < c; a++)
{
}
for (var a = b; a < c() ; a++)
{
}
for (var a = (b) ; a < (c) ; a++)
{
}

Notice the spaces after b(), c(), (b), and (c).

Where is the option to remove those spaces, or does VS just have a phobia of frowning winky faces?

);

Visa answered 23/5, 2013 at 14:0 Comment(5)
none of the spacing settings under Tools > Options > Text Editor > JavaScript > Formatting > Spacing lets you disable this. Seems like it is baked in and there is no setting for it (yet).Mongo
On the assumption that this is a bug, I've opened an issue.Visa
I don't think it's a bug. It's more like a missing feature or setting. Someone at their team could have thought this would improve readability and everyone would love itMongo
I've never seen inconsistency improve readability. And I most certainly don't love it.Visa
Still present in VS2015Kaufman
T
1

Use Resharper. It's a brilliant tool for C#, and it also has really good JavaScript support - including a JS Lint plugin which will allow you to enforce JS code conventions / styles.

It's not free, though - but it'll make your code more consistent and higher quality.

Timothytimour answered 9/7, 2013 at 8:52 Comment(0)
D
0

There may not be an option to change this, but if there is, it's likely here (choose the relevant language):

Visual Studio Options

Disembody answered 29/5, 2013 at 19:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.