Index: pkg/analyzer_plugin/lib/src/utilities/highlights/highlights.dart |
diff --git a/pkg/analyzer_plugin/lib/src/utilities/highlights/highlights.dart b/pkg/analyzer_plugin/lib/src/utilities/highlights/highlights.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9935e959a3e3eaa11571e8de86e24b76cb9725d8 |
--- /dev/null |
+++ b/pkg/analyzer_plugin/lib/src/utilities/highlights/highlights.dart |
@@ -0,0 +1,49 @@ |
+// 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/highlights/highlights.dart'; |
+ |
+/** |
+ * A concrete implementation of [DartHighlightsRequest]. |
+ */ |
+class DartHighlightsRequestImpl implements DartHighlightsRequest { |
+ @override |
+ final ResourceProvider resourceProvider; |
+ |
+ @override |
+ final ResolveResult result; |
+ |
+ /** |
+ * Initialize a newly create request with the given data. |
+ */ |
+ DartHighlightsRequestImpl(this.resourceProvider, this.result); |
+ |
+ @override |
+ String get path => result.path; |
+} |
+ |
+/** |
+ * A concrete implementation of [HighlightsCollector]. |
+ */ |
+class HighlightsCollectorImpl implements HighlightsCollector { |
+ /** |
+ * The regions that have been collected. |
+ */ |
+ List<HighlightRegion> regions = <HighlightRegion>[]; |
+ |
+ @override |
+ void addRange(SourceRange range, HighlightRegionType type) { |
+ regions.add(new HighlightRegion(type, range.offset, range.length)); |
+ } |
+ |
+ @override |
+ void addRegion(int offset, int length, HighlightRegionType type) { |
+ regions.add(new HighlightRegion(type, offset, length)); |
+ } |
+} |