Resharper 2016.3.2 C++ pushes ALL of my code to the left margin on save (Visual Studio 2015 Community)

I've been using ReSharper with C# for a few years, but only recently started using the C++ feature (after I upgraded to an 'ultimate' license.)

With C++ files, ReSharper deletes ALL of my indents, pushing every line to the left margin.

I DO NOT LIKE THIS BEHAVIOR but I cannot seem to stop it.

Why is this happening and how can I stop it?

5 comments
Comment actions Permalink

Hello,

As far as we know, R++ is not supposed to perform any file modifications after a save. Could you please confirm that it's indeed R++ that removes the indentation by temporarily disabling ReSharper via "Tools | Options | ReSharper Ultimate | General | Suspend Now" and checking if the problem goes away?

Thanks!

0
Comment actions Permalink

When ReSharper is disabled, clicking on 'save' causes my code to reformat to just what I like (complete with indents).

When ReSharper is enabled, all of the above happens and then a popup appears offering to do a 'full code cleanup' or 'reformat only' and either choice pushes every line to the left margin.

I DID find an extension I had installed called: "Resharper format on save (which I disabled.) Doing that at least gives me the option to skip the reformatting I don't want.

So, there are two different reasons for concluding that it is ReSharper++ doing this to me.

0
Comment actions Permalink

Just to get the complete picture, what extension are you using to make VS format on save? Is it "Productivity Power Tools" or something similar? And does the ReSharper cleanup popup appear because of the "Resharper format on save" extension?

As for the missing indents, my guess is it's a kind of file R++ cannot parse. R++ does not yet support language extensions like C++/CLI or C++/CX, but code cleanup can be forced on these files and removes the indentation - this is a bug which we'll fix.

In any case, if C++ support does not work for you, you can always disable it on the ReSharper | Options | Environment | Products & Features page.

Thanks for the feedback!

0
Comment actions Permalink

Indeed, I do have "Productivity Power Tools" installed. But I did not know that was triggering R++ to reformat on save.

As I indicated above, 'Resharper format on save" is DISABLED. (Disabling is how I regained control over the 'bad' reformatting.)

I'm not exactly sure what is "Fixing" the format on open, but something is!

I'm not sure what C++/CLI and C++/CX are, but I'm not aware that I'm using any language extensions.

It's been MANY years since I last coded in C++ and I'm now relearning it so I can take some On-Line courses that use C++. A LOT has changed.

0
Comment actions Permalink

C++/CLI and C++/CX are C++ language extensions from Microsoft. C++/CLI is enabled via "General | Common Language Runtime Support" and C++/CX via "C/C++ | General | Consume Windows Runtime Extension" options in project properties.

I filed a request for incorrect formatting (https://youtrack.jetbrains.com/issue/RSCPP-18973), it will likely be fixed in 2017.1. Until then you can either keep the "Resharper format on save" extension disabled, or disable C++ support in ReSharper options as I outlined above.

Thanks!

0

Please sign in to leave a comment.