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] Indentation lost if comment before function expression body #1645

Open
parlough opened this issue Feb 10, 2025 · 0 comments
Open

Comments

@parlough
Copy link
Member

Language version: 3.7
SDK version: 3.7.0-323.2.beta and 3.8.0-70.0.dev
Page width: Default (80)


Comment before returned value of function with expression body causes indentation to be lost.

Future<String> fetchUserOrder() => Future.delayed(const Duration(seconds: 2), () => 'Large Latte');

Is formatted to the following as expected:

Future<String> fetchUserOrder() =>
    Future.delayed(const Duration(seconds: 2), () => 'Large Latte');

But if I add a comment before the returned value:

Future<String> fetchUserOrder() =>
    // Imagine that this function is more complex and slow.
    Future.delayed(const Duration(seconds: 2), () => 'Large Latte');

Then indentation is lost, with everything being placed on the same line and appearing like two unrelated top-level declarations if you're scanning the file.

Future<String> fetchUserOrder() =>
// Imagine that this function is more complex and slow.
Future.delayed(const Duration(seconds: 2), () => 'Large Latte');
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