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

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

Issue 2844413002: Guard against files that are not being analyzed (issue 29493) (Closed)
Patch Set: Created 3 years, 8 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/lib/src/edit/edit_domain.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 efaa1d9b50d327fe474b8f0b034066d84826af3c..682615be5b9c258179d8a1aac7798d6ccecb14a3 100644
--- a/pkg/analysis_server/lib/src/domain_completion.dart
+++ b/pkg/analysis_server/lib/src/domain_completion.dart
@@ -83,9 +83,11 @@ class CompletionDomainHandler extends AbstractRequestHandler {
String file = params.file;
int offset = params.offset;
AnalysisDriver driver = server.getAnalysisDriver(file);
- requestParams = new plugin.CompletionGetSuggestionsParams(file, offset);
- pluginFutures = server.pluginManager
- .broadcastRequest(requestParams, contextRoot: driver.contextRoot);
+ if (driver != null) {
+ requestParams = new plugin.CompletionGetSuggestionsParams(file, offset);
+ pluginFutures = server.pluginManager
+ .broadcastRequest(requestParams, contextRoot: driver.contextRoot);
+ }
}
//
// Compute completions generated by server.
@@ -154,6 +156,12 @@ class CompletionDomainHandler extends AbstractRequestHandler {
});
}
+ void ifMatchesRequestClear(CompletionRequest completionRequest) {
+ if (_currentRequest == completionRequest) {
+ _currentRequest = null;
+ }
+ }
+
/**
* Process a `completion.getSuggestions` request.
*/
@@ -253,17 +261,6 @@ class CompletionDomainHandler extends AbstractRequestHandler {
});
}
- void setNewRequest(CompletionRequest completionRequest) {
- _abortCurrentRequest();
- _currentRequest = completionRequest;
- }
-
- void ifMatchesRequestClear(CompletionRequest completionRequest) {
- if (_currentRequest == completionRequest) {
- _currentRequest = null;
- }
- }
-
/**
* If tracking code completion performance over time, then
* record addition information about the request in the performance record.
@@ -295,6 +292,11 @@ class CompletionDomainHandler extends AbstractRequestHandler {
.toNotification());
}
+ void setNewRequest(CompletionRequest completionRequest) {
+ _abortCurrentRequest();
+ _currentRequest = completionRequest;
+ }
+
/**
* Abort the current completion request, if any.
*/
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/edit/edit_domain.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698