Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by 101chris · Apr 27, 2014 at 06:49 PM · c#monodevelopformattingpolicy

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.

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image justinbowes · Mar 24, 2015 at 09:48 AM 1
Share

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?

avatar image 101chris · Jan 04, 2016 at 03:34 AM 0
Share

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?

avatar image ShadyProductions · Jan 04, 2016 at 07:59 AM 0
Share

What's the problem with 3? I do it all the time, works fine.

avatar image saschandroid ShadyProductions · Jan 04, 2016 at 10:01 AM 0
Share

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.

avatar image ShadyProductions saschandroid · Jan 04, 2016 at 12:27 PM 0
Share

$$anonymous$$onoDevelop doesn't do such a thing for me?:P

2 Replies

· Add your reply
  • Sort: 
avatar image
2

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 !

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ShadyProductions · Jan 04, 2016 at 12:28 PM 0
Share

correct :)

avatar image
0

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 alt text


if-template.png (50.7 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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

Smooth transition from Camera1 to Camera2? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges