0

I'm trying to get Resharper 9.x to reformat my C++/CLI code automatically on Visual Studio 2015 Enterprise. However, I came across this case which doesn't seem to make sense:

The following code:

namespace MyNamespace
{
    public ref class MyClass
    {
    public:
        MyClass();
        ~MyClass();

        void MyMethod()
        {

        }
    };
}

Gets reformatted to this:

namespace MyNamespace
{
    public ref class MyClass
    {
    public:
        MyClass();
        ~MyClass();

        void MyMethod()
        {

}
};
}

It would seem like each time it finds a closing curly brace, the indentation is cleared so it appears on the first column, rendering auto-formatting pretty much useless.

Is this a bug? What am I doing wrong?

Axel Magagnini
  • 855
  • 1
  • 8
  • 19
  • ReSharper supports plain C++, it doesn't support C++/CLI (yet anyway). The *interesting* thing is that if you remove `public ref` (so it becomes plain C++), the formatter *still* messes up. – Lucas Trzesniewski Dec 05 '15 at 13:10
  • As far as I could try, it would seem that the problem is actually with the `}`. Whenever I use one, everything after it gets pulled to column 1 regardless of code semantics. – Axel Magagnini Dec 05 '15 at 17:50
  • Maybe it's some Visual Studio 2015 feature that's messing with Resharper's formatter? Doesn't look like normal behavior to me. – Axel Magagnini Dec 05 '15 at 17:52
  • I don't think VS interferes... Well, give it some time, ReSharper for C++ is still in its early stages. You may want to report this to JetBrains though. – Lucas Trzesniewski Dec 05 '15 at 23:19
  • Poor refactoring abilities aside, I am using Resharper++ without this issue with Visual Studio 2013, so it might be the combination or VS messing up. – Jonas Dec 08 '15 at 17:13

0 Answers0