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

[tall style] Multi-line variable declarations (without initializers) indentation #1541

Closed
dcharkes opened this issue Aug 17, 2024 · 1 comment

Comments

@dcharkes
Copy link

Very long typed final variables do not get indented:

  String renameMember(Declaration declaration, String member) =>
      renameMemberFunc(declaration, member);
  final String Function(Declaration declaration, String member)
      renameMemberFunc;

->

  String renameMember(Declaration declaration, String member) =>
      renameMemberFunc(declaration, member);
  final String Function(Declaration declaration, String member)
  renameMemberFunc;

I'm not sure if this is intended. I could probably get used to the new style.

Source file: https://github.com/dart-lang/native/blob/main/pkgs/ffigen/lib/src/config_provider/config_impl.dart

@munificent
Copy link
Member

Yeah, this is working as intended.

It's a little strange but, honestly, there's probably no perfect style here. I chose this approach in the new style in part because it felt weird to me to indent the variable name, when the variable type is subordinate to it. The new style has a similar approach for function return types:

SomeVeryLongReturnType
function() {
  ...
}

And likewise there it would feel weird to me to indent the function name when it "owns" the return type.

So I decided to not indent at all whenever we split between a type annotation and the thing it annotates. Also, I think it looks pretty nice, especially in things like parameter lists.

@munificent munificent closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2024
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

2 participants