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 driver; | 5 library driver; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'dart:math'; | 9 import 'dart:math'; |
10 | 10 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 /** | 285 /** |
286 * The name of the flag used to disable the index. | 286 * The name of the flag used to disable the index. |
287 */ | 287 */ |
288 static const String NO_INDEX = "no-index"; | 288 static const String NO_INDEX = "no-index"; |
289 | 289 |
290 /** | 290 /** |
291 * The name of the flag used to enable version 2 of semantic highlight | 291 * The name of the flag used to enable version 2 of semantic highlight |
292 * notification. | 292 * notification. |
293 */ | 293 */ |
294 static const String USE_ANALISYS_HIGHLIGHT2 = "useAnalysisHighlight2"; | 294 static const String USE_ANALYSIS_HIGHLIGHT2 = "useAnalysisHighlight2"; |
295 | 295 |
296 /** | 296 /** |
297 * The option for specifying the http diagnostic port. | 297 * The option for specifying the http diagnostic port. |
298 * If specified, users can review server status and performance information | 298 * If specified, users can review server status and performance information |
299 * by opening a web browser on http://localhost:<port> | 299 * by opening a web browser on http://localhost:<port> |
300 */ | 300 */ |
301 static const String PORT_OPTION = "port"; | 301 static const String PORT_OPTION = "port"; |
302 | 302 |
303 /** | 303 /** |
304 * The path to the SDK. | 304 * The path to the SDK. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 analysisServerOptions.enableIncrementalResolutionApi = | 393 analysisServerOptions.enableIncrementalResolutionApi = |
394 results[ENABLE_INCREMENTAL_RESOLUTION_API]; | 394 results[ENABLE_INCREMENTAL_RESOLUTION_API]; |
395 analysisServerOptions.enableIncrementalResolutionValidation = | 395 analysisServerOptions.enableIncrementalResolutionValidation = |
396 results[INCREMENTAL_RESOLUTION_VALIDATION]; | 396 results[INCREMENTAL_RESOLUTION_VALIDATION]; |
397 analysisServerOptions.enableNewAnalysisDriver = | 397 analysisServerOptions.enableNewAnalysisDriver = |
398 !results[DISABLE_NEW_ANALYSIS_DRIVER]; | 398 !results[DISABLE_NEW_ANALYSIS_DRIVER]; |
399 analysisServerOptions.finerGrainedInvalidation = | 399 analysisServerOptions.finerGrainedInvalidation = |
400 results[FINER_GRAINED_INVALIDATION]; | 400 results[FINER_GRAINED_INVALIDATION]; |
401 analysisServerOptions.noIndex = results[NO_INDEX]; | 401 analysisServerOptions.noIndex = results[NO_INDEX]; |
402 analysisServerOptions.useAnalysisHighlight2 = | 402 analysisServerOptions.useAnalysisHighlight2 = |
403 results[USE_ANALISYS_HIGHLIGHT2]; | 403 results[USE_ANALYSIS_HIGHLIGHT2]; |
404 analysisServerOptions.fileReadMode = results[FILE_READ_MODE]; | 404 analysisServerOptions.fileReadMode = results[FILE_READ_MODE]; |
405 analysisServerOptions.newAnalysisDriverLog = | 405 analysisServerOptions.newAnalysisDriverLog = |
406 results[NEW_ANALYSIS_DRIVER_LOG]; | 406 results[NEW_ANALYSIS_DRIVER_LOG]; |
407 analysisServerOptions.enableVerboseFlutterCompletions = | 407 analysisServerOptions.enableVerboseFlutterCompletions = |
408 results[VERBOSE_FLUTTER_COMPLETIONS]; | 408 results[VERBOSE_FLUTTER_COMPLETIONS]; |
409 | 409 |
410 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); | 410 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); |
411 | 411 |
412 // | 412 // |
413 // Process all of the plugins so that extensions are registered. | 413 // Process all of the plugins so that extensions are registered. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 help: "set a destination for the new analysis driver's log"); | 574 help: "set a destination for the new analysis driver's log"); |
575 parser.addOption(VERBOSE_FLUTTER_COMPLETIONS, | 575 parser.addOption(VERBOSE_FLUTTER_COMPLETIONS, |
576 help: "enable verbose code completion for Flutter (experimental)"); | 576 help: "enable verbose code completion for Flutter (experimental)"); |
577 parser.addOption(PORT_OPTION, | 577 parser.addOption(PORT_OPTION, |
578 help: "the http diagnostic port on which the server provides" | 578 help: "the http diagnostic port on which the server provides" |
579 " status and performance information"); | 579 " status and performance information"); |
580 parser.addOption(INTERNAL_DELAY_FREQUENCY); | 580 parser.addOption(INTERNAL_DELAY_FREQUENCY); |
581 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); | 581 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); |
582 parser.addFlag(NO_INDEX, | 582 parser.addFlag(NO_INDEX, |
583 help: "disable indexing sources", defaultsTo: false, negatable: false); | 583 help: "disable indexing sources", defaultsTo: false, negatable: false); |
584 parser.addFlag(USE_ANALISYS_HIGHLIGHT2, | 584 parser.addFlag(USE_ANALYSIS_HIGHLIGHT2, |
585 help: "enable version 2 of semantic highlight", | 585 help: "enable version 2 of semantic highlight", |
586 defaultsTo: false, | 586 defaultsTo: false, |
587 negatable: false); | 587 negatable: false); |
588 parser.addOption(FILE_READ_MODE, | 588 parser.addOption(FILE_READ_MODE, |
589 help: "an option of the ways files can be read from disk, " + | 589 help: "an option for reading files (some clients normalize eol " |
590 "some clients normalize end of line characters which would make " + | 590 "characters, which make the file offset and range information " |
591 "the file offset and range information incorrect.", | 591 "incorrect)", |
592 allowed: ["as-is", "normalize-eol-always"], | 592 allowed: ["as-is", "normalize-eol-always"], |
593 allowedHelp: { | 593 allowedHelp: { |
594 "as-is": "file contents are read as-is, no file changes occur", | 594 "as-is": "file contents are read as-is", |
595 "normalize-eol-always": | 595 "normalize-eol-always": |
596 r'file contents normalize the end of line characters to the single
character new line `\n`' | 596 r"eol characters normalized to the single character new line ('\n'
)" |
597 }, | 597 }, |
598 defaultsTo: "as-is"); | 598 defaultsTo: "as-is"); |
599 | 599 |
600 return parser; | 600 return parser; |
601 } | 601 } |
602 | 602 |
603 DartSdk _createDefaultSdk(String defaultSdkPath, bool useSummaries) { | 603 DartSdk _createDefaultSdk(String defaultSdkPath, bool useSummaries) { |
604 PhysicalResourceProvider resourceProvider = | 604 PhysicalResourceProvider resourceProvider = |
605 PhysicalResourceProvider.INSTANCE; | 605 PhysicalResourceProvider.INSTANCE; |
606 FolderBasedDartSdk sdk = new FolderBasedDartSdk( | 606 FolderBasedDartSdk sdk = new FolderBasedDartSdk( |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 | 676 |
677 _DiagnosticServerImpl(); | 677 _DiagnosticServerImpl(); |
678 | 678 |
679 @override | 679 @override |
680 Future<int> getServerPort() => httpServer.serveHttp(); | 680 Future<int> getServerPort() => httpServer.serveHttp(); |
681 | 681 |
682 Future startOnPort(int port) { | 682 Future startOnPort(int port) { |
683 return httpServer.serveHttp(port); | 683 return httpServer.serveHttp(port); |
684 } | 684 } |
685 } | 685 } |
OLD | NEW |