| 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 import 'dart:io'; | 6 import 'dart:io'; |
| 7 import 'dart:math'; | 7 import 'dart:math'; |
| 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/plugin/server_plugin.dart'; | 10 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 /** | 243 /** |
| 244 * The name of the option used to cause instrumentation to also be written to | 244 * The name of the option used to cause instrumentation to also be written to |
| 245 * a local file. | 245 * a local file. |
| 246 */ | 246 */ |
| 247 static const String INSTRUMENTATION_LOG_FILE = "instrumentation-log-file"; | 247 static const String INSTRUMENTATION_LOG_FILE = "instrumentation-log-file"; |
| 248 | 248 |
| 249 /** | 249 /** |
| 250 * The name of the option used to specify if [print] should print to the | 250 * The name of the option used to specify if [print] should print to the |
| 251 * console instead of being intercepted. | 251 * console instead of being intercepted. |
| 252 */ | 252 */ |
| 253 static const String INTERNAL_DELAY_FREQUENCY = 'internal-delay-frequency'; | |
| 254 | |
| 255 /** | |
| 256 * The name of the option used to specify if [print] should print to the | |
| 257 * console instead of being intercepted. | |
| 258 */ | |
| 259 static const String INTERNAL_PRINT_TO_CONSOLE = "internal-print-to-console"; | 253 static const String INTERNAL_PRINT_TO_CONSOLE = "internal-print-to-console"; |
| 260 | 254 |
| 261 /** | 255 /** |
| 262 * The name of the option used to describe the new analysis driver logger. | 256 * The name of the option used to describe the new analysis driver logger. |
| 263 */ | 257 */ |
| 264 static const String NEW_ANALYSIS_DRIVER_LOG = 'new-analysis-driver-log'; | 258 static const String NEW_ANALYSIS_DRIVER_LOG = 'new-analysis-driver-log'; |
| 265 | 259 |
| 266 /** | 260 /** |
| 267 * The name of the option used to enable verbose Flutter completion code gener
ation. | 261 * The name of the option used to enable verbose Flutter completion code gener
ation. |
| 268 */ | 262 */ |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 * angular plugin until the official plugin API is finished. | 328 * angular plugin until the official plugin API is finished. |
| 335 */ | 329 */ |
| 336 AnalysisServer start(List<String> arguments) { | 330 AnalysisServer start(List<String> arguments) { |
| 337 CommandLineParser parser = _createArgParser(); | 331 CommandLineParser parser = _createArgParser(); |
| 338 ArgResults results = parser.parse(arguments, <String, String>{}); | 332 ArgResults results = parser.parse(arguments, <String, String>{}); |
| 339 if (results[HELP_OPTION]) { | 333 if (results[HELP_OPTION]) { |
| 340 _printUsage(parser.parser); | 334 _printUsage(parser.parser); |
| 341 return null; | 335 return null; |
| 342 } | 336 } |
| 343 | 337 |
| 344 // TODO (danrubel) Remove this workaround | |
| 345 // once the underlying VM and dart:io issue has been fixed. | |
| 346 if (results[INTERNAL_DELAY_FREQUENCY] != null) { | |
| 347 AnalysisServer.performOperationDelayFrequency = | |
| 348 int.parse(results[INTERNAL_DELAY_FREQUENCY], onError: (_) => 0); | |
| 349 } | |
| 350 | |
| 351 int port; | 338 int port; |
| 352 bool serve_http = false; | 339 bool serve_http = false; |
| 353 if (results[PORT_OPTION] != null) { | 340 if (results[PORT_OPTION] != null) { |
| 354 try { | 341 try { |
| 355 port = int.parse(results[PORT_OPTION]); | 342 port = int.parse(results[PORT_OPTION]); |
| 356 serve_http = true; | 343 serve_http = true; |
| 357 } on FormatException { | 344 } on FormatException { |
| 358 print('Invalid port number: ${results[PORT_OPTION]}'); | 345 print('Invalid port number: ${results[PORT_OPTION]}'); |
| 359 print(''); | 346 print(''); |
| 360 _printUsage(parser.parser); | 347 _printUsage(parser.parser); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 help: "enable sending `print` output to the console", | 520 help: "enable sending `print` output to the console", |
| 534 defaultsTo: false, | 521 defaultsTo: false, |
| 535 negatable: false); | 522 negatable: false); |
| 536 parser.addOption(NEW_ANALYSIS_DRIVER_LOG, | 523 parser.addOption(NEW_ANALYSIS_DRIVER_LOG, |
| 537 help: "set a destination for the new analysis driver's log"); | 524 help: "set a destination for the new analysis driver's log"); |
| 538 parser.addFlag(VERBOSE_FLUTTER_COMPLETIONS, | 525 parser.addFlag(VERBOSE_FLUTTER_COMPLETIONS, |
| 539 help: "enable verbose code completion for Flutter (experimental)"); | 526 help: "enable verbose code completion for Flutter (experimental)"); |
| 540 parser.addOption(PORT_OPTION, | 527 parser.addOption(PORT_OPTION, |
| 541 help: "the http diagnostic port on which the server provides" | 528 help: "the http diagnostic port on which the server provides" |
| 542 " status and performance information"); | 529 " status and performance information"); |
| 543 parser.addOption(INTERNAL_DELAY_FREQUENCY); | |
| 544 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); | 530 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); |
| 545 parser.addFlag(USE_ANALYSIS_HIGHLIGHT2, | 531 parser.addFlag(USE_ANALYSIS_HIGHLIGHT2, |
| 546 help: "enable version 2 of semantic highlight", | 532 help: "enable version 2 of semantic highlight", |
| 547 defaultsTo: false, | 533 defaultsTo: false, |
| 548 negatable: false); | 534 negatable: false); |
| 549 parser.addOption(FILE_READ_MODE, | 535 parser.addOption(FILE_READ_MODE, |
| 550 help: "an option for reading files (some clients normalize eol " | 536 help: "an option for reading files (some clients normalize eol " |
| 551 "characters, which make the file offset and range information " | 537 "characters, which make the file offset and range information " |
| 552 "incorrect)", | 538 "incorrect)", |
| 553 allowed: ["as-is", "normalize-eol-always"], | 539 allowed: ["as-is", "normalize-eol-always"], |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 | 623 |
| 638 _DiagnosticServerImpl(); | 624 _DiagnosticServerImpl(); |
| 639 | 625 |
| 640 @override | 626 @override |
| 641 Future<int> getServerPort() => httpServer.serveHttp(); | 627 Future<int> getServerPort() => httpServer.serveHttp(); |
| 642 | 628 |
| 643 Future startOnPort(int port) { | 629 Future startOnPort(int port) { |
| 644 return httpServer.serveHttp(port); | 630 return httpServer.serveHttp(port); |
| 645 } | 631 } |
| 646 } | 632 } |
| OLD | NEW |