Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 529735 - [formatting] default statement in switch does not auto-indent
Summary: [formatting] default statement in switch does not auto-indent
Status: RESOLVED DUPLICATE of bug 520054
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.7.1a   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-12 09:04 EST by Lukas Eder CLA
Modified: 2018-01-13 16:12 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Eder CLA 2018-01-12 09:04:39 EST
Consider the following, incomplete switch statement:

---------------------------------------------------------------
public class Default {
    void m() {
        int i = 1;
        switch (i) {
        cas
        defaul
        }
    }
}
---------------------------------------------------------------

When I complete it by typing the missing "e" in "case", the following indentation is applied automatically, which is nice:

---------------------------------------------------------------
public class Default {
    void m() {
        int i = 1;
        switch (i) {
            case
        defaul
        }
    }
}
---------------------------------------------------------------

The same isn't done for default:

---------------------------------------------------------------
public class Default {
    void m() {
        int i = 1;
        switch (i) {
            case
        default
        }
    }
}
---------------------------------------------------------------

When using the formatter on the complete statement, it re-formats the default statement nicely, but it would be cool if it were already done while typing "default":

---------------------------------------------------------------
public class Default {
    void m() {
        int i = 1;
        switch (i) {
            case 1:
            default:
        }
    }
}
---------------------------------------------------------------
Comment 1 Mateusz Matela CLA 2018-01-13 16:12:32 EST

*** This bug has been marked as a duplicate of bug 520054 ***