prettier-plugin-csharp icon indicating copy to clipboard operation
prettier-plugin-csharp copied to clipboard

Empty braces are not consistently formatted

Open CharlesTaylor7 opened this issue 4 years ago • 1 comments

Empty braces are printed inline for classes & structs, but printed on separate lines for if statements and method blocks. e.g.

// inline
class Foo { }
// separate lines
if (true)
{
}

I'd prefer to standardize on inlining empty braces, which is how Prettier proper handles JS.

CharlesTaylor7 avatar Aug 24 '19 19:08 CharlesTaylor7

Javascript handles it as follows:

class foo {}
class bar {
  constructor() {}
}
class baz {
  constructor() {
    if (true) {
    }
    if (!false) {
      try {
      } catch (err) {
        console.error(err);
      } finally {
      }
    }
  }
}

This seems consistent.

PyroSA avatar May 12 '22 19:05 PyroSA

This repository is unmaintained and the project is incomplete, don't expect anything else than a toy C# project to reformat correctly. I can accept PRs though.

warrenseine avatar Oct 08 '22 09:10 warrenseine