- Home /
Stop Monodvelop adding new line when using attribute
This may be a question for the Monodevelop team, and I will email them if no one here has an answer. I thought it would be useful to ask the question here, as I imagine other Unity users are having this issue.
Since the upgrade to Monodevelop 4.0.1, when I format my code it adds new lines where I have used attributes. I have not been able to find a setting to change this behaviour in the C# source code Policy settings. Does anyone know a way change this?
Here's an example of how Monodevelop is adding new lines and indentation:
float one;
[SerializeField]
float
two;
float three;
[Range(0.0f, 1.0f)]
float
four;
As you can see it looks a bit odd and wastes space.
Looking answer for the same issue, so if you'll find out the answer - write it here, please.
You could use Visual Studio... The Express version is free.
I didn't get a response from monodevelop by email. I will try the mono forums.
to LightStriker:
Unfortunately Visual Studio is not able to debug without UnityVS plugin, which seems have some issues too (I have tried it several months ago and Unity Editor hang every time I wanted to close it). And mono is the tool "out of the box", so I see no reason not to use it. Just want to know how to overcome this inconvenience with new line.
I need a solution for the same issue too. Couldn't find a way to change that. Anyone?
Answer by Rob Porter · May 19, 2014 at 11:27 PM
NOTE: THIS ANSWER IS WRONG, IT EXPLAINS HOW TO DO SOMETHING COMPLETELY DIFFERENT
In MonoDevelop:
MonoDevelop-Unity -> Preferences -> Text Editor -> Code Templates -> "Attribute" (It's after "~")
There are a ton of formatting options buried in the MonoDevelop settings -Sorry I don't know them intimately enough to go into great detail for you.
All I can say is:
Before doing anything, make sure you know how to revert your changes back, or at least reset to standard settings!
I don't think that's what we're looking for. It looks like that's the template for attribute definitions (not usage).
That has nothing to do with the question. Those settings are for the code templates (hence the name) for quickly creating new attributes, not the settings for how a field decorated with an attribute is formatted during automatic code formatting.
oh sorry, i didn't realise. should i delete my wrong answer?
At least, edit it for explaining it's not the answer we were expecting. Other people will find this discussion on google if they have the problem and you can be downvoted.