views:

238

answers:

2

Visual Studio 2010 inserts a space between the keyword "function" and the following parenthesis. Is it possible to turn this off? i.e.

Visual Studio formats my code like:

var vsfn = function () { };

I would like this formatting:

var myfn = function() {};
A: 

Beautify or minify your code automatically with something like Pretty Diff. That tool is written entirely in JavaScript, so you may not want to integrate it into your automation process, but since it is JavaScript the code is entirely open for backwards engineering.

http://mailmarkup.org/prettydiff/prettydiff.html

That's not going to stop Visual Studio from re-writing the code when you type it in.
Diodeus
If a beautifier or minifier is integrated into his automation processing then it does not matter what VS does, because the beautifier/minifier will correct the code anyways.
Ideally, the JS is minified in the build process, but I don't want to look at those extra spaces.
Lance Fisher
The JS is not minified by VS, or it would look like: var myfn=function(){};
+1  A: 

You should find these settings here:

Tools > Options > Text Editor > JScript > Formatting > Spacing

ignaZ
I've tried disabling all of those settings in spacing, but Visual Studio still puts a space between "function" and "()". I think the only way to solve it at this point, is to disable formatting altogether.
Lance Fisher