1

If I have

class A
{
   int a;
   int b;
}

Is there a way for resharper to reformat this code on "code cleanup" action to the following?

class A
{
   int a, b;
}
Gleno
  • 15,466
  • 11
  • 59
  • 81

1 Answers1

2

There is no way to do it in ReSharper because this is considered a bad style. See Why do you not declare several variables of the same type on the same line? and Declaring Multiple Variables in JavaScript

Community
  • 1
  • 1
Dmitry Osinovskiy
  • 9,629
  • 1
  • 45
  • 36
  • I totally agree with you, this is why Resharper offers a refactoring option to split into separate declarations, however, is it possible to give it an inspection severity? – Piers Myers May 13 '13 at 09:52
  • @PiersMyers I've filed a feature request for it http://youtrack.jetbrains.com/issue/RSRP-362348 . Feel free to vote for it. – Dmitry Osinovskiy May 13 '13 at 12:00
  • @DmitryOsinovskiy This is what I expected. I disagree with this style guideline, however. I disagree even stronger with the idea of enforcing a stylistic choice. – Gleno May 14 '13 at 10:31
  • @Gleno What do you mean with "enforcing"? Currently there is no highlighting for this, and even if there would be one, you would be able to turn it off. – Dmitry Osinovskiy May 14 '13 at 11:27
  • @DmitryOsinovskiy Perhaps I misspoke. My meaning is that since there's an option to split, there should too be an option to join - for those of us who don't agree with the stylistic choice you subscribe to. Thanks for taking your time to answer my question though. I'm a big fan of R#. ;) – Gleno May 14 '13 at 12:43