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

Unified Diff: pkg/analysis_server/lib/src/provisional/completion/completion_core.dart

Issue 1685653002: abort completion request - fixes #24271 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address comment Created 4 years, 10 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/analysis_server/lib/src/provisional/completion/completion_core.dart
diff --git a/pkg/analysis_server/lib/src/provisional/completion/completion_core.dart b/pkg/analysis_server/lib/src/provisional/completion/completion_core.dart
index 9a585dd35a39cbc8c1d9817ea5964c443d5bbc40..1aa1c9f182d5179c609b940309ac583e4e18772b 100644
--- a/pkg/analysis_server/lib/src/provisional/completion/completion_core.dart
+++ b/pkg/analysis_server/lib/src/provisional/completion/completion_core.dart
@@ -26,6 +26,14 @@ const EMPTY_LIST = const <CompletionSuggestion>[];
typedef CompletionContributor CompletionContributorFactory();
/**
+ * [AbortCompletion] is thrown when the current completion request
+ * should be aborted because either
+ * the source changed since the request was made, or
+ * a new completion request was received.
+ */
+class AbortCompletion {}
+
+/**
* An object used to produce completions at a specific location within a file.
*
* Clients may implement this class when implementing plugins.
@@ -33,7 +41,8 @@ typedef CompletionContributor CompletionContributorFactory();
abstract class CompletionContributor {
/**
* Return a [Future] that completes with a list of suggestions
- * for the given completion [request].
+ * for the given completion [request]. This will
+ * throw [AbortCompletion] if the completion request has been aborted.
*/
Future<List<CompletionSuggestion>> computeSuggestions(
CompletionRequest request);
@@ -70,4 +79,9 @@ abstract class CompletionRequest {
* Return the source in which the completion is being requested.
*/
Source get source;
+
+ /**
+ * Throw [AbortCompletion] if the completion request has been aborted.
+ */
+ void checkAborted();
}

Powered by Google App Engine
This is Rietveld 408576698