| 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 analysis_server.src.status.get_handler; | 5 library analysis_server.src.status.get_handler; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 * encoded). | 58 * encoded). |
| 59 */ | 59 */ |
| 60 typedef void HtmlGenerator(StringBuffer buffer); | 60 typedef void HtmlGenerator(StringBuffer buffer); |
| 61 | 61 |
| 62 class ElementCounter extends RecursiveElementVisitor { | 62 class ElementCounter extends RecursiveElementVisitor { |
| 63 Map<Type, int> counts = new HashMap<Type, int>(); | 63 Map<Type, int> counts = new HashMap<Type, int>(); |
| 64 int elementsWithDocs = 0; | 64 int elementsWithDocs = 0; |
| 65 int totalDocSpan = 0; | 65 int totalDocSpan = 0; |
| 66 | 66 |
| 67 void visit(Element element) { | 67 void visit(Element element) { |
| 68 SourceRange docRange = element.docRange; | 68 String comment = element.documentationComment; |
| 69 if (docRange != null) { | 69 if (comment != null) { |
| 70 ++elementsWithDocs; | 70 ++elementsWithDocs; |
| 71 totalDocSpan += docRange.length; | 71 totalDocSpan += comment.length; |
| 72 } | 72 } |
| 73 | 73 |
| 74 Type type = element.runtimeType; | 74 Type type = element.runtimeType; |
| 75 if (counts[type] == null) { | 75 if (counts[type] == null) { |
| 76 counts[type] = 1; | 76 counts[type] = 1; |
| 77 } else { | 77 } else { |
| 78 counts[type]++; | 78 counts[type]++; |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 buffer.write('</p>'); | 1286 buffer.write('</p>'); |
| 1287 } | 1287 } |
| 1288 } | 1288 } |
| 1289 | 1289 |
| 1290 List<ErrorProcessor> errorProcessors = | 1290 List<ErrorProcessor> errorProcessors = |
| 1291 context.getConfigurationData(CONFIGURED_ERROR_PROCESSORS); | 1291 context.getConfigurationData(CONFIGURED_ERROR_PROCESSORS); |
| 1292 int processorCount = errorProcessors?.length ?? 0; | 1292 int processorCount = errorProcessors?.length ?? 0; |
| 1293 buffer.write('<p><b>Error Processor count</b>: $processorCount</p>'); | 1293 buffer.write('<p><b>Error Processor count</b>: $processorCount</p>'); |
| 1294 }); | 1294 }); |
| 1295 | 1295 |
| 1296 _writeFiles(buffer, 'Priority Files', priorityNames); | 1296 _writeFiles( |
| 1297 _writeFiles(buffer, 'Explicitly Analyzed Files', explicitNames); | 1297 buffer, 'Priority Files (${priorityNames.length})', priorityNames); |
| 1298 _writeFiles(buffer, 'Implicitly Analyzed Files', implicitNames); | 1298 _writeFiles( |
| 1299 buffer, |
| 1300 'Explicitly Analyzed Files (${explicitNames.length})', |
| 1301 explicitNames); |
| 1302 _writeFiles( |
| 1303 buffer, |
| 1304 'Implicitly Analyzed Files (${implicitNames.length})', |
| 1305 implicitNames); |
| 1299 | 1306 |
| 1300 buffer.write('<h3>Exceptions</h3>'); | 1307 buffer.write('<h3>Exceptions</h3>'); |
| 1301 if (exceptions.isEmpty) { | 1308 if (exceptions.isEmpty) { |
| 1302 buffer.write('<p>none</p>'); | 1309 buffer.write('<p>none</p>'); |
| 1303 } else { | 1310 } else { |
| 1304 exceptions.forEach((CaughtException exception) { | 1311 exceptions.forEach((CaughtException exception) { |
| 1305 _writeException(buffer, exception); | 1312 _writeException(buffer, exception); |
| 1306 }); | 1313 }); |
| 1307 } | 1314 } |
| 1308 | 1315 |
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2401 */ | 2408 */ |
| 2402 static String makeLink( | 2409 static String makeLink( |
| 2403 String path, Map<String, String> params, String innerHtml, | 2410 String path, Map<String, String> params, String innerHtml, |
| 2404 [bool hasError = false]) { | 2411 [bool hasError = false]) { |
| 2405 Uri uri = new Uri(path: path, queryParameters: params); | 2412 Uri uri = new Uri(path: path, queryParameters: params); |
| 2406 String href = HTML_ESCAPE.convert(uri.toString()); | 2413 String href = HTML_ESCAPE.convert(uri.toString()); |
| 2407 String classAttribute = hasError ? ' class="error"' : ''; | 2414 String classAttribute = hasError ? ' class="error"' : ''; |
| 2408 return '<a href="$href"$classAttribute>$innerHtml</a>'; | 2415 return '<a href="$href"$classAttribute>$innerHtml</a>'; |
| 2409 } | 2416 } |
| 2410 } | 2417 } |
| OLD | NEW |