| 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 library socket.server; | 5 library socket.server; |
| 6 | 6 |
| 7 import 'dart:io' as io; | 7 import 'dart:io' as io; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
| 10 import 'package:analysis_server/src/channel.dart'; | 10 import 'package:analysis_server/src/channel.dart'; |
| 11 import 'package:analysis_server/src/domain_analysis.dart'; | 11 import 'package:analysis_server/src/domain_analysis.dart'; |
| 12 import 'package:analysis_server/src/domain_completion.dart'; | 12 import 'package:analysis_server/src/domain_completion.dart'; |
| 13 import 'package:analysis_server/src/domain_edit.dart'; | 13 import 'package:analysis_server/src/domain_edit.dart'; |
| 14 import 'package:analysis_server/src/domain_search.dart'; | 14 import 'package:analysis_server/src/domain_search.dart'; |
| 15 import 'package:analysis_server/src/domain_server.dart'; | 15 import 'package:analysis_server/src/domain_server.dart'; |
| 16 import 'package:analysis_server/src/package_map_provider.dart'; | 16 import 'package:analysis_server/src/package_map_provider.dart'; |
| 17 import 'package:analysis_server/src/protocol.dart'; | 17 import 'package:analysis_server/src/protocol.dart'; |
| 18 import 'package:analyzer/file_system/physical_file_system.dart'; | 18 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 19 import 'package:analyzer/index/index.dart'; | |
| 20 import 'package:analyzer/src/index/local_index.dart'; | |
| 21 import 'package:path/path.dart' as pathos; | 19 import 'package:path/path.dart' as pathos; |
| 20 import 'package:analysis_services/index/index.dart'; |
| 21 import 'package:analysis_services/index/local_file_index.dart'; |
| 22 | 22 |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * Creates and runs an [Index]. | 25 * Creates and runs an [Index]. |
| 26 */ | 26 */ |
| 27 Index _createIndex() { | 27 Index _createIndex() { |
| 28 String tempPath = io.Directory.systemTemp.path; | 28 String tempPath = io.Directory.systemTemp.path; |
| 29 String indexPath = pathos.join(tempPath, 'AnalysisServer_index'); | 29 String indexPath = pathos.join(tempPath, 'AnalysisServer_index'); |
| 30 io.Directory indexDirectory = new io.Directory(indexPath); | 30 io.Directory indexDirectory = new io.Directory(indexPath); |
| 31 if (indexDirectory.existsSync()) { | 31 if (indexDirectory.existsSync()) { |
| 32 indexDirectory.deleteSync(recursive: true); | 32 indexDirectory.deleteSync(recursive: true); |
| 33 } | 33 } |
| 34 if (!indexDirectory.existsSync()) { | 34 if (!indexDirectory.existsSync()) { |
| 35 indexDirectory.createSync(); | 35 indexDirectory.createSync(); |
| 36 } | 36 } |
| 37 Index index = createLocalFileSplitIndex(indexDirectory); | 37 Index index = createLocalFileIndex(indexDirectory); |
| 38 index.run(); | 38 index.run(); |
| 39 return index; | 39 return index; |
| 40 } | 40 } |
| 41 | 41 |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * Instances of the class [SocketServer] implement the common parts of | 44 * Instances of the class [SocketServer] implement the common parts of |
| 45 * http-based and stdio-based analysis servers. The primary responsibility of | 45 * http-based and stdio-based analysis servers. The primary responsibility of |
| 46 * the SocketServer is to manage the lifetime of the AnalysisServer and to | 46 * the SocketServer is to manage the lifetime of the AnalysisServer and to |
| 47 * encode and decode the JSON messages exchanged with the client. | 47 * encode and decode the JSON messages exchanged with the client. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 void _initializeHandlers(AnalysisServer server) { | 82 void _initializeHandlers(AnalysisServer server) { |
| 83 server.handlers = [ | 83 server.handlers = [ |
| 84 new ServerDomainHandler(server), | 84 new ServerDomainHandler(server), |
| 85 new AnalysisDomainHandler(server), | 85 new AnalysisDomainHandler(server), |
| 86 new EditDomainHandler(server), | 86 new EditDomainHandler(server), |
| 87 new SearchDomainHandler(server), | 87 new SearchDomainHandler(server), |
| 88 new CompletionDomainHandler(server), | 88 new CompletionDomainHandler(server), |
| 89 ]; | 89 ]; |
| 90 } | 90 } |
| 91 } | 91 } |
| OLD | NEW |