Bug 471390 - [typing] ternary expression breaks auto indentation
Summary: [typing] ternary expression breaks auto indentation
Status: CLOSED DUPLICATE of bug 65463
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.5   Edit
Hardware: PC Windows 8
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-29 21:05 EDT by Espinosa CZ CLA
Modified: 2017-05-10 07:37 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Espinosa CZ CLA 2015-06-29 21:05:34 EDT
Hi,
Expected indentation after auto indentation (Ctrl+I):

public FileNode fillFileNode(File file) throws IOException {
    // . . . 
    return new FileNode(
            file.getName(),
            file.getName().endsWith(".txt") ? FileType.TEXT : FileType.BINARY,
            file.length(),
            toDate(basicAttributes.creationTime()),
            toDate(basicAttributes.lastModifiedTime()),
            toDate(basicAttributes.lastAccessTime()),
            file.canRead() ? computeFileHash(file) : null,
            ownerAttributeView.getOwner().getName()
            );
}

But instead I am left with this mess:

public FileNode fillFileNode(File file) throws IOException {
    // . . . 
    return new FileNode(
            file.getName(),
            file.getName().endsWith(".txt") ? FileType.TEXT : FileType.BINARY,
                    file.length(),
                    toDate(basicAttributes.creationTime()),
                    toDate(basicAttributes.lastModifiedTime()),
                    toDate(basicAttributes.lastAccessTime()),
                    file.canRead() ? computeFileHash(file) : null,
                            ownerAttributeView.getOwner().getName()
            );
}

It was already present in Eclipse Luna and now have the sad duty to report it also for Eclipse Mars.

My colleagues are very fond of ternary operators which renders auto indentation/auto formatting unusable in most cases and in turn Eclipse close to be be an unusable IDE :( 

I tried to tweak auto formatter to be in fact only auto indenter, but I struggle there too.

I can provide full, self contained, class code for you convenience if asked.
Comment 1 Espinosa CZ CLA 2015-06-29 21:11:21 EDT
Potentially duplicate of Bug 65463 ?

First reported in 2004-06-02 ..2011-04-13 possible patch ..and probably still not fixed??!!!
Comment 2 Dani Megert CLA 2015-07-21 12:22:09 EDT

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