问题
How can I set up the designed in visual studio to put a space after my javascript functions?
At present when I press the return key I get this
var myfunc = function() { .... };
When I want this
var myfunc = function () { .... };
Know its a setting somewhere but cant find it - will help with my JSlinting!
回答1:
In VS 2010 you can't.
The options you have are found at "Options-> Text Editor -> JScript -> Formatting", but that is not one of the options available.
Here's the options you have:
- Automatic Formatting
- Format completed line on Enter
- Format completed statement on ;
- Format completed block on }
- Format on paste
- New lines
- Place open brace on new line for functions
- Place open brace on new line for control blocks
- Spacing - section that would have what you're after
- Insert space after comma delimiter
- Insert space after semicolon in 'for' statement
- Insert space before and after binary operators
- Insert space after keywords in control flow statements
回答2:
You can't do it with VS. I am using VS 2010 and it permit you to write formatting rules going on Tools -> Options and then select Text Editor in the list on the left.
You can define rules like the one you want for languages like C# but not for javascript.
来源:https://stackoverflow.com/questions/4011285/space-after-function-in-visual-studio-ide