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

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

Issue 2924063002: Add support for implementing getAssists in plugins (Closed)
Patch Set: Created 3 years, 6 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/assist/assist.dart
diff --git a/pkg/analyzer_plugin/lib/src/utilities/assist/assist.dart b/pkg/analyzer_plugin/lib/src/utilities/assist/assist.dart
new file mode 100644
index 0000000000000000000000000000000000000000..79cdfffc6e9a48257b0b371feb017b8d67ae3d18
--- /dev/null
+++ b/pkg/analyzer_plugin/lib/src/utilities/assist/assist.dart
@@ -0,0 +1,46 @@
+// 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_plugin/protocol/protocol_generated.dart';
+import 'package:analyzer_plugin/utilities/assist/assist.dart';
+
+/**
+ * A concrete implementation of [AssistCollector].
+ */
+class AssistCollectorImpl implements AssistCollector {
+ /**
+ * The list of assists that have been collected.
+ */
+ final List<PrioritizedSourceChange> assists = <PrioritizedSourceChange>[];
+
+ @override
+ void addAssist(PrioritizedSourceChange assist) {
+ assists.add(assist);
+ }
+}
+
+/**
+ * A concrete implementation of [AssistRequest].
+ */
+class AssistRequestImpl implements AssistRequest {
+ @override
+ final ResourceProvider resourceProvider;
+
+ @override
+ final int offset;
+
+ @override
+ final int length;
+
+ @override
+ final ResolveResult result;
+
+ /**
+ * Initialize a newly create request with the given data.
+ */
+ AssistRequestImpl(
+ this.resourceProvider, this.offset, this.length, this.result);
+}

Powered by Google App Engine
This is Rietveld 408576698