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

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

Issue 3004613002: Add support for highlights notification (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/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));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698