Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: pkg/analyzer_plugin/lib/src/utilities/folding/folding.dart

Issue 3004733002: Add folding support for plugins and update the main tutorial page (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer_plugin/lib/src/utilities/folding/folding.dart
diff --git a/pkg/analyzer_plugin/lib/src/utilities/folding/folding.dart b/pkg/analyzer_plugin/lib/src/utilities/folding/folding.dart
new file mode 100644
index 0000000000000000000000000000000000000000..22e8b33b8d0c04fd5d05e01dfea1d4814370cf8f
--- /dev/null
+++ b/pkg/analyzer_plugin/lib/src/utilities/folding/folding.dart
@@ -0,0 +1,54 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/analysis/results.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer_plugin/protocol/protocol_common.dart'
+ hide AnalysisError;
+import 'package:analyzer_plugin/utilities/folding/folding.dart';
+
+/**
+ * A concrete implementation of [DartFoldingRequest].
+ */
+class DartFoldingRequestImpl implements DartFoldingRequest {
+ @override
+ final ResourceProvider resourceProvider;
+
+ @override
+ final ResolveResult result;
+
+ /**
+ * Initialize a newly create request with the given data.
+ */
+ DartFoldingRequestImpl(this.resourceProvider, this.result);
+
+ @override
+ String get path => result.path;
+}
+
+/**
+ * A concrete implementation of [FoldingCollector].
+ */
+class FoldingCollectorImpl implements FoldingCollector {
+ /**
+ * The list of folding regions that have been collected.
+ */
+ List<FoldingRegion> regions = <FoldingRegion>[];
+
+ /**
+ * Initialize a newly created collector.
+ */
+ FoldingCollectorImpl();
+
+ @override
+ void addRange(SourceRange range, FoldingKind kind) {
+ addRegion(range.offset, range.length, kind);
+ }
+
+ @override
+ void addRegion(int offset, int length, FoldingKind kind) {
+ regions.add(new FoldingRegion(kind, offset, length));
+ }
+}
« no previous file with comments | « pkg/analyzer_plugin/lib/plugin/folding_mixin.dart ('k') | pkg/analyzer_plugin/lib/utilities/folding/folding.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698