| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/protocol/protocol.dart'; | 7 import 'package:analysis_server/protocol/protocol.dart'; |
| 8 import 'package:analysis_server/protocol/protocol_constants.dart'; | 8 import 'package:analysis_server/protocol/protocol_constants.dart'; |
| 9 import 'package:analysis_server/protocol/protocol_generated.dart' | 9 import 'package:analysis_server/protocol/protocol_generated.dart' |
| 10 hide AnalysisOptions; | 10 hide AnalysisOptions; |
| 11 import 'package:analysis_server/src/analysis_server.dart'; | 11 import 'package:analysis_server/src/analysis_server.dart'; |
| 12 import 'package:analysis_server/src/domain_analysis.dart'; | 12 import 'package:analysis_server/src/domain_analysis.dart'; |
| 13 import 'package:analysis_server/src/plugin/notification_manager.dart'; | 13 import 'package:analysis_server/src/plugin/notification_manager.dart'; |
| 14 import 'package:analysis_server/src/plugin/plugin_manager.dart'; | 14 import 'package:analysis_server/src/plugin/plugin_manager.dart'; |
| 15 import 'package:analysis_server/src/plugin/server_plugin.dart'; | |
| 16 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi
n.dart'; | |
| 17 import 'package:analyzer/context/context_root.dart' as analyzer; | 15 import 'package:analyzer/context/context_root.dart' as analyzer; |
| 18 import 'package:analyzer/file_system/file_system.dart'; | 16 import 'package:analyzer/file_system/file_system.dart'; |
| 19 import 'package:analyzer/file_system/memory_file_system.dart'; | 17 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 20 import 'package:analyzer/instrumentation/instrumentation.dart'; | 18 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 21 import 'package:analyzer/src/dart/analysis/driver.dart'; | 19 import 'package:analyzer/src/dart/analysis/driver.dart'; |
| 22 import 'package:analyzer/src/generated/engine.dart'; | 20 import 'package:analyzer/src/generated/engine.dart'; |
| 23 import 'package:analyzer/src/generated/sdk.dart'; | 21 import 'package:analyzer/src/generated/sdk.dart'; |
| 24 import 'package:analyzer_plugin/protocol/protocol.dart' as plugin; | 22 import 'package:analyzer_plugin/protocol/protocol.dart' as plugin; |
| 25 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; | 23 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; |
| 26 import 'package:analyzer_plugin/src/protocol/protocol_internal.dart' as plugin; | 24 import 'package:analyzer_plugin/src/protocol/protocol_internal.dart' as plugin; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 return path; | 96 return path; |
| 99 } | 97 } |
| 100 | 98 |
| 101 void addGeneralAnalysisSubscription(GeneralAnalysisService service) { | 99 void addGeneralAnalysisSubscription(GeneralAnalysisService service) { |
| 102 generalServices.add(service); | 100 generalServices.add(service); |
| 103 Request request = new AnalysisSetGeneralSubscriptionsParams(generalServices) | 101 Request request = new AnalysisSetGeneralSubscriptionsParams(generalServices) |
| 104 .toRequest('0'); | 102 .toRequest('0'); |
| 105 handleSuccessfulRequest(request); | 103 handleSuccessfulRequest(request); |
| 106 } | 104 } |
| 107 | 105 |
| 108 void addServerPlugins(List<Plugin> plugins) {} | |
| 109 | |
| 110 String addTestFile(String content) { | 106 String addTestFile(String content) { |
| 111 addFile(testFile, content); | 107 addFile(testFile, content); |
| 112 this.testCode = content; | 108 this.testCode = content; |
| 113 return testFile; | 109 return testFile; |
| 114 } | 110 } |
| 115 | 111 |
| 116 AnalysisServer createAnalysisServer() { | 112 AnalysisServer createAnalysisServer() { |
| 117 // | 113 // |
| 118 // Collect plugins | 114 // Collect plugins |
| 119 // | 115 // |
| 120 ServerPlugin serverPlugin = new ServerPlugin(); | |
| 121 List<Plugin> plugins = <Plugin>[]; | 116 List<Plugin> plugins = <Plugin>[]; |
| 122 plugins.addAll(AnalysisEngine.instance.requiredPlugins); | 117 plugins.addAll(AnalysisEngine.instance.requiredPlugins); |
| 123 plugins.add(serverPlugin); | |
| 124 plugins.add(dartCompletionPlugin); | |
| 125 addServerPlugins(plugins); | |
| 126 // | 118 // |
| 127 // Process plugins | 119 // Process plugins |
| 128 // | 120 // |
| 129 ExtensionManager manager = new ExtensionManager(); | 121 ExtensionManager manager = new ExtensionManager(); |
| 130 manager.processPlugins(plugins); | 122 manager.processPlugins(plugins); |
| 131 // | 123 // |
| 132 // Create an SDK in the mock file system. | 124 // Create an SDK in the mock file system. |
| 133 // | 125 // |
| 134 new MockSdk( | 126 new MockSdk( |
| 135 generateSummaryFiles: generateSummaryFiles, | 127 generateSummaryFiles: generateSummaryFiles, |
| 136 resourceProvider: resourceProvider); | 128 resourceProvider: resourceProvider); |
| 137 // | 129 // |
| 138 // Create server | 130 // Create server |
| 139 // | 131 // |
| 140 AnalysisServerOptions options = new AnalysisServerOptions(); | 132 AnalysisServerOptions options = new AnalysisServerOptions(); |
| 141 return new AnalysisServer( | 133 return new AnalysisServer( |
| 142 serverChannel, | 134 serverChannel, |
| 143 resourceProvider, | 135 resourceProvider, |
| 144 packageMapProvider, | 136 packageMapProvider, |
| 145 serverPlugin, | |
| 146 options, | 137 options, |
| 147 new DartSdkManager(resourceProvider.convertPath('/'), true), | 138 new DartSdkManager(resourceProvider.convertPath('/'), true), |
| 148 InstrumentationService.NULL_SERVICE); | 139 InstrumentationService.NULL_SERVICE); |
| 149 } | 140 } |
| 150 | 141 |
| 151 /** | 142 /** |
| 152 * Creates a project `/project`. | 143 * Creates a project `/project`. |
| 153 */ | 144 */ |
| 154 void createProject({Map<String, String> packageRoots}) { | 145 void createProject({Map<String, String> packageRoots}) { |
| 155 resourceProvider.newFolder(projectPath); | 146 resourceProvider.newFolder(projectPath); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 plugin.AnalysisUpdateContentParams params) { | 359 plugin.AnalysisUpdateContentParams params) { |
| 369 analysisUpdateContentParams = params; | 360 analysisUpdateContentParams = params; |
| 370 } | 361 } |
| 371 | 362 |
| 372 @override | 363 @override |
| 373 Future<List<Null>> stopAll() async { | 364 Future<List<Null>> stopAll() async { |
| 374 fail('Unexpected invocation of stopAll'); | 365 fail('Unexpected invocation of stopAll'); |
| 375 return null; | 366 return null; |
| 376 } | 367 } |
| 377 } | 368 } |
| OLD | NEW |