mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Extension type. Code folding.
Change-Id: I33ee2cf63a275c7c2d8f41c4033a0ee4d2641e28 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323944 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
49f5312fed
commit
53cd950e7a
2 changed files with 30 additions and 0 deletions
|
@ -297,6 +297,17 @@ class _DartUnitFoldingComputerVisitor extends RecursiveAstVisitor<void> {
|
|||
super.visitExtensionDeclaration(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitExtensionTypeDeclaration(ExtensionTypeDeclaration node) {
|
||||
_computer._addRegionForAnnotations(node.metadata);
|
||||
_computer._addRegion(
|
||||
node.leftBracket.end,
|
||||
node.rightBracket.offset,
|
||||
FoldingKind.CLASS_BODY,
|
||||
);
|
||||
super.visitExtensionTypeDeclaration(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitFieldDeclaration(FieldDeclaration node) {
|
||||
_computer._addRegionForAnnotations(node.metadata);
|
||||
|
|
|
@ -361,6 +361,25 @@ final a = new Text(/*[0*/
|
|||
});
|
||||
}
|
||||
|
||||
Future<void> test_extensionType() async {
|
||||
var content = '''
|
||||
// Content before
|
||||
|
||||
extension type E(int it) {/*[0*/
|
||||
void m/*[1*/() {
|
||||
}/*1]*/
|
||||
/*0]*/}
|
||||
|
||||
// Content after
|
||||
''';
|
||||
|
||||
await _computeRegions(content);
|
||||
expectRegions({
|
||||
0: FoldingKind.CLASS_BODY,
|
||||
1: FoldingKind.FUNCTION_BODY,
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> test_file_header() async {
|
||||
var content = """
|
||||
// Copyright some year by some people/*[0*/
|
||||
|
|
Loading…
Reference in a new issue