Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dart-lang/dart_style
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.1.1
Choose a base ref
...
head repository: dart-lang/dart_style
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.2.0
Choose a head ref
  • 1 commit
  • 9 files changed
  • 1 contributor

Commits on Sep 22, 2021

  1. Copy the full SHA
    61a6636 View commit details
Showing with 93 additions and 19 deletions.
  1. +4 −0 CHANGELOG.md
  2. +1 −1 lib/src/cli/formatter_options.dart
  3. +1 −0 lib/src/dart_formatter.dart
  4. +6 −0 lib/src/source_visitor.dart
  5. +13 −13 pubspec.lock
  6. +2 −2 pubspec.yaml
  7. +9 −1 test/splitting/mixed.stmt
  8. +40 −1 test/splitting/type_arguments.stmt
  9. +17 −1 test/whitespace/expressions.stmt
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.2.0

* Fix analyzer dependency constraint (#1051).

# 2.1.1

* Republish 2.0.3 as 2.1.1 in order to avoid users getting 2.1.0, which has a
2 changes: 1 addition & 1 deletion lib/src/cli/formatter_options.dart
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ import 'show.dart';
import 'summary.dart';

// Note: The following line of code is modified by tool/grind.dart.
const dartStyleVersion = '2.1.1';
const dartStyleVersion = '2.2.0';

/// Global options that affect how the formatter produces and uses its outputs.
class FormatterOptions {
1 change: 1 addition & 0 deletions lib/src/dart_formatter.dart
Original file line number Diff line number Diff line change
@@ -89,6 +89,7 @@ class DartFormatter {
var featureSet = FeatureSet.fromEnableFlags2(
sdkLanguageVersion: Version(2, 13, 0),
flags: [
'constructor-tearoffs',
'generic-metadata',
'nonfunction-type-aliases',
'triple-shift'
6 changes: 6 additions & 0 deletions lib/src/source_visitor.dart
Original file line number Diff line number Diff line change
@@ -1805,6 +1805,12 @@ class SourceVisitor extends ThrowingAstVisitor {
builder.endSpan();
}

@override
void visitFunctionReference(FunctionReference node) {
visit(node.function);
visit(node.typeArguments);
}

@override
void visitFunctionTypeAlias(FunctionTypeAlias node) {
visitMetadata(node.metadata);
26 changes: 13 additions & 13 deletions pubspec.lock
Original file line number Diff line number Diff line change
@@ -7,28 +7,28 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "22.0.0"
version: "26.0.0"
analyzer:
dependency: "direct main"
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.2"
version: "2.3.0"
args:
dependency: "direct main"
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.3.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.7.0"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
@@ -91,7 +91,7 @@ packages:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.2"
glob:
dependency: transitive
description:
@@ -140,14 +140,14 @@ packages:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.0.2"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
version: "0.12.11"
meta:
dependency: transitive
description:
@@ -175,7 +175,7 @@ packages:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
path:
dependency: "direct main"
description:
@@ -203,7 +203,7 @@ packages:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0"
shelf:
dependency: transitive
description:
@@ -287,21 +287,21 @@ packages:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.17.9"
version: "1.17.12"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.1"
version: "0.4.3"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.29"
version: "0.4.2"
test_descriptor:
dependency: "direct dev"
description:
@@ -329,7 +329,7 @@ packages:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "7.1.0"
version: "7.3.0"
watcher:
dependency: transitive
description:
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: dart_style
# Note: See tool/grind.dart for how to bump the version.
version: 2.1.1
version: 2.2.0
description: >-
Opinionated, automatic Dart source code formatter.
Provides an API and a CLI tool.
@@ -10,7 +10,7 @@ environment:
sdk: '>=2.12.0-0 <3.0.0'

dependencies:
analyzer: '>=1.3.0 <3.0.0'
analyzer: '>=2.0.0 <3.0.0'
args: '>=1.0.0 <3.0.0'
path: ^1.0.0
pub_semver: '>=1.4.4 <3.0.0'
10 changes: 9 additions & 1 deletion test/splitting/mixed.stmt
Original file line number Diff line number Diff line change
@@ -222,4 +222,12 @@ var longVariableName = identifierSoLongItWraps is SomeClassName;
<<<
var longVariableName =
identifierSoLongItWraps
is SomeClassName;
is SomeClassName;
>>> generic function reference nested inside expression
veryLongFunction(argument, ConstructorTearOff<First, Second, Third, Fourth>, argument);
<<<
veryLongFunction(
argument,
ConstructorTearOff<First, Second,
Third, Fourth>,
argument);
41 changes: 40 additions & 1 deletion test/splitting/type_arguments.stmt
Original file line number Diff line number Diff line change
@@ -94,4 +94,43 @@ new SomeClass<
fifth,
sixth,
seventh,
eighth);
eighth);
>>> generic instantiation all fit on one line
Foo<A,B,C,D>;
<<<
Foo<A, B, C, D>;
>>> generic instantiation split between args
LongClassName<First, Second, Third, Fourth>;
<<<
LongClassName<First, Second, Third,
Fourth>;
>>> generic instantiation split before first if needed
LongClassName<FirstTypeArgumentIsTooLong, Second>;
<<<
LongClassName<
FirstTypeArgumentIsTooLong, Second>;
>>> generic instantiation split in middle if fit in two lines
LongClassName<First, Second, Third, Fourth, Fifth, Sixth, Seventh>;
<<<
LongClassName<First, Second, Third,
Fourth, Fifth, Sixth, Seventh>;
>>> generic instantiation split one per line if they don't fit in two lines
LongClassName<First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>;
<<<
LongClassName<
First,
Second,
Third,
Fourth,
Fifth,
Sixth,
Seventh,
Eighth>;
>>> generic instantiation indent nested type arguments
LongClassName<First, Inner<Second, Third, Fourth, Fifth, Sixth, Seventh>, Eighth>;
<<<
LongClassName<
First,
Inner<Second, Third, Fourth, Fifth,
Sixth, Seventh>,
Eighth>;
18 changes: 17 additions & 1 deletion test/whitespace/expressions.stmt
Original file line number Diff line number Diff line change
@@ -170,4 +170,20 @@ obj?[foo];
>>> generic function expression
var generic = < T,S >(){};
<<<
var generic = <T, S>() {};
var generic = <T, S>() {};
>>> generic method instantiation
void main() => id < int > ;
<<<
void main() => id<int>;
>>> generic method instantiation
void main() => id < int , String , bool > ;
<<<
void main() => id<int, String, bool>;
>>> generic constructor tear-off
var x = Class < int >;
<<<
var x = Class<int>;
>>> generic name constructor tear-off
var x = Class < int > . named;
<<<
var x = Class<int>.named;