4coder»Forums
Charly Mourglia
5 posts
None
Indentation behaviour
Edited by Charly Mourglia on Reason: Added namespace stuff, fixed typo
Hi,

Is there any way to customize indentation behaviour ?
I kinda don't like the way access specifiers (public, private, protected) and constructors initialization lists are (not) indented.

What I get :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
class Foo
{
    public:
    Foo();

    private:
    int bar;
    int baz;
};

Foo::Foo()
: bar(42)
, baz(1337)
{
}


What I would expect
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
class Foo
{
public:
    Foo();

private:
    int bar;
    int baz;
};

Foo::Foo()
    : bar(42)
    , baz(1337)
{
}


Also, being able to add keywords in some way to the indentation engine, to avoid messing thing up because of macros for example (yes signals, slots and Q_OBJECT, I'm looking at you...)

EDIT:
Fun fact, it looks like initialization lists are correct when inside namespaces (while public / private are still not)

Actual behaviour:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
namespace test
{
    class Foo
    {
        public:
        Foo();
        
        private:
        int bar;
        int baz;
    };
    
    Foo::Foo()
        : bar(42)
        , baz(1337)
    {
    }
}


What could be intended :
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
namespace test
{
    class Foo
    {
    public:
        Foo();
        
    private:
        int bar;
        int baz;
    };
    
    Foo::Foo()
        : bar(42)
        , baz(1337)
    {
    }
}


P.S.: Those indenting rules imply only me, and this might behave the way it's intended to, in this case that's why I would like to be able to customize them :P
Allen Webster
476 posts / 6 projects
Heyo
Indentation behaviour
Edited by Allen Webster on Reason: wording
Today is your lucky day, good sir, because right this very day, in just thirty minutes, I am going to go live on Twitch and reimplement the auto indent rule entirely on the customization side. Moving it to the customization side will let me offer more built in flexibility, and it will mean that users who maintain their own customizations can tweak the indenting rule to their hearts content.

In the mean time: yes. This is the expected behavior for alpha 4.0.10.
Charly Mourglia
5 posts
None
Indentation behaviour
w00t, I luv dat !