Prevent Formatting From Moving Variables

Hi! I just started using rider yesterday, and I couldn't be happier! This is so far the best integrated IDE for unity, and it works very well. It took me some time to get everything working as I want, but once that was done I was very confortable :)

There's still one thing I haven't found were to disable it, and thats the formater from moving variables around. I like to be able to organize my own variables under my own criteria, and I cant find where to disable it :(

Can someone help me please!!

0
5 comments

Hello,

Thank you for contacting Rider support and for sharing your feedback.

I am not sure I got you right. To be on the same page, would you mind sharing a sample behavior that you wish to stop experiencing?

Probably this might help: If you are suggested with a quickfix for moving a variable, you probably can disable a specific inspection as shown below:

Have a nice day!

1

Sorry I explained myself really poorly.

Here for example:

For this file I want to have the constructor and the variables on that order.
But when I save, the formater moves everything around, this how it looks after that:


 I had a better example with a file with lot of variables and a title separating each version. Thats actually the file that made me create this post. But now for some reason it is not moving the variables around on that file anymore, idk what changed. This was the file:
 


I like the formater, but I don't want it to move things around in my code. And I cant find where to disable that :(

0

Hello,

Thank you for the clarification.

This is the File Layout feature. It reorganises class members as per predefined rules, that are defined in Settings | Editor | Code Style | C# | File Layout.

There are two options to solve your case: 

  • Open Settings | Editor | Code Style | C# | File Layout → Select “General” → select “Load patterns: Empty”. If you work with a Unity project, select “Unity” → “Load patterns: Empty” → Press “Save”;

  • Or you can disable the “Apply File layout” option from your cleanup profiles:

 

If that doesn't help, please let me know.

Have a nice day!

1

The first option worked perfectly, thanks!!!!

I gonna take a deeper look after, to see if I can keep some of the layout options and only remove the ones I didn't like, because it seems really handy :)

Thanks again!!

0
Hello,

I am glad to hear that I was able to help.
Should you have any other questions or difficulties in the future, do not hesitate to contact support.

Have a nice day!
0

Please sign in to leave a comment.