Add folding support for the new mixin syntax

Change-Id: I8f37a391cc47a2203730c81acd5f1776cb386e2e
Reviewed-on: https://dart-review.googlesource.com/72521
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/lib/src/computer/computer_folding.dart b/pkg/analysis_server/lib/src/computer/computer_folding.dart
index 1a5a5c3..9488775 100644
--- a/pkg/analysis_server/lib/src/computer/computer_folding.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_folding.dart
@@ -211,6 +211,15 @@
   }
 
   @override
+  Object visitMixinDeclaration(MixinDeclaration node) {
+    _computer._addRegionForAnnotations(node.metadata);
+    // TODO(brianwilkerson) Define `FoldingKind.MIXIN_BODY`?
+    _computer._addRegion(
+        node.leftBracket.end, node.rightBracket.offset, FoldingKind.CLASS_BODY);
+    return super.visitMixinDeclaration(node);
+  }
+
+  @override
   Object visitPartDirective(PartDirective node) {
     _computer._recordDirective(node);
     return super.visitPartDirective(node);
diff --git a/pkg/analysis_server/test/src/computer/folding_computer_test.dart b/pkg/analysis_server/test/src/computer/folding_computer_test.dart
index 96ef96f..dee139a 100644
--- a/pkg/analysis_server/test/src/computer/folding_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/folding_computer_test.dart
@@ -305,6 +305,23 @@
     _compareRegions(regions, content);
   }
 
+  test_mixin() async {
+    String content = """
+// Content before
+
+mixin M {/*1:INC*/
+  void m() {/*3:INC*/
+    print("Got to m");
+  /*3:INC:FUNCTION_BODY*/}
+/*1:INC:CLASS_BODY*/}
+
+// Content after
+""";
+
+    final regions = await _computeRegions(content);
+    _compareRegions(regions, content);
+  }
+
   test_multiple_directive_types() async {
     String content = """
 import/*1:INC*/ 'dart:async';