Request: Alignment bugs and options in R# C++

First, I want to say thanks to the devs for continuing to improve R# C++. Keep it up!

Sorry if this is already in the bug database, but I didn't find it if it is. Let me know if this is the wrong place to post.

I'm using R# Ultimate version 2017.1, and VS2017 Community (15.1, r26403.0)

The options for "Align multiline construct" are currently just a checkbox. The formatting is incorrect and inconsistent either way. There is no way to tell resharper not to reformat at all - it will always align multiline constructs no matter which options I select.

I suggest changing the checkbox to the same dropdown that's used for other options, where "do not modify" is an option.

I would also appreciate a "single indent" option, like the C# plugin provides.

Example of what I type (and what I want it to be):

constexpr auto win_style
= WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
| WS_VISIBLE
| WS_OVERLAPPEDWINDOW;

constexpr auto win_style = WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
| WS_VISIBLE
| WS_OVERLAPPEDWINDOW;

constexpr auto win_style = WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
| WS_VISIBLE
| WS_OVERLAPPEDWINDOW;

Reformatted with the "chained binary expression" checkbox unchecked:

constexpr auto win_style
= WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
| WS_VISIBLE
| WS_OVERLAPPEDWINDOW;

constexpr auto win_style = WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
| WS_VISIBLE
| WS_OVERLAPPEDWINDOW;

constexpr auto win_style = WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
| WS_VISIBLE
| WS_OVERLAPPEDWINDOW;

Reformatted with checkbox checked:

constexpr auto win_style
= WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
| WS_VISIBLE
| WS_OVERLAPPEDWINDOW;

constexpr auto win_style = WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
| WS_VISIBLE
| WS_OVERLAPPEDWINDOW;

Or, sometimes, for the first definition, I get:

constexpr auto win_style
= WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
| WS_VISIBLE
| WS_OVERLAPPEDWINDOW;

If I change WS_CLIPSIBLINGS to a value, I get a different result:

constexpr auto win_style
= 11111111111111
| WS_CLIPCHILDREN
| WS_VISIBLE
| WS_OVERLAPPEDWINDOW;

constexpr auto win_style = 11111111111111
| WS_CLIPCHILDREN
| WS_VISIBLE
| WS_OVERLAPPEDWINDOW;

3 comments
Comment actions Permalink

If I change "continuous line indent" from 0 to 1, I get a better result, but it's still wrong:

constexpr auto win_style
= WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
| WS_VISIBLE
| WS_OVERLAPPEDWINDOW;
0
Comment actions Permalink

Josh, thanks a lot for the very detailed feedback, much appreciated!

I believe the intended combination of settings for your use case is "Continuous line indent" set to "Single" and "Chained binary expressions" off. For local declarations, I get the following result:

Which seems to match what you want. So it looks like there are a couple of issues that need addressing:

  1. "Continuous line indent" is not applied to top-level declarations (https://youtrack.jetbrains.com/issue/RSCPP-19513).
  2. Indentation is incorrect with "Chained binary expressions" set for an expression which contains macro calls (https://youtrack.jetbrains.com/issue/RSCPP-19514).

You're welcome to vote for the issues to receive updates - we'll see if we can fix them in time for 2017.1.2.

Thanks!

 
1
Comment actions Permalink

Great, thanks!

0

Please sign in to leave a comment.