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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 * The name of the flag used to disable error notifications. | 259 * The name of the flag used to disable error notifications. |
260 */ | 260 */ |
261 static const String NO_ERROR_NOTIFICATION = "no-error-notification"; | 261 static const String NO_ERROR_NOTIFICATION = "no-error-notification"; |
262 | 262 |
263 /** | 263 /** |
264 * The name of the flag used to disable the index. | 264 * The name of the flag used to disable the index. |
265 */ | 265 */ |
266 static const String NO_INDEX = "no-index"; | 266 static const String NO_INDEX = "no-index"; |
267 | 267 |
268 /** | 268 /** |
| 269 * The name of the flag used to enable version 2 of semantic highlight |
| 270 * notification. |
| 271 */ |
| 272 static const String USE_ANALISYS_HIGHLIGHT2 = "useAnalysisHighlight2"; |
| 273 |
| 274 /** |
269 * The option for specifying the http diagnostic port. | 275 * The option for specifying the http diagnostic port. |
270 * If specified, users can review server status and performance information | 276 * If specified, users can review server status and performance information |
271 * by opening a web browser on http://localhost:<port> | 277 * by opening a web browser on http://localhost:<port> |
272 */ | 278 */ |
273 static const String PORT_OPTION = "port"; | 279 static const String PORT_OPTION = "port"; |
274 | 280 |
275 /** | 281 /** |
276 * The path to the SDK. | 282 * The path to the SDK. |
277 * TODO(paulberry): get rid of this once the 'analysis.updateSdks' request is | 283 * TODO(paulberry): get rid of this once the 'analysis.updateSdks' request is |
278 * operational. | 284 * operational. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 } | 356 } |
351 } | 357 } |
352 | 358 |
353 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); | 359 AnalysisServerOptions analysisServerOptions = new AnalysisServerOptions(); |
354 analysisServerOptions.enableIncrementalResolutionApi = | 360 analysisServerOptions.enableIncrementalResolutionApi = |
355 results[ENABLE_INCREMENTAL_RESOLUTION_API]; | 361 results[ENABLE_INCREMENTAL_RESOLUTION_API]; |
356 analysisServerOptions.enableIncrementalResolutionValidation = | 362 analysisServerOptions.enableIncrementalResolutionValidation = |
357 results[INCREMENTAL_RESOLUTION_VALIDATION]; | 363 results[INCREMENTAL_RESOLUTION_VALIDATION]; |
358 analysisServerOptions.noErrorNotification = results[NO_ERROR_NOTIFICATION]; | 364 analysisServerOptions.noErrorNotification = results[NO_ERROR_NOTIFICATION]; |
359 analysisServerOptions.noIndex = results[NO_INDEX]; | 365 analysisServerOptions.noIndex = results[NO_INDEX]; |
| 366 analysisServerOptions.useAnalysisHighlight2 = |
| 367 results[USE_ANALISYS_HIGHLIGHT2]; |
360 analysisServerOptions.fileReadMode = results[FILE_READ_MODE]; | 368 analysisServerOptions.fileReadMode = results[FILE_READ_MODE]; |
361 | 369 |
362 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); | 370 _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]); |
363 | 371 |
364 DartSdk defaultSdk; | 372 DartSdk defaultSdk; |
365 if (results[SDK_OPTION] != null) { | 373 if (results[SDK_OPTION] != null) { |
366 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); | 374 defaultSdk = new DirectoryBasedDartSdk(new JavaFile(results[SDK_OPTION])); |
367 } else { | 375 } else { |
368 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, | 376 // No path to the SDK provided; use DirectoryBasedDartSdk.defaultSdk, |
369 // which will make a guess. | 377 // which will make a guess. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 help: "the http diagnostic port on which the server provides" | 504 help: "the http diagnostic port on which the server provides" |
497 " status and performance information"); | 505 " status and performance information"); |
498 parser.addOption(INTERNAL_DELAY_FREQUENCY); | 506 parser.addOption(INTERNAL_DELAY_FREQUENCY); |
499 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); | 507 parser.addOption(SDK_OPTION, help: "[path] the path to the sdk"); |
500 parser.addFlag(NO_ERROR_NOTIFICATION, | 508 parser.addFlag(NO_ERROR_NOTIFICATION, |
501 help: "disable sending all analysis error notifications to the server", | 509 help: "disable sending all analysis error notifications to the server", |
502 defaultsTo: false, | 510 defaultsTo: false, |
503 negatable: false); | 511 negatable: false); |
504 parser.addFlag(NO_INDEX, | 512 parser.addFlag(NO_INDEX, |
505 help: "disable indexing sources", defaultsTo: false, negatable: false); | 513 help: "disable indexing sources", defaultsTo: false, negatable: false); |
| 514 parser.addFlag(USE_ANALISYS_HIGHLIGHT2, |
| 515 help: "enable version 2 of semantic highlight", |
| 516 defaultsTo: false, |
| 517 negatable: false); |
506 parser.addOption(FILE_READ_MODE, | 518 parser.addOption(FILE_READ_MODE, |
507 help: "an option of the ways files can be read from disk, " + | 519 help: "an option of the ways files can be read from disk, " + |
508 "some clients normalize end of line characters which would make " + | 520 "some clients normalize end of line characters which would make " + |
509 "the file offset and range information incorrect.", | 521 "the file offset and range information incorrect.", |
510 allowed: ["as-is", "normalize-eol-always"], | 522 allowed: ["as-is", "normalize-eol-always"], |
511 allowedHelp: { | 523 allowedHelp: { |
512 "as-is": "file contents are read as-is, no file changes occur", | 524 "as-is": "file contents are read as-is, no file changes occur", |
513 "normalize-eol-always": | 525 "normalize-eol-always": |
514 r'file contents normalize the end of line characters to the single cha
racter new line `\n`' | 526 r'file contents normalize the end of line characters to the single cha
racter new line `\n`' |
515 }, | 527 }, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 uuidFile.parent.createSync(recursive: true); | 564 uuidFile.parent.createSync(recursive: true); |
553 uuidFile.writeAsStringSync(uuid); | 565 uuidFile.writeAsStringSync(uuid); |
554 } catch (exception, stackTrace) { | 566 } catch (exception, stackTrace) { |
555 service.logPriorityException(exception, stackTrace); | 567 service.logPriorityException(exception, stackTrace); |
556 // Slightly alter the uuid to indicate it was not persisted | 568 // Slightly alter the uuid to indicate it was not persisted |
557 uuid = 'temp-$uuid'; | 569 uuid = 'temp-$uuid'; |
558 } | 570 } |
559 return uuid; | 571 return uuid; |
560 } | 572 } |
561 } | 573 } |
OLD | NEW |