| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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:convert'; | 6 import 'dart:convert'; |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:analysis_server/protocol/protocol_generated.dart'; | 9 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 10 import 'package:analysis_server/src/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 line-height: 1.75; | 136 line-height: 1.75; |
| 137 color: #7a7a7a; | 137 color: #7a7a7a; |
| 138 border-top: 1px solid #eee; | 138 border-top: 1px solid #eee; |
| 139 } | 139 } |
| 140 | 140 |
| 141 .footer strong { | 141 .footer strong { |
| 142 color: #333; | 142 color: #333; |
| 143 } | 143 } |
| 144 '''; | 144 '''; |
| 145 | 145 |
| 146 final bool _showLints = false; |
| 147 |
| 146 String get _sdkVersion { | 148 String get _sdkVersion { |
| 147 String version = Platform.version; | 149 String version = Platform.version; |
| 148 if (version.contains(' ')) { | 150 if (version.contains(' ')) { |
| 149 version = version.substring(0, version.indexOf(' ')); | 151 version = version.substring(0, version.indexOf(' ')); |
| 150 } | 152 } |
| 151 return version; | 153 return version; |
| 152 } | 154 } |
| 153 | 155 |
| 154 String writeOption(String name, dynamic value) { | 156 String writeOption(String name, dynamic value) { |
| 155 return '$name: <code>$value</code><br> '; | 157 return '$name: <code>$value</code><br> '; |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 buf.writeln('</div>'); | 461 buf.writeln('</div>'); |
| 460 | 462 |
| 461 h3('Lints'); | 463 h3('Lints'); |
| 462 p(driver.analysisOptions.lintRules.map((l) => l.name).join(', ')); | 464 p(driver.analysisOptions.lintRules.map((l) => l.name).join(', ')); |
| 463 | 465 |
| 464 h3('Error processors'); | 466 h3('Error processors'); |
| 465 p(driver.analysisOptions.errorProcessors | 467 p(driver.analysisOptions.errorProcessors |
| 466 .map((e) => e.description) | 468 .map((e) => e.description) |
| 467 .join(', ')); | 469 .join(', ')); |
| 468 | 470 |
| 471 h3('Plugins'); |
| 472 p(driver.analysisOptions.enabledPluginNames.join(', ')); |
| 473 |
| 469 List<String> priorityFiles = driver.priorityFiles; | 474 List<String> priorityFiles = driver.priorityFiles; |
| 470 List<String> addedFiles = driver.addedFiles.toList(); | 475 List<String> addedFiles = driver.addedFiles.toList(); |
| 471 List<String> implicitFiles = | 476 List<String> implicitFiles = |
| 472 driver.knownFiles.difference(driver.addedFiles).toList(); | 477 driver.knownFiles.difference(driver.addedFiles).toList(); |
| 473 addedFiles.sort(); | 478 addedFiles.sort(); |
| 474 implicitFiles.sort(); | 479 implicitFiles.sort(); |
| 475 | 480 |
| 476 String lenCounter(List list) { | 481 String lenCounter(List list) { |
| 477 return '<span class="counter" style="float: right;">${list | 482 return '<span class="counter" style="float: right;">${list |
| 478 .length}</span>'; | 483 .length}</span>'; |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 Future<Null> generatePage(Map<String, String> params) async { | 779 Future<Null> generatePage(Map<String, String> params) async { |
| 775 try { | 780 try { |
| 776 _description = params['file']; | 781 _description = params['file']; |
| 777 await super.generatePage(params); | 782 await super.generatePage(params); |
| 778 } finally { | 783 } finally { |
| 779 _description = null; | 784 _description = null; |
| 780 } | 785 } |
| 781 } | 786 } |
| 782 } | 787 } |
| 783 | 788 |
| 784 class ExceptionPage extends DiagnosticPage { | |
| 785 final StackTrace trace; | |
| 786 | |
| 787 ExceptionPage(Site site, String message, this.trace) | |
| 788 : super(site, '', '500 Oops', description: message); | |
| 789 | |
| 790 void generateContent(Map<String, String> params) { | |
| 791 p(trace.toString(), style: 'white-space: pre'); | |
| 792 } | |
| 793 } | |
| 794 | |
| 795 class EnvironmentVariablesPage extends DiagnosticPageWithNav { | 789 class EnvironmentVariablesPage extends DiagnosticPageWithNav { |
| 796 EnvironmentVariablesPage(DiagnosticsSite site) | 790 EnvironmentVariablesPage(DiagnosticsSite site) |
| 797 : super(site, 'environment', 'Environment Variables', | 791 : super(site, 'environment', 'Environment Variables', |
| 798 description: | 792 description: |
| 799 'System environment variables as seen from the analysis server.'
); | 793 'System environment variables as seen from the analysis server.'
); |
| 800 | 794 |
| 801 @override | 795 @override |
| 802 void generateContent(Map<String, String> params) { | 796 void generateContent(Map<String, String> params) { |
| 803 buf.writeln('<table>'); | 797 buf.writeln('<table>'); |
| 804 buf.writeln('<tr><th>Variable</th><th>Value</th></tr>'); | 798 buf.writeln('<tr><th>Variable</th><th>Value</th></tr>'); |
| 805 for (String key in Platform.environment.keys.toList()..sort()) { | 799 for (String key in Platform.environment.keys.toList()..sort()) { |
| 806 String value = Platform.environment[key]; | 800 String value = Platform.environment[key]; |
| 807 buf.writeln('<tr><td>${escape(key)}</td><td>${escape(value)}</td></tr>'); | 801 buf.writeln('<tr><td>${escape(key)}</td><td>${escape(value)}</td></tr>'); |
| 808 } | 802 } |
| 809 buf.writeln('</table>'); | 803 buf.writeln('</table>'); |
| 810 } | 804 } |
| 811 } | 805 } |
| 812 | 806 |
| 807 class ExceptionPage extends DiagnosticPage { |
| 808 final StackTrace trace; |
| 809 |
| 810 ExceptionPage(Site site, String message, this.trace) |
| 811 : super(site, '', '500 Oops', description: message); |
| 812 |
| 813 void generateContent(Map<String, String> params) { |
| 814 p(trace.toString(), style: 'white-space: pre'); |
| 815 } |
| 816 } |
| 817 |
| 813 class ExceptionsPage extends DiagnosticPageWithNav { | 818 class ExceptionsPage extends DiagnosticPageWithNav { |
| 814 ExceptionsPage(DiagnosticsSite site) | 819 ExceptionsPage(DiagnosticsSite site) |
| 815 : super(site, 'exceptions', 'Exceptions', | 820 : super(site, 'exceptions', 'Exceptions', |
| 816 description: 'Exceptions from the analysis server.'); | 821 description: 'Exceptions from the analysis server.'); |
| 817 | 822 |
| 818 Iterable<ServerException> get exceptions => server.exceptions.items; | 823 Iterable<ServerException> get exceptions => server.exceptions.items; |
| 819 | 824 |
| 820 String get navDetail => printInteger(exceptions.length); | 825 String get navDetail => printInteger(exceptions.length); |
| 821 | 826 |
| 822 @override | 827 @override |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 | 989 |
| 985 h3('Overlays ${lenCounter(paths)}', raw: true); | 990 h3('Overlays ${lenCounter(paths)}', raw: true); |
| 986 ul(paths, (String overlayPath) { | 991 ul(paths, (String overlayPath) { |
| 987 String uri = '$path?overlay=${Uri.encodeQueryComponent(overlayPath)}'; | 992 String uri = '$path?overlay=${Uri.encodeQueryComponent(overlayPath)}'; |
| 988 buf.writeln('<a href="$uri">${escape(overlayPath)}</a>'); | 993 buf.writeln('<a href="$uri">${escape(overlayPath)}</a>'); |
| 989 }); | 994 }); |
| 990 } | 995 } |
| 991 } | 996 } |
| 992 } | 997 } |
| 993 | 998 |
| 999 // TODO(devoncarew): We're not currently tracking the time spent in specific |
| 1000 // lints by default (analysisOptions / driverOptions enableTiming) |
| 994 class PluginsPage extends DiagnosticPageWithNav { | 1001 class PluginsPage extends DiagnosticPageWithNav { |
| 995 PluginsPage(DiagnosticsSite site) | 1002 PluginsPage(DiagnosticsSite site) |
| 996 : super(site, 'plugins', 'Plugins', description: 'Plugins in use.'); | 1003 : super(site, 'plugins', 'Plugins', description: 'Plugins in use.'); |
| 997 | 1004 |
| 998 @override | 1005 @override |
| 999 void generateContent(Map<String, String> params) { | 1006 void generateContent(Map<String, String> params) { |
| 1000 h3('Analysis plugins'); | 1007 h3('Analysis plugins'); |
| 1001 List<PluginInfo> analysisPlugins = server.pluginManager.plugins; | 1008 List<PluginInfo> analysisPlugins = server.pluginManager.plugins; |
| 1002 | 1009 |
| 1003 if (analysisPlugins.isEmpty) { | 1010 if (analysisPlugins.isEmpty) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1018 | 1025 |
| 1019 List<Plugin> plugins = [ | 1026 List<Plugin> plugins = [ |
| 1020 AnalysisEngine.instance.enginePlugin, | 1027 AnalysisEngine.instance.enginePlugin, |
| 1021 server.serverPlugin | 1028 server.serverPlugin |
| 1022 ]; | 1029 ]; |
| 1023 plugins.addAll(server.userDefinedPlugins); | 1030 plugins.addAll(server.userDefinedPlugins); |
| 1024 ul(plugins, writePlugin); | 1031 ul(plugins, writePlugin); |
| 1025 } | 1032 } |
| 1026 } | 1033 } |
| 1027 | 1034 |
| 1028 // TODO(devoncarew): We're not currently tracking the time spent in specific | |
| 1029 // lints by default (analysisOptions / driverOptions enableTiming) | |
| 1030 final bool _showLints = false; | |
| 1031 | |
| 1032 class ProfilePage extends DiagnosticPageWithNav { | 1035 class ProfilePage extends DiagnosticPageWithNav { |
| 1033 ProfilePage(DiagnosticsSite site) | 1036 ProfilePage(DiagnosticsSite site) |
| 1034 : super(site, 'profile', 'Profiling Info', | 1037 : super(site, 'profile', 'Profiling Info', |
| 1035 description: 'Profiling performance tag data.'); | 1038 description: 'Profiling performance tag data.'); |
| 1036 | 1039 |
| 1037 @override | 1040 @override |
| 1038 void generateContent(Map<String, String> params) { | 1041 void generateContent(Map<String, String> params) { |
| 1039 h3('Profiling performance tag data'); | 1042 h3('Profiling performance tag data'); |
| 1040 | 1043 |
| 1041 // prepare sorted tags | 1044 // prepare sorted tags |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 h3('Execution domain'); | 1199 h3('Execution domain'); |
| 1197 ul(ExecutionService.VALUES, (item) { | 1200 ul(ExecutionService.VALUES, (item) { |
| 1198 if (domain.onFileAnalyzed != null) { | 1201 if (domain.onFileAnalyzed != null) { |
| 1199 buf.write('$item (has subscriptions)'); | 1202 buf.write('$item (has subscriptions)'); |
| 1200 } else { | 1203 } else { |
| 1201 buf.write('$item (no subscriptions)'); | 1204 buf.write('$item (no subscriptions)'); |
| 1202 } | 1205 } |
| 1203 }); | 1206 }); |
| 1204 } | 1207 } |
| 1205 } | 1208 } |
| OLD | NEW |