Search Unity

Monodevelop annoying auto indentation

Discussion in 'Formats & External Tools' started by Andrey-Postelzhuk, Nov 26, 2013.

  1. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    Nope. I'm all for using alternative IDEs, unless they're made by Microsoft.

    As for solutions, some here are "kinda" working, but not quite (meaning that in different part of code it may still format on paste). At least in previous MonoDevelop, you could press ctrl+z and it would undo indentation only, but here it undoes both indentation and whatever code you've pasted :(
     
  2. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    @darkhog, if that makes you less unhappy, you may want to know that the new VS 2015 Community edition is as bad in indenting code as MD :p
     
    Last edited: Jan 12, 2016
  3. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    I suspected as much. It is Microsoft we're talking about after all. I hope Unity will either open their branch of MD, so I can add this change myself (MD's written in C#, right?) or add option that makes possible to no reindend the code when pasting. Because as it is now, it isn't very nice.

    That paste-indend thing is my only complaint about MD, by the way. Love everything else in this IDE.
     
  4. CultureExplorer

    CultureExplorer

    Joined:
    Dec 22, 2015
    Posts:
    1
    I have found the absolute solution working December 22 2015 on windows 7.
    First go to Tools > Options > Text editor > General > Coding >

    And then un-check > aggressively trigger code completion list
     
  5. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    @CultureExplorer I haven't tried that but it doesn't sound like that will fix the auto-indent :confused:
     
  6. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,406
  7. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    Sorry, but I won't bend to MD's will. It is supposed to work the other way around.
     
  8. kimcgm

    kimcgm

    Joined:
    Jul 30, 2013
    Posts:
    11
    The auto indentation is very annoying after going to MD 5.9.6. Pasting code or new lines just forces 2 taps in place.
    It's very annoying. I like MD because it gives me a consistent IDE to work on Win and OSX machines.
    I hope they could offer a solution or patch to fix it.
     
  9. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
  10. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    It kinda fixes it, but it is not a full fix as it still will reindend on paste if you have different indentation than one set in policies. Proper fix would get rid of reindenting completly, no matter of how file was formatted (or not formatted) in the first place.
     
  11. Grhyll

    Grhyll

    Joined:
    Oct 15, 2012
    Posts:
    119
    I'm a bit sad as well, I always liked MD, but this new version just isn't usable anymore...
    Where I had a nice auto indentation before, it now won't add the tab; so I add it by hand, and while I'm typing my code it is automatically removed... Guess I'll have to try VS :/
     
  12. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    BIG BUMP.
    Worked fine in last iteration, but with Unity 5.3.1 this annoying feature succcckkkkks.

    Please bring sanity into the conversation and have normal indenting.
    Thanks. Seems such a small thing.
     
    ESG-Steven and darkhog like this.
  13. sushanta1991

    sushanta1991

    Joined:
    Apr 3, 2011
    Posts:
    305
    I upgraded one of my old unity project to unity 5.3.2 and faced this issue , after tying a lots solutions, one thing worked for me.

    Project -> Solution Options -> Source Code (Code Formatting) -> (In C# source code, Set Policy to ) Microsoft Visual Studio. (I am attaching an Image so you don't get confused).

    also in the process of solving this issue , if you have changed something in Preferences-> TextEditor-> Behaviour-> Indentation-> Indentation mode to Automatic (Than please revert it back to Smart).


    Here is the reference image:

     
    Zolden likes this.
  14. JustinReinhart

    JustinReinhart

    Joined:
    Apr 3, 2012
    Posts:
    6
    Found a fix that worked for me.

    I also had a SEVERE nightmare auto-indention issue after upgrading a project from Unity 4 to Unity 5. I resolved this issue personally by deleting Assembly-CSharp.csproj and ProjectName.sln from the project folder, and then relaunching Unity. You might only need to delete the first one. Good luck to you.

    P.S. Oh. I also went into Tools -> Options -> Source Code -> Code Formatting and I changed my formatting policy to Microsoft Visual Studio. This is not enough alone to solve the issue--I had to delete the files as well because this preference was being ignored, even despite setting inheritance in the solution options. So do both things and you should be golden.
     
  15. eppz

    eppz

    Joined:
    Aug 2, 2014
    Posts:
    172
    In my case, reset "Indent width" solution setting solved the issue.

    There is a setting for MonoDevelop at "Preferences -> Code Formatting -> Indent width" (probably 4).
    But there is also a setting for the actual solution at "Project -> Solution Options -> Code Formatting -> Indent width". Which was 8 in my case (can't tell why), resetting to 4 solved the issue.
     
    Fajlworks likes this.
  16. ronjoshi

    ronjoshi

    Joined:
    Nov 27, 2016
    Posts:
    1
    Just disable "Enable on the fly code formatting" in the behavior section of tools
    Works like a charm
    I tried this on MonoDevelop 5.9; I don't know if it works on anything below 5.0
     
  17. maggot

    maggot

    Joined:
    Nov 25, 2009
    Posts:
    11
    For Monodevelop 5.9.6 (and maybe earlier versions) you can disable auto-indenting by
    Edit->Preferences->(Go to heading)Text Editor->(Select)Behavior,(Go to heading)Indentation->Identation mode, select and set to None.
     
  18. _creatio_

    _creatio_

    Joined:
    Mar 21, 2013
    Posts:
    43
    JustinReinhart, you are a life saver! Worked for me. Thank you sir!
     
  19. jonjons

    jonjons

    Joined:
    Oct 13, 2016
    Posts:
    41
    .
     
    Last edited: Apr 12, 2017
  20. badweasel

    badweasel

    Joined:
    Jan 11, 2015
    Posts:
    18
    I too was going nuts with this. The "Project -> Solution Options -> Code Formatting -> Indent width" was the fix for me. I set every single one of the document types to 4 and that fixed it.
     
  21. AmazingRuss

    AmazingRuss

    Joined:
    May 25, 2008
    Posts:
    933
    I fixed it by installing Visual Studio Code. The long nightmare is over.
     
    eppz and Flipbookee like this.
  22. venkat230278

    venkat230278

    Joined:
    Mar 13, 2014
    Posts:
    1
    If fixing the Policy in Tools -> Options does not work, ensure that the policy is in use at Project -> Solution Options
     
  23. eppz

    eppz

    Joined:
    Aug 2, 2014
    Posts:
    172
    I did the same, also, patches come fast for Visual Studio Code.