Search Unity

MonoDevelop Changing Tab size has no effect

Discussion in 'Scripting' started by Pirs01, Oct 19, 2012.

  1. Pirs01

    Pirs01

    Joined:
    Sep 30, 2012
    Posts:
    389
    MonoDevelop has 4 spaces wide tab by default which I hate because it unnecessarily wastes space and makes code not fit in reasonable width.

    I go to Tools->Options->Source Code->C# source code, uncheck Use default settings from 'Text file' and set something less then 4 in Tab width and it has no effect. The tab is still 4 spaces wide and annoying.

    Any ideas?
     
  2. Landern

    Landern

    Joined:
    Dec 21, 2008
    Posts:
    354
    Under the 'Text file' option you should see 'C# Source Code'. Is that set to a custom policy, does it have 'Use default settings from 'Text file'' checked?
     
  3. Pirs01

    Pirs01

    Joined:
    Sep 30, 2012
    Posts:
    389
    Yes. Policy is set to Custom.
    Use default settings from 'Text file' is not checked.
     
  4. Landern

    Landern

    Joined:
    Dec 21, 2008
    Posts:
    354
    Well check it, you specified for "Text file", if you are using c#, have the same policy apply.
     
  5. Pirs01

    Pirs01

    Joined:
    Sep 30, 2012
    Posts:
    389
    Anyways I tried changing settings under both Text file and C# source code
     
  6. PixelPiledriver

    PixelPiledriver

    Joined:
    Nov 30, 2012
    Posts:
    1
    4 space tabs drives me crazy.
    Here's how to fix it.

    In Mono go here:


    Select C#.
    Create a new custom policy.
    Name it.
    Set the options you want (probly 2 space tabs) and press OK:


    Mono will tell you that the custom policy will only be applied to new projects.
    You need to apply it to your current project manually.
    Go here in Mono:


    And then apply your custom policy:


    Your code should now be formatted the way you want!
     
    mgear likes this.
  7. TigerLeep

    TigerLeep

    Joined:
    Apr 2, 2013
    Posts:
    2
    You are my hero! :)
     
  8. WedgeBeard

    WedgeBeard

    Joined:
    May 7, 2013
    Posts:
    2
    So, this works to change the policy on a single script file, but is there a way to do this on a global scale, so that anytime I create a new script file (I'm using Javascript) it automatically adheres to my policy without me having to "apply policy" to every new script I make?
     
  9. WedgeBeard

    WedgeBeard

    Joined:
    May 7, 2013
    Posts:
    2
    Nevermind, I just found that if I go to Project -> Solution Options, changes I make there are global. I think "solutions" is misleading, strange choice of a word for the options it contains. Anyway, after I made changes in the solution menu, it made my choices global, so every time I make a new Javascript file, it recognizes that I want tabs of size 2. Groovy.
     
  10. SONIC3D

    SONIC3D

    Joined:
    Nov 16, 2011
    Posts:
    2
    Tools->Options->Source Code->Code Formatting will only affact on new solution/project to be created after changing this option.

    To modify code formatting option on current solution,right click on Solution item in solution tree->Options->Source Code->Code Formatting.
    And usually the formatting option is inherited by projects in this solution.So if you wanna specialized formatting option in specific project.Right click on that project in solution tree->Options->Source Code->Code Formatting.

    These option will be stored in .sln files and .csproj files in your Unity3D project directory.