Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Ticket #82 (closed defect: fixed)

Opened 16 years ago

Last modified 15 years ago

switch/case auto-indent (not formatter)

Reported by: fvbommel Assigned to:
Priority: major Component: descent.core
Version: 0.5 Keywords:
Cc:

Description

From digitalmars.D:71602

Robert Fraser wrote:

Mike wrote:

Yeah, I hate it when Eclipse starts to put my case statements on the wrong indentation level.

Both JDT and Descent let you choose. Window > Preferences > Java/D > Code Style > Formatter > Edit... > Indentation

I think I know what he means: unfortunately, Descent doesn't seem to pay attention to that setting when you're just typing code. If I try to type

void foo(int bar) {
    switch (bar) {
        case 1:
    }
}

I instead get:

void foo(int bar) {
    switch (bar) {
    case 1:
    }
}

Note the indenting of 'case'. This is with the checkbox for [Indent] "'case'/'default' statements within 'switch'" turned on. And it happens whether or not I press 'tab' before typing 'case'. (If I use tab to manually indent the 'case', it *unindents* the moment I hit 'e'!)

Pressing Ctrl-Shift-F fixes the indentation; this seems to be an auto-indenting issue, not a formatter issue.

(Descent 0.5.2.20080501, Eclipse 3.2.2 / M20070212-1330 (Ubuntu version: 3.2.2-5ubuntu2))

P.S. Mike replied:

Exactly. It seems to do it only with the first case, however.

Change History

05/18/09 16:29:25 changed by asterite

  • status changed from new to closed.
  • resolution set to fixed.

(In [1347]) Fixed #82: switch/case auto-indent (not formatter)