roslyn: Prefer braces does not support removing unnecessary braces

Gee, very welcome changes, it was really a pain to always change foreign code to my code style half-manually. Most of it seems to work all right but not removing extra braces around one-liners. I have the attached settings and neither suggestion nor refactoring seems to happen in simple cases like:

if (args.MarginSizeChanged) {
  page.MarginSize = args.MarginSize;
}

This issue has been moved from https://developercommunity.visualstudio.com/content/problem/311544/prefer-braces-not-working.html VSTS ticketId: 664398 These are the original issue comments:

Gábor Deák Jahn on 8/15/2018, 05:24 AM (15 days ago):

I did attach a screenshot… Well, here it is again.

Gábor Deák Jahn on 8/15/2018, 05:30 AM (15 days ago):

Addendum, this might be relevant: in other cases, changing the Preference mostly (but not always) changes the illustrative example below. In the case of Prefer braces, the example always stays the same, preferring braces, no matter whether I set it to Yes or No.

Gábor Deák Jahn on 8/15/2018, 05:48 AM (15 days ago):

Just one more thing, Lieutenant. Could just as well be linked. If I ask for an Invert If, the branches are swapped all right but I get braces around the then branch. With Prefer braces still set to No.

Alexander Seeck on 8/29/2018, 06:09 AM (35 hours ago): I just wanted to report the same issue. Glad someone did that already These are the original issue solutions: (no solutions)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Why is this closed?

This is not closed.