Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New tall style: formatting of multi-line record typedefs #1651

Open
mernen opened this issue Feb 16, 2025 · 1 comment
Open

New tall style: formatting of multi-line record typedefs #1651

mernen opened this issue Feb 16, 2025 · 1 comment

Comments

@mernen
Copy link

mernen commented Feb 16, 2025

The new formatter (#1253) changed the formatting of record typedefs, adding quite a bit of indentation:

Old formatter:

typedef ExampleRecordTypedef = (
  String firstParameter,
  int secondParameter,
  String thirdParameter,
  String fourthParameter,
);

New formatter:

typedef ExampleRecordTypedef =
    (
      String firstParameter,
      int secondParameter,
      String thirdParameter,
      String fourthParameter,
    );

This style seems a net positive to me in many circumstances, but specifically for records I see it mostly as a downgrade (unnecessary indentation and code churn), and I'd like to propose to special-case it.

This is similar in style to #1545/#1634, but for a completely different part of the syntax, so I figured it should be filed separately.

@mernen
Copy link
Author

mernen commented Feb 16, 2025

This would inevitably land in a discussion of where should the exceptions apply; for simplicity I'd propose only bare records (typedef Foo = (...);) and nullable records (typedef Foo = (...)?;), regardless of whether they contain positional or keyword fields. A record wrapped in another type of (e.g. typedef Foo = FutureOr<(...)>;) would be unchanged from the current tall-style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant