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

Unified Diff: pkg/analysis_server/lib/src/edit/edit_domain.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 | « pkg/analysis_server/lib/src/domain_completion.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/edit/edit_domain.dart
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index 13d567c05ed136677dcf21a9227153bb601f3070..55f94fbc34bd5af4b882a7126dbe0a7ea93e75e2 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -152,12 +152,16 @@ class EditDomainHandler extends AbstractRequestHandler {
//
// Allow plugins to start computing assists.
//
- AnalysisDriver driver = server.getAnalysisDriver(file);
+ Map<PluginInfo, Future<plugin.Response>> pluginFutures;
plugin.EditGetAssistsParams requestParams =
new plugin.EditGetAssistsParams(file, offset, length);
- Map<PluginInfo, Future<plugin.Response>> pluginFutures = server
- .pluginManager
- .broadcastRequest(requestParams, contextRoot: driver.contextRoot);
+ AnalysisDriver driver = server.getAnalysisDriver(file);
+ if (driver == null) {
+ pluginFutures = <PluginInfo, Future<plugin.Response>>{};
+ } else {
+ pluginFutures = server.pluginManager
+ .broadcastRequest(requestParams, contextRoot: driver.contextRoot);
+ }
//
// Compute fixes associated with server-generated errors.
//
@@ -226,12 +230,16 @@ class EditDomainHandler extends AbstractRequestHandler {
//
// Allow plugins to start computing fixes.
//
- AnalysisDriver driver = server.getAnalysisDriver(file);
+ Map<PluginInfo, Future<plugin.Response>> pluginFutures;
plugin.EditGetFixesParams requestParams =
new plugin.EditGetFixesParams(file, offset);
- Map<PluginInfo, Future<plugin.Response>> pluginFutures = server
- .pluginManager
- .broadcastRequest(requestParams, contextRoot: driver.contextRoot);
+ AnalysisDriver driver = server.getAnalysisDriver(file);
+ if (driver == null) {
+ pluginFutures = <PluginInfo, Future<plugin.Response>>{};
+ } else {
+ pluginFutures = server.pluginManager
+ .broadcastRequest(requestParams, contextRoot: driver.contextRoot);
+ }
//
// Compute fixes associated with server-generated errors.
//
@@ -447,7 +455,7 @@ class EditDomainHandler extends AbstractRequestHandler {
List<engine.AnalysisError> errors;
if (server.options.enableNewAnalysisDriver) {
AnalysisDriver driver = server.getAnalysisDriver(file);
- ParseResult result = await driver.parseFile(file);
+ ParseResult result = await driver?.parseFile(file);
if (result == null) {
server.sendResponse(new Response.fileNotAnalyzed(request, file));
return;
« no previous file with comments | « pkg/analysis_server/lib/src/domain_completion.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698