-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Block-format await expressions if the inner expression allows it. (#1538
) Block-format await expressions if the inner expression allows it. In assignment-like context, if the RHS is an await expression and the inner expression can be block formatted, then let the whole await expression be block formatted. This comes into play in assignments, but not in argument lists which are the other place where block formatting is a thing. That's because in argument lists, we *don't* treat function calls as block formattable. (This is both for performance and style reasons). There's no point in awaiting any of the other kinds of block-formattable expressions: collection literals or function expressions. So this really just benefits assignments, named argument expressions, and `=>` bodies. But it definitely makes those look better. Fix #1531.
- Loading branch information
1 parent
5749a94
commit 80ecef5
Showing
6 changed files
with
101 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
>>> (indent 2) | ||
final character = | ||
await repository.fetchCharacter(id, cancelToken: cancelToken); | ||
<<< | ||
final character = await repository.fetchCharacter( | ||
id, | ||
cancelToken: cancelToken, | ||
); | ||
>>> (indent 6) | ||
final charactersResponse = | ||
await repository.fetchCharacters( | ||
offset: meta.page * kCharactersPageLimit, | ||
limit: kCharactersPageLimit, | ||
nameStartsWith: meta.name, | ||
cancelToken: cancelToken, | ||
); | ||
<<< | ||
final charactersResponse = await repository.fetchCharacters( | ||
offset: meta.page * kCharactersPageLimit, | ||
limit: kCharactersPageLimit, | ||
nameStartsWith: meta.name, | ||
cancelToken: cancelToken, | ||
); | ||
>>> (indent 4) | ||
final response = | ||
await _get('characters', queryParameters: <String, Object?>{ | ||
'offset': offset, | ||
if (limit != null) 'limit': limit, | ||
if (cleanNameFilter != null && cleanNameFilter.isNotEmpty) | ||
'nameStartsWith': cleanNameFilter, | ||
}, cancelToken: cancelToken); | ||
<<< | ||
final response = await _get('characters', queryParameters: | ||
<String, Object?>{ | ||
'offset': offset, | ||
if (limit != null) 'limit': limit, | ||
if (cleanNameFilter != null && cleanNameFilter.isNotEmpty) | ||
'nameStartsWith': cleanNameFilter, | ||
}, cancelToken: cancelToken); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
>>> | ||
variable = | ||
await function( | ||
argument, // Force split in argument list. | ||
another, | ||
); | ||
<<< | ||
variable = await function( | ||
argument, // Force split in argument list. | ||
another, | ||
); | ||
>>> (indent 4) | ||
final response = | ||
await post(Uri.parse(webhookUrl), headers: { | ||
HttpHeaders.contentTypeHeader: ContentType.json.value, | ||
}, body: json.encode(discordPayload)); | ||
<<< | ||
final response = await post(Uri.parse(webhookUrl), headers: { | ||
HttpHeaders.contentTypeHeader: ContentType.json.value, | ||
}, body: json.encode(discordPayload)); | ||
>>> (indent 2) | ||
final token = | ||
await jwt.verify('<TOKEN>', issuer: '<ISSUER>', audience: { | ||
'<AUDIENCE>', | ||
}, publicKeysUrl: '<PUBLIC_KEYS_URL>'); | ||
<<< | ||
final token = await jwt.verify('<TOKEN>', issuer: '<ISSUER>', audience: { | ||
'<AUDIENCE>', | ||
}, publicKeysUrl: '<PUBLIC_KEYS_URL>'); | ||
>>> (indent 6) | ||
final connection = | ||
await connectSocket( | ||
uri.host, | ||
port: uri.port, | ||
timeout: _socketOptions.timeout, | ||
); | ||
<<< | ||
final connection = await connectSocket( | ||
uri.host, | ||
port: uri.port, | ||
timeout: _socketOptions.timeout, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters