Code formatting options - indent past privacy in classes and remove // before file header

First one:

The only options for C++ class indenting are these:

class MyClass    / class MyClass
{ / {
public: / public:
MyClass() / MyClass()
: x(0) {} / : x(0) {}
/
private: / private:
int x; / int x;
}; / };

However, I much prefer indenting a second time for extra readability:

class MyClass
{
public:
MyClass()
: x(0) {}

private:
int x;
};

I couldn't find any option that would let me do that.

Second one:

The file header I generally use looks like this:

/*!*****************************************************************************
\file $FILENAME$
\author $USER_NAME$
\date $CREATED_MONTH$/$CREATED_DAY$/$CREATED_YEAR$
\brief
[brief]

\par Copyright (C) $CREATED_YEAR$
*******************************************************************************/

However, resharper adds more slashes, which are not needed:

// /*!*****************************************************************************
// \file $FILENAME$
// \author $USER_NAME$
// \date $CREATED_MONTH$/$CREATED_DAY$/$CREATED_YEAR$
// \brief
// [brief]
//
// \par Copyright (C) $CREATED_YEAR$
//
// *******************************************************************************/

Again, I couldn't find an option to remove these.

I attempted to search through the community and google for recommendations, and I found https://resharper-support.jetbrains.com/hc/en-us/community/posts/206662895-Insert-file-header for the file header issue but I'm not using StyleCop and the issue wasn't similar. I was using CodeMaid, and this issue still occurred after disabling that.

Apologies if this topic was already brought up :) and thanks for reading.

1 comment

Hello,

Thanks a lot for your feedback!

Re indenting - R++ does not support this style at the moment (neither does clang-format as far as I can tell), I've filed a feature request - https://youtrack.jetbrains.com/issue/RSCPP-23288.

Re file header - unfortunately ReSharper always prepends line comment slashes to each line of the file header text (https://youtrack.jetbrains.com/issue/RSRP-468109). As a workaround, you can create your own file template which starts with your preferred header text, see https://www.jetbrains.com/help/resharper/Creating_a_File_Template.html.

Please vote for corresponding issues to help us prioritize them and receive an update when they get fixed.

0

Please sign in to leave a comment.