Menu

#124 indentation options

open
nobody
5
2002-12-10
2002-12-10
Anonymous
No

It would be nice to have the option of using different
indenting styles. DrJava seems to be set up for the K
& R style, where the braces are NOT lined up vertically
(as shown below).

public class SomeClass {
//stuff
}

However, many introductory texts recommend lining them
up as shown below.

public class SomeClass
{
//stuff
}

or even

public class SomeClass
{ //stuff
}

I'd even settle for a system that didn't try to guess
how you wanted indentations, but remembered the last
indent level and stuck with it until you changed it.

Discussion

  • Charles Reis

    Charles Reis - 2002-12-10
    • milestone: --> Small (< 1 pair-week)
     
  • Charles Reis

    Charles Reis - 2002-12-10

    Logged In: YES
    user_id=429731

    The first two styles you mention should work currently
    without a problem (putting the brace on a line by itself
    doesn't change our current rules), but flexibility can be
    good. And actually, it should be fairly trivial to drop in
    alternative indent styles, given the way the code is written.

    We'll probably look into this in the spring semester.
    Your last suggestion (keep previous indent level) would
    probably be useful for non-code files, too (see feature
    request 571805). Thanks for the suggestion...

    Charlie

     
  • Thomas W. Cowdery

    Logged In: YES
    user_id=666354

    I'm a little embarrassed. Whenever I tried the second
    method, the editor indented two spaces after I hit enter, so
    I just backed up and switched to the K&amp;R style. I never
    actually put in the opening brace on the next line. Had I
    done that, I'd have seen that the editor would unindent the
    line by itself to put the brace in the correct position.
    Not the behavior I was expecting, but it works!

    thanks
    tom
    cowderyt@district87.org

     
  • Thomas W. Cowdery

    Logged In: YES
    user_id=666354

    I'm a little embarrassed. Whenever I tried the second
    method, the editor indented two spaces after I hit enter, so
    I just backed up and switched to the K&amp;R style. I never
    actually put in the opening brace on the next line. Had I
    done that, I'd have seen that the editor would unindent the
    line by itself to put the brace in the correct position.
    Not the behavior I was expecting, but it works!

    thanks
    tom
    cowderyt@district87.org

     
  • Thomas W. Cowdery

    Logged In: YES
    user_id=666354

    I'm a little embarrassed. Whenever I tried the second
    method, the editor indented two spaces after I hit enter, so
    I just backed up and switched to the K&amp;R style. I never
    actually put in the opening brace on the next line. Had I
    done that, I'd have seen that the editor would unindent the
    line by itself to put the brace in the correct position.
    Not the behavior I was expecting, but it works!

    thanks
    tom
    cowderyt@district87.org

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.