Closed munificent closed 3 months ago
The formatter treats "block formattable" expressions differently in assignment contexts. That's what lets it produce output like:
variable = function( argument, another, );
Instead of the split in the argument list forcing the = to split like:
=
Currently await expressions are not considered block-formattable even if their subexpression is. That means that instead of:
await
variable = await function( argument, another, );
You get:
We should probably allow await expressions to be block formattable if their subexpression is. In particular this diff of applying the new style to shorebird has some examples:
// Before: final response = await post( Uri.parse(webhookUrl), headers: {HttpHeaders.contentTypeHeader: ContentType.json.value}, body: json.encode(discordPayload), ); // After: final response = await post(Uri.parse(webhookUrl), headers: { HttpHeaders.contentTypeHeader: ContentType.json.value, }, body: json.encode(discordPayload)); // Before: final token = await jwt.verify( '<TOKEN>', issuer: '<ISSUER>', audience: {'<AUDIENCE>'}, publicKeysUrl: '<PUBLIC_KEYS_URL>', ); // After: final token = await jwt.verify('<TOKEN>', issuer: '<ISSUER>', audience: { '<AUDIENCE>', }, publicKeysUrl: '<PUBLIC_KEYS_URL>'); // Before: final connection = await connectSocket( uri.host, port: uri.port, timeout: _socketOptions.timeout, ); // After: final connection = await connectSocket( uri.host, port: uri.port, timeout: _socketOptions.timeout, );
Ditto for as expressions.
as
The formatter treats "block formattable" expressions differently in assignment contexts. That's what lets it produce output like:
Instead of the split in the argument list forcing the
=
to split like:Currently
await
expressions are not considered block-formattable even if their subexpression is. That means that instead of:You get:
We should probably allow
await
expressions to be block formattable if their subexpression is. In particular this diff of applying the new style to shorebird has some examples: