Tapatalk

Smart Indenting

Smart Indenting

1
NewbieNewbie
1

    Sep 25, 2005#1

    When I first got Ultra-Edit, I opened a javascript file up.

    When I reindented it I was dissapointed:

    Notice that if you indent something like this:

    Code: Select all

    if (1)
    {
    .....
    }else{
    .....
    }
    you get:

    Code: Select all

    if (1)
    {
    .....
    }else{
       .....
       }
    So you'd have to use:

    Code: Select all

    if (1)
    {
    .....
    }
    else{
    .....
    }
    or:

    Code: Select all

    if (1)
    {
    .....
    }
    else
    {
    .....
    }
    if you wanted it to indent correctly.

    The last two styles of coding suck ass. }else{ is the bestest way to do it.

    Goto wordlist.txt.

    Find the language you want to indent correctly.
    Replace the indent & unindent with:

    Code: Select all

    /Indent Strings EOL = "{"
    /Unindent Strings SOL = "}"

    80
    Advanced UserAdvanced User
    80

      Sep 28, 2005#2

      I actually prefer the last method. To each his own. However, those aren't the only problems with SmartIndent. For C and some other languages you don't need to use braces if there is only one line following the if. UE doesn't seem to handle this case at all.

      Code: Select all

      if ( something )
          something_else = nothing;
      else
          something_else = another_thing;