views:

49

answers:

2

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!

A: 

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.

Lorenzo
Incorrect - javascript settings are under "JScript".
jball
Are you crazy? You downvote me and then you answer exactly the same????? Yes they are under Jscript but none of them will answer the question....
Lorenzo
@Merlyn Morgan-Graham: Does the user who asked the question asked for all the options on the window or he asked for a particular option that IS NOT PRESENT? So I can answer with everything, even if it does'nt have nothing to do with the question....
Lorenzo
Well... I have flagged the jBall Answer asking for moderator attention....
Lorenzo
@Merlyn Morgan-Graham: The point is not the one you are talking about neither is the downvote. The point is that I am getting a downvote on an answer that is correct. My answer is: `You can define rules like the one you want for languages like C# but not for javascript.` and nobody can say that this incorrect. The user that has asked the question did not ask which are the options available but something else...
Lorenzo
Also, just to be more precise, my answer dont say that javascript is not present, that seems the reason for which he downvoted. It in fact says that the rules that Niall Collins want to define in javascript cannot be defined...
Lorenzo
@Lorenzo - two things: 1) Your answer is misleading, 2) I was typing my answer before you posted, and left it when I saw that you did not point out where JS settings actually are. It's obvious that the OP does not know where the setting would be if it existed, and I believe that an answer that helps them find the right place in the settings and informs them that the option they want does not exist is more helpful.
jball
@Lorenzo, jball: Was basically trying to be helpful to Lorenzo. Since my stuff was speculation, and jball has spoken up, I'll delete them now :)
Merlyn Morgan-Graham
Side note, I will remove the down vote if the answer is made more clear.
jball
@jball: And tell me, where my answer is misleading? Did you read it? Apart from the list of present option (that for instance does not have nothing to do with the answer) where your answer is different from mine? You said that my answer is incorrect because javascript options are under JScript. Well where am I saying that they do not exists?
Lorenzo
@Lorenzo - the OP says *Know its a setting somewhere but cant find it* and you respond with *You can define rules like the one you want for languages like C# but not for javascript.* after pointing them to the general "Text Editor" options, but not to the "JScript" specific options, let alone the "Formatting" sub-section. That is the definition of misleading.
jball
@jball: you lack honesty. You are misleading, because you have downvoted a correct answer that came before than yours. And this is my last comment as I dont want to speak anymore to a person like you
Lorenzo
@Lorenzo, I'm not trying to get into a fight with you or steal points from you. While your answer was correct, it was also incomplete and misleading (as I've detailed above). You've got the right to react however you wish, but this is not personal or mean-spirited on my part.
jball
+3  A: 

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
jball
The user who answered this question downvoted the other question and then just copied the text adding a bunch of other text....
Lorenzo
@Lorenzo, you're using a strange definition of the word "copied".
jball
@jball: you can call it strange but is the same one from the dictionary `http://dictionary.reference.com/browse/copy`
Lorenzo
@Lorenzo, sorry, which one? For clarification, you're saying that *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.* is a cut and paste of *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.* ?
jball
@jball: you lack honesty. You are misleading, because you have downvoted a correct answer that came before than yours. And this is my last comment as I dont want to speak anymore to a person like you
Lorenzo