Chromium Code Reviews| 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 2d94108ee0c91cba8af18011257fd50858a69169..e87bc75bf87712a03119265bb8548966f8715a08 100644 |
| --- a/pkg/analysis_server/lib/src/edit/edit_domain.dart |
| +++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart |
| @@ -2,8 +2,6 @@ |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| -library edit.domain; |
| - |
| import 'dart:async'; |
| import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; |
| @@ -13,6 +11,9 @@ import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; |
| import 'package:analysis_server/src/analysis_server.dart'; |
| import 'package:analysis_server/src/collections.dart'; |
| import 'package:analysis_server/src/constants.dart'; |
| +import 'package:analysis_server/src/domain_abstract.dart'; |
| +import 'package:analysis_server/src/plugin/plugin_manager.dart'; |
| +import 'package:analysis_server/src/plugin/result_converter.dart'; |
| import 'package:analysis_server/src/protocol_server.dart' hide Element; |
| import 'package:analysis_server/src/services/completion/statement/statement_completion.dart'; |
| import 'package:analysis_server/src/services/correction/assist.dart'; |
| @@ -37,6 +38,9 @@ import 'package:analyzer/src/generated/engine.dart' as engine; |
| import 'package:analyzer/src/generated/parser.dart' as engine; |
| import 'package:analyzer/src/generated/source.dart'; |
| import 'package:analyzer/task/dart.dart'; |
| +import 'package:analyzer_plugin/protocol/protocol.dart' as plugin; |
| +import 'package:analyzer_plugin/protocol/protocol_constants.dart' as plugin; |
| +import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; |
| import 'package:dart_style/dart_style.dart'; |
| int test_resetCount = 0; |
| @@ -53,23 +57,21 @@ bool test_simulateRefactoringReset_afterInitialConditions = false; |
| * Instances of the class [EditDomainHandler] implement a [RequestHandler] |
| * that handles requests in the edit domain. |
| */ |
| -class EditDomainHandler implements RequestHandler { |
| - /** |
| - * The analysis server that is using this handler to process requests. |
| - */ |
| - final AnalysisServer server; |
| - |
| +class EditDomainHandler extends AbstractRequestHandler { |
| /** |
| * The [SearchEngine] for this server. |
| */ |
| SearchEngine searchEngine; |
| + /** |
| + * The object used to manage uncompleted refactorings. |
| + */ |
| _RefactoringManager refactoringManager; |
| /** |
| * Initialize a newly created handler to handle requests for the given [server]. |
| */ |
| - EditDomainHandler(this.server) { |
| + EditDomainHandler(AnalysisServer server) : super(server) { |
| searchEngine = server.searchEngine; |
| _newRefactoringManager(); |
| } |
| @@ -185,6 +187,11 @@ class EditDomainHandler implements RequestHandler { |
| List<AnalysisErrorFixes> errorFixesList = <AnalysisErrorFixes>[]; |
| if (server.options.enableNewAnalysisDriver) { |
| + AnalysisDriver driver = server.getAnalysisDriver(file); |
| + plugin.EditGetFixesParams pluginParams = |
| + new plugin.EditGetFixesParams(file, offset); |
| + Map<PluginInfo, Future<plugin.Response>> pluginFutures = |
| + server.pluginManager.broadcast(driver.contextRoot, pluginParams); |
|
scheglov
2017/04/19 20:19:04
Could you instead an empty line here?
Brian Wilkerson
2017/04/19 20:52:48
I'm adding comments instead.
|
| AnalysisResult result = await server.getAnalysisResult(file); |
| if (result != null) { |
| CompilationUnit unit = result.unit; |
| @@ -216,6 +223,14 @@ class EditDomainHandler implements RequestHandler { |
| } |
| } |
| } |
|
scheglov
2017/04/19 20:19:04
Could you instead an empty line here?
Brian Wilkerson
2017/04/19 20:52:48
I'm adding comments instead.
|
| + List<plugin.Response> responses = await waitForResponses(pluginFutures); |
| + ResultConverter converter = new ResultConverter(); |
| + for (plugin.Response response in responses) { |
| + plugin.EditGetFixesResult result = |
| + new plugin.EditGetFixesResult.fromResponse(response); |
| + errorFixesList.addAll(result.fixes |
| + .map((fixes) => converter.convertAnalysisErrorFixes(fixes))); |
|
scheglov
2017/04/19 20:19:04
You could just pass converter.convertAnalysisError
Brian Wilkerson
2017/04/19 20:52:48
Done
|
| + } |
| } else { |
| CompilationUnit unit = await server.getResolvedCompilationUnit(file); |
| engine.AnalysisErrorInfo errorInfo = server.getErrors(file); |