Skip to content

Commit 00d1b16

Browse files
committed
Support URIs in part-of directives.
Fix #615.
1 parent 89a5c18 commit 00d1b16

File tree

6 files changed

+24
-3
lines changed

6 files changed

+24
-3
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.0.6
2+
3+
* Support URIs in part-of directives (#615).
4+
15
# 1.0.5
26

37
* Support the latest version of `pkg/analyzer`.

bin/format.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import 'package:dart_style/src/io.dart';
1414
import 'package:dart_style/src/source_code.dart';
1515

1616
// Note: The following line of code is modified by tool/grind.dart.
17-
const version = "1.0.5";
17+
const version = "1.0.6";
1818

1919
void main(List<String> args) {
2020
var parser = new ArgParser(allowTrailingOptions: true);

lib/src/source_visitor.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,11 @@ class SourceVisitor extends ThrowingAstVisitor {
15161516
space();
15171517
token(node.ofKeyword);
15181518
space();
1519+
1520+
// Part-of may have either a name or a URI. Only one of these will be
1521+
// non-null. We visit both since visit() ignores null.
15191522
visit(node.libraryName);
1523+
visit(node.uri);
15201524
});
15211525
}
15221526

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: dart_style
22
# Note: See tool/grind.dart for how to bump the version.
3-
version: 1.0.5
3+
version: 1.0.6
44
author: Dart Team <[email protected]>
55
description: Opinionated, automatic Dart source code formatter.
66
homepage: https://github.com/dart-lang/dart_style

test/splitting/part.unit

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
40 columns |
2+
>>> part of with uri that fits
3+
part of "uri.dart";
4+
<<<
5+
part of "uri.dart";
6+
>>> part of with uri does not split on long line
7+
part of "very_very_very_very_long_uri.dart";
8+
<<<
9+
part of "very_very_very_very_long_uri.dart";

test/whitespace/directives.unit

+5-1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,8 @@ import 'a' if (b.c.d) 'e';
5757
>>> configuration
5858
export'a'if(b . c=='d' )'e';
5959
<<<
60-
export 'a' if (b.c == 'd') 'e';
60+
export 'a' if (b.c == 'd') 'e';
61+
>>> part-of with uri
62+
part of'uri.dart' ;
63+
<<<
64+
part of 'uri.dart';

0 commit comments

Comments
 (0)