- Home /
monodevelop formatting policy to allow single-line 'if' statemetns?
So my coding standard is like so:
// 1. OK:
if (condition){
doSomething();
}
...
// 2. OK
if (condition) doSomething();
...
//3. NOT OK:
if (condition)
doSomething();
...
however, monodevelop's Format Document takes the #2 single-line statements and converts them to #3 NOT OK. Anyone know of a policy setting that will leave them on the same line? I can't seem to find anything. I did find a setting to always insert braces and convert #2 to #1.
I want this too: #2 is O$$anonymous$$, #3 is NOT O$$anonymous$$. And always doing #1 is not really O$$anonymous$$ either. Did you find a solution?
my solution was to switch to Visual Studio, which I use for my day job, and in vs2015 the unity tools are a lot better than previously, so I don't $$anonymous$$d. doesn't help you much tho if you're not using windows... perhaps the new monodevelop 5.9 has better formatting options?
What's the problem with 3? I do it all the time, works fine.
Sure it works. The 'problem' is he doesn't want $$anonymous$$onoDevelop to auto-insert a line break after the if-statement. That is 'NOT O$$anonymous$$' for him.
$$anonymous$$onoDevelop doesn't do such a thing for me?:P
Answer by KdRWaylander · Jan 04, 2016 at 09:01 AM
I think it's something like #2 and #3 are possible in C# (i use them) but NOT in JS (i haven't coded in JS for a looong time so it's only a remembering from nowhere).
But #2 and #3 will only work if you do one action, if you want to several things you NEED curly braces !
Answer by trul · Mar 21, 2016 at 02:24 PM
In Monodevelop go to Tools->Options->Text Editor>CodeTemplates and there you can edit or add your own code templates
Your answer
Follow this Question
Related Questions
Stop Monodvelop adding new line when using attribute 1 Answer
MonoDevelop Doesn't Remember Policy File 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers