Search Unity

Smart indentation stopped working with Unity 5.3's MonoDevelop

Discussion in 'Editor & General Support' started by Lohoris2, Dec 10, 2015.

  1. Lohoris2

    Lohoris2

    Joined:
    Aug 20, 2013
    Posts:
    85
    I had Smart indentation enabled in MonoDevelop, but installing Unity 5.3 broke that.

    Now if Smart indentation is enabled, it will double-indent, i.e. if it has to place 1 tab it will place 2 instead, if it has to place 3 it will place 6, etc.

    If I switch to Automatic indentation it works as intended, but I'd rather keep the Smart one if possible…

    Screen Shot 2015-12-10 at 15.57.30.png

    Screen Shot 2015-12-10 at 15.56.52.png
     
  2. Spiral-Organ

    Spiral-Organ

    Joined:
    Aug 20, 2015
    Posts:
    26
    I too have noticed this very annoying issue. Is there a fix around this? Copying and pasting, even with auto indentation, produces multiple tabs, i.e, very deep indentations. I'm having to type out things and let autocomplete finish to avoid having to fix indentation on code blocks.
     
  3. jister

    jister

    Joined:
    Oct 9, 2009
    Posts:
    1,749
    Going nuts over this, thanks for the auto-indent tip ;-)
    edit: also OSX here.
     
    Last edited: Dec 15, 2015
  4. Lohoris2

    Lohoris2

    Joined:
    Aug 20, 2013
    Posts:
    85
    It would be useful to know if only some people are affected by this problem, or it affects everyone… could someone speak up?
     
  5. Sir-Spunky

    Sir-Spunky

    Joined:
    Apr 7, 2013
    Posts:
    132
    Can confirm that this happens as well, and it makes me have to delete redundant indents every time I make a line break. It's a pretty serious bug.

    I'm using Windows 10, if it might be related to that. However, it doesn't seem to happen in every document, but most. Could it be related to the line break encodings of the document you're editing? Or could documents have different settings in some other ways?
     
  6. Lohoris2

    Lohoris2

    Joined:
    Aug 20, 2013
    Posts:
    85
    I'm using OS X so it's definitely a cross-platform bug.
    To me it has happened on every file I tried, but I didn't try many: I searched immediately for a workaround.
    Then I posted here.
     
  7. UncleBill

    UncleBill

    Joined:
    Nov 27, 2014
    Posts:
    1
    I am having the same problem, but have found a solution that works for me.
    The problem for me turned out to be an indent width of 8, which was set only for the current solution, and was not shown in the preferences, where the value was 4 as it should be in my case.
    I am working on a Mac by the way.

    In stead I found it under Project -> Solution Options -> Source Code -> C# source code
    So, I just unchecked the "Use default settings from 'Text file' and set the Indent width back to 4.
    How that sneaky 8 got there in the first place I dont know, but happy days as now everything works again incl. smart indentation.
     
    Martin_H, saygin, TheWarper and 4 others like this.
  8. kimcgm

    kimcgm

    Joined:
    Jul 30, 2013
    Posts:
    11
    This was driving me nuts for days after upgrading to U5.3.
    Set indentation to Smart or Auto, still give out extra indentation.
    Even None still indent the line after I open type "(".

    UncleBill your solution fixed my issue.
    I was looking for the TAB spacing everywhere in the Preferences and I couldn't find it.
    So Thank you thank you.

    I'm also running on OSX.
     
  9. Sir-Spunky

    Sir-Spunky

    Joined:
    Apr 7, 2013
    Posts:
    132
    Thanks UncleBill, that was definitely the problem. I wonder why the default was set to 8 spaces in the new Mono version. That's very non-standard.
     
  10. creepi

    creepi

    Joined:
    Nov 10, 2015
    Posts:
    34
    Thanks UncleBill, thats help me too.
     
    Last edited: Feb 25, 2016
  11. yakandco

    yakandco

    Joined:
    Dec 3, 2014
    Posts:
    90
    I'm having this very same issue happening to me, but in my case the suggested fix doesn't help and has only started occurring since 5.3.5p1 for me