| 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'; |
| 11 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi
n.dart'; | 11 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi
n.dart'; |
| 12 import 'package:analysis_server/src/server/diagnostic_server.dart'; | 12 import 'package:analysis_server/src/server/diagnostic_server.dart'; |
| 13 import 'package:analysis_server/src/server/http_server.dart'; | 13 import 'package:analysis_server/src/server/http_server.dart'; |
| 14 import 'package:analysis_server/src/server/stdio_server.dart'; | 14 import 'package:analysis_server/src/server/stdio_server.dart'; |
| 15 import 'package:analysis_server/src/services/completion/dart/uri_contributor.dar
t' |
| 16 show UriContributor; |
| 15 import 'package:analysis_server/src/socket_server.dart'; | 17 import 'package:analysis_server/src/socket_server.dart'; |
| 16 import 'package:analysis_server/starter.dart'; | 18 import 'package:analysis_server/starter.dart'; |
| 17 import 'package:analyzer/file_system/physical_file_system.dart'; | 19 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 18 import 'package:analyzer/instrumentation/file_instrumentation.dart'; | 20 import 'package:analyzer/instrumentation/file_instrumentation.dart'; |
| 19 import 'package:analyzer/instrumentation/instrumentation.dart'; | 21 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 20 import 'package:analyzer/plugin/resolver_provider.dart'; | 22 import 'package:analyzer/plugin/resolver_provider.dart'; |
| 21 import 'package:analyzer/src/context/builder.dart'; | 23 import 'package:analyzer/src/context/builder.dart'; |
| 22 import 'package:analyzer/src/dart/sdk/sdk.dart'; | 24 import 'package:analyzer/src/dart/sdk/sdk.dart'; |
| 23 import 'package:analyzer/src/generated/engine.dart'; | 25 import 'package:analyzer/src/generated/engine.dart'; |
| 24 import 'package:analyzer/src/generated/sdk.dart'; | 26 import 'package:analyzer/src/generated/sdk.dart'; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 * The name of the option used to set the identifier for the client. | 182 * The name of the option used to set the identifier for the client. |
| 181 */ | 183 */ |
| 182 static const String CLIENT_ID = "client-id"; | 184 static const String CLIENT_ID = "client-id"; |
| 183 | 185 |
| 184 /** | 186 /** |
| 185 * The name of the option used to set the version for the client. | 187 * The name of the option used to set the version for the client. |
| 186 */ | 188 */ |
| 187 static const String CLIENT_VERSION = "client-version"; | 189 static const String CLIENT_VERSION = "client-version"; |
| 188 | 190 |
| 189 /** | 191 /** |
| 192 * The name of the option used to enable DartPad specific functionality. |
| 193 */ |
| 194 static const String DARTPAD_OPTION = "dartpad"; |
| 195 |
| 196 /** |
| 190 * The name of the option used to enable instrumentation. | 197 * The name of the option used to enable instrumentation. |
| 191 */ | 198 */ |
| 192 static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation"; | 199 static const String ENABLE_INSTRUMENTATION_OPTION = "enable-instrumentation"; |
| 193 | 200 |
| 194 /** | 201 /** |
| 195 * The name of the option used to set the file read mode. | 202 * The name of the option used to set the file read mode. |
| 196 */ | 203 */ |
| 197 static const String FILE_READ_MODE = "file-read-mode"; | 204 static const String FILE_READ_MODE = "file-read-mode"; |
| 198 | 205 |
| 199 /** | 206 /** |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 // TODO(devoncarew): Replace with the real crash product ID. | 334 // TODO(devoncarew): Replace with the real crash product ID. |
| 328 analysisServerOptions.crashReportSender = | 335 analysisServerOptions.crashReportSender = |
| 329 new CrashReportSender('Dart_analysis_server', analytics); | 336 new CrashReportSender('Dart_analysis_server', analytics); |
| 330 | 337 |
| 331 if (results.wasParsed(ANALYTICS_FLAG)) { | 338 if (results.wasParsed(ANALYTICS_FLAG)) { |
| 332 analytics.enabled = results[ANALYTICS_FLAG]; | 339 analytics.enabled = results[ANALYTICS_FLAG]; |
| 333 print(telemetry.createAnalyticsStatusMessage(analytics.enabled)); | 340 print(telemetry.createAnalyticsStatusMessage(analytics.enabled)); |
| 334 return null; | 341 return null; |
| 335 } | 342 } |
| 336 | 343 |
| 344 if (results[DARTPAD_OPTION]) { |
| 345 UriContributor.suggestFilePaths = false; |
| 346 } |
| 347 |
| 337 if (results[HELP_OPTION]) { | 348 if (results[HELP_OPTION]) { |
| 338 _printUsage(parser.parser, analytics, fromHelp: true); | 349 _printUsage(parser.parser, analytics, fromHelp: true); |
| 339 return null; | 350 return null; |
| 340 } | 351 } |
| 341 | 352 |
| 342 int port; | 353 int port; |
| 343 bool serve_http = false; | 354 bool serve_http = false; |
| 344 if (results[PORT_OPTION] != null) { | 355 if (results[PORT_OPTION] != null) { |
| 345 try { | 356 try { |
| 346 port = int.parse(results[PORT_OPTION]); | 357 port = int.parse(results[PORT_OPTION]); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 | 486 |
| 476 /** | 487 /** |
| 477 * Create and return the parser used to parse the command-line arguments. | 488 * Create and return the parser used to parse the command-line arguments. |
| 478 */ | 489 */ |
| 479 CommandLineParser _createArgParser() { | 490 CommandLineParser _createArgParser() { |
| 480 CommandLineParser parser = | 491 CommandLineParser parser = |
| 481 new CommandLineParser(alwaysIgnoreUnrecognized: true); | 492 new CommandLineParser(alwaysIgnoreUnrecognized: true); |
| 482 parser.addOption(CLIENT_ID, | 493 parser.addOption(CLIENT_ID, |
| 483 help: "an identifier used to identify the client"); | 494 help: "an identifier used to identify the client"); |
| 484 parser.addOption(CLIENT_VERSION, help: "the version of the client"); | 495 parser.addOption(CLIENT_VERSION, help: "the version of the client"); |
| 496 parser.addFlag(DARTPAD_OPTION, |
| 497 help: 'enable DartPad specific functionality', |
| 498 defaultsTo: false, |
| 499 hide: true); |
| 485 parser.addFlag(ENABLE_INSTRUMENTATION_OPTION, | 500 parser.addFlag(ENABLE_INSTRUMENTATION_OPTION, |
| 486 help: "enable sending instrumentation information to a server", | 501 help: "enable sending instrumentation information to a server", |
| 487 defaultsTo: false, | 502 defaultsTo: false, |
| 488 negatable: false); | 503 negatable: false); |
| 489 parser.addFlag(FLUTTER_REPO, | 504 parser.addFlag(FLUTTER_REPO, |
| 490 help: 'used by "flutter analyze" to enable specific lints' | 505 help: 'used by "flutter analyze" to enable specific lints' |
| 491 ' when analyzing the flutter repository', | 506 ' when analyzing the flutter repository', |
| 492 hide: false); | 507 hide: false); |
| 493 parser.addFlag(HELP_OPTION, | 508 parser.addFlag(HELP_OPTION, |
| 494 help: "print this help message without starting a server", | 509 help: "print this help message without starting a server", |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 631 |
| 617 _DiagnosticServerImpl(); | 632 _DiagnosticServerImpl(); |
| 618 | 633 |
| 619 @override | 634 @override |
| 620 Future<int> getServerPort() => httpServer.serveHttp(); | 635 Future<int> getServerPort() => httpServer.serveHttp(); |
| 621 | 636 |
| 622 Future startOnPort(int port) { | 637 Future startOnPort(int port) { |
| 623 return httpServer.serveHttp(port); | 638 return httpServer.serveHttp(port); |
| 624 } | 639 } |
| 625 } | 640 } |
| OLD | NEW |