This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 216671 - Editor constructor continuation setting ignored
Summary: Editor constructor continuation setting ignored
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: PC Linux
: P3 normal (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-10 19:07 UTC by tbrunhoff
Modified: 2016-07-22 17:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
NB settings (1.65 MB, application/zip)
2012-08-10 19:07 UTC, tbrunhoff
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tbrunhoff 2012-08-10 19:07:54 UTC
Created attachment 122997 [details]
NB settings

Under options->edtor->formatting->c++ formatting style, the "constructor continuation" setting suggests that it controls the shift for the second and following lines. It doesn't. In fact, the handling of constructor indentation makes no sense.

First, if I just hit return after the the constructor decl I get this kind of indentation:
------------------------------
class Bug {
private:
    int value;
    
public:
    Bug()
            : value(0)
            {}
            
};
-------------------------------
I have no idea where it got the 8 char indent. My settings are attached.

Second, if I supply braces before I fill in the initializer, the braces are indented correctly, but the colon lines up with the braces, and the next line goes back to the funky 8 char indent, like this:
-------------------------------
class Bug {
private:
    int value1;
    int value2;
    
public:
    Bug()
    : value1(0),
            value2(0)
    {}            
};
--------------------------------
FYI, what I *really* want is to get the member names to line up, like this:
--------------------------------
class Bug {
    ...

    Bug()
      : value1(0),
        value2(0)
    {}            
};
--------------------------------

Product Version: NetBeans IDE Dev (Build 201208100001)
Java: 1.7.0_05; Java HotSpot(TM) Client VM 23.1-b03
System: Linux version 3.4.4-4.fc16.x86_64 running on i386; UTF-8; en_US (nb)
User directory: /home/toddb/.netbeans/dev
Cache directory: /home/toddb/.cache/netbeans/dev
Comment 1 Alexander Simon 2016-07-22 11:36:10 UTC
Hi Tod,

There is no mentioned bugs in development version:
- formatter formats right and take into account "constructor continuation" setting.
- indenter works half right (ignored"constructor continuation" setting, always uses 0). 

Alexander
Comment 2 tbrunhoff 2016-07-22 17:41:38 UTC
Alexander,
I still think the current dev version has problems.  Just typing in the class below (with constructor continuation set to 0 or 4) I get this:
class foo {

class Fumble {
public:
    Fumble(int arg0,
           int arg1,
           int arg2)
    : arg0(0),
            arg1(1),
            arg2(2)
    {}
    
    inline void func(int arg0,
    int arg1,
    int arg2);
private:
    int arg0, arg1, arg2;
};

void Fumble::func(int arg0,
                  int arg1,
                  int arg2)
{
    
}


constructor args look ok, but the initialization list should be better, like I described above, IMO. Also, note the inline function declaration.  That looks pretty broken, but the implementation is fine.

Thanks for looking into this.