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

Unified Diff: pkg/analysis_server/lib/plugin/edit/assist/assist_core.dart

Issue 1461343002: Make AssistContributor asynchronous. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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/analysis_server/lib/plugin/edit/assist/assist_core.dart
diff --git a/pkg/analysis_server/lib/plugin/edit/assist/assist_core.dart b/pkg/analysis_server/lib/plugin/edit/assist/assist_core.dart
index d4903e6a9273bdd058d646baae677586ad2b1452..14bdcb3df2635e2dded99147548dae68d5a118bc 100644
--- a/pkg/analysis_server/lib/plugin/edit/assist/assist_core.dart
+++ b/pkg/analysis_server/lib/plugin/edit/assist/assist_core.dart
@@ -4,6 +4,8 @@
library analysis_server.plugin.edit.assist.assist_core;
+import 'dart:async';
+
import 'package:analysis_server/plugin/protocol/protocol.dart'
show SourceChange;
import 'package:analyzer/src/generated/engine.dart';
@@ -50,19 +52,42 @@ class Assist {
}
/**
+ * An object used to provide context information for [AssistContributor]s.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class AssistContext {
+ /**
+ * The [AnalysisContext] to get assists in.
+ */
+ AnalysisContext get analysisContext;
+
+ /**
+ * The length of the selection.
+ */
+ int get selectionLength;
+
+ /**
+ * The start of the selection.
+ */
+ int get selectionOffset;
+
+ /**
+ * The source to get assists in.
+ */
+ Source get source;
+}
+
+/**
* An object used to produce assists for a specific location.
*
* Clients may implement this class when implementing plugins.
*/
abstract class AssistContributor {
/**
- * Return a list of assists for a location in the given [source]. The location
- * is specified by the [offset] and [length] of the selected region. The
- * [context] can be used to get additional information that is useful for
- * computing assists.
+ * Completes with a list of assists for the given [context].
*/
- List<Assist> computeAssists(
- AnalysisContext context, Source source, int offset, int length);
+ Future<List<Assist>> computeAssists(AssistContext context);
}
/**

Powered by Google App Engine
This is Rietveld 408576698