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

Unified Diff: pkg/analysis_server/lib/src/domain_completion.dart

Issue 939823002: Return RequestErrorCode.NO_INDEX_GENERATED if no index. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/domain_completion_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/domain_completion.dart
diff --git a/pkg/analysis_server/lib/src/domain_completion.dart b/pkg/analysis_server/lib/src/domain_completion.dart
index e1ef9fc5e492ea41ae6162a1d31db7d4d35e4487..a69dbb14a5705f7521fa8bd6b41baf7bbf301183 100644
--- a/pkg/analysis_server/lib/src/domain_completion.dart
+++ b/pkg/analysis_server/lib/src/domain_completion.dart
@@ -28,6 +28,11 @@ class CompletionDomainHandler implements RequestHandler {
final AnalysisServer server;
/**
+ * The [SearchEngine] for this server.
+ */
+ SearchEngine searchEngine;
+
+ /**
* The next completion response id.
*/
int _nextCompletionId = 0;
@@ -71,6 +76,7 @@ class CompletionDomainHandler implements RequestHandler {
CompletionDomainHandler(this.server) {
server.onContextsChanged.listen(contextsChanged);
server.onPriorityChange.listen(priorityChanged);
+ searchEngine = server.searchEngine;
}
/**
@@ -91,7 +97,7 @@ class CompletionDomainHandler implements RequestHandler {
}
_discardManager();
}
- _manager = createCompletionManager(context, source, server.searchEngine);
+ _manager = createCompletionManager(context, source, searchEngine);
if (context != null) {
_sourcesChangedSubscription =
context.onSourcesChanged.listen(sourcesChanged);
@@ -119,6 +125,9 @@ class CompletionDomainHandler implements RequestHandler {
@override
Response handleRequest(Request request) {
+ if (searchEngine == null) {
+ return new Response.noIndexGenerated(request);
+ }
try {
String requestName = request.method;
if (requestName == COMPLETION_GET_SUGGESTIONS) {
« no previous file with comments | « no previous file | pkg/analysis_server/test/domain_completion_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698